因爲我是一個初學者的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