因为我是一个初学者的JUnit请在下面的课堂写作的测试案例帮助如何为下面的类编写JUnit测试用例?
我的程序如下:
public class One
{
public void caseOne()
{
int max=0,
cardNo=0;
System.out.println("Name:");
String name=br.readLine();
System.out.println("Amount:");
int amount=Integer.parseInt(br.readLine());
int max=0;
for(Customer c :custList)
{
if(c.getCardNo()>max)
{
max=c.cardNo;
}
}
System.out.println("Your card no:"+(max+1));
Customer newCust=new Customer(name,amount,max+1);
custList.add(newCust);
}
}
第一个测试是看代码是否编译 – smk
我不这样编译。@ sindu ...你可以通过更好的代码格式吗?http://meta.stackexchange.com/questions/22186/how-do -i-format-my-code-blocks – SRy