- 实验内容:测试自动售卖机的程序流程(JAVA)
- 实验要求:通过Junit组件给出控制流测试用例和测试结果
三.实验步骤及结果:
3.1实验代码(JAVA)
package baihe;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import junit.framework.TestCase;
public class saleMachineTest extends TestCase {
protected void setUp() throws Exception {
super.setUp();
}
protected void tearDown() throws Exception {
super.tearDown();
}
public void testsaleMachine1(){
saleMachine salemachine1 = new saleMachine();
String expectedResult="Input Information\n"+
"Type:Beer;Money:5 Cents; Change:0\n\n"+
"Current State\n"+