⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testcoffeebrewer.java

📁 这是一个coffee店管理系统,Gourmet咖啡是一个商店
💻 JAVA
字号:
import  java.io.*;

/**
 * Test driver for class <code>CoffeeBrewer</code>.
 *
 * @author  author name
 * @version  1.0.0
 */
public class TestCoffeeBrewer  {

	/* Standard output stream */
	private static PrintWriter  stdOut = new  PrintWriter(System.out, true);

	/* Standard error stream */
	private static PrintWriter  stdErr = new  PrintWriter(System.err, true);

	/**
	 * Displays a message in the standard error stream if the value specified
	 * by parameter <code>condition<code> is <code>false</code>.
	 *
	 * @param message  the error message.
	 * @param condition  the test condition.
	 */
	public static void assertTrue(String message, boolean condition) {

		if (! condition) {
			stdErr.print("** Test failure ");
			stdErr.println(message);
		}
	}

	/**
	 * Test driver for class <code>CoffeeBrewer</code>.
	 *
	 * @param args  not used.
	 */
	public static void  main(String[] args)  {

		String code = "B001";
		String description = "Home Coffee Brewer";
		double price = 150.0;
		String model = "Brewer 100";
		String waterSupply = "Pourover";
		int numberOfCups = 6;

		// Test accessors
		CoffeeBrewer product = new CoffeeBrewer(code, description, price, model,
		                                        waterSupply, numberOfCups);

		assertTrue("1: testing method getModel",
		           model.equals(product.getModel()));
		assertTrue("2: testing method getWaterSupply",
		           waterSupply.equals(product.getWaterSupply()));
		assertTrue("3: testing method getNumberOfCups",
		           numberOfCups == product.getNumberOfCups());

		// Test method toString
		product = new CoffeeBrewer(code, description, price, model,
		                           waterSupply, numberOfCups);
		String result = code + "_" + description + "_" + price + "_"
		                + model + "_" + waterSupply + "_" + numberOfCups;

		assertTrue("4: testing method toString",
		           result.equals(product.toString()));

		stdOut.println("done");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -