以下に示す関数のJunitテストケースを作成しようとしています:
class A{
int i;
void set()
{
Scanner in=new Scanner(System.in);
i=in.nextInt();
}
}
今私の問題は、Junitテストケースを作成するときです。ユーザーからの入力を除外しません:
public void testSet() throws FileNotFoundException {
System.out.println("set");
A instance = new A();
int i=1;
instance.set(i);
// TODO review the generated test code and remove the default call to fail.
//fail("The test case is a prototype.");
}
ユーザーからの入力を受け入れるにはどうすればよいか教えてください。