📄 testcase.java
字号:
/**
* @Copyright(C) 2008 Software Engineering Laboratory (SELAB), Department of Computer
* Science, SUN YAT-SEN UNIVERSITY. All rights reserved.
**/
package test;
/**
* The description of a test case. TestCase is designed as an immutable class. The
* data of a test case is described in the XML document by a <testcase> tag.
*
* @author Dr. Wen-jun LI
* @author Da LUO
* @version 1.00 (Last update: March 4, 2008)
**/
public class TestCase
{
/**
* ID of the test case.
**/
private String id;
/**
* Description of the test case.
**/
private String description;
/**
* Input string of an expression of the test case.
**/
private String input;
/**
* Expected output of the test case.
**/
private String output;
/**
* Whether the result is an thrown exception.
**/
private boolean isExceptionExpected;
/**
* Constructor of a TestCase.
*
* @param anId test case ID.
* @param aDesc description of the test case.
* @param anInput the input string of an expression.
* @param anOutput the expected output of test case.
* @param isExc the expected output is an exception.
**/
public TestCase(String anId, String aDesc, String anInput, String anOutput, boolean isExc) {
this.id = anId;
this.description = aDesc;
this.input = anInput;
this.output = anOutput;
this.isExceptionExpected = isExc;
}
/**
* Get the ID of this test case.
*
* @return the ID of the test case.
**/
public String getId() {
return id;
}
/**
* Get the description of this test case.
*
* @return the description of the test case.
**/
public String getDescription() {
return description;
}
/**
* Get the input of this test case.
*
* @return the input of the test case.
**/
public String getInput() {
return input;
}
/**
* Get the expected output of this test case.
*
* @return the expected output of the test case.
**/
public String getOutput() {
return output;
}
/**
* Judge if the result of this test case is an expected exception.
*
* @return true if the expected output is an exception.
**/
public boolean isException() {
return isExceptionExpected;
}
/**
* Override the externalization method inherited from class Object.
*
* @return a string representing the state of the test case.
**/
public String toString() {
return id + " " + description + "\nInput: " + input + "\nExpected output: " + output;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -