我正在尝试为下面给出的函数编写 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.");
}
请建议我应该怎么做才能接受用户的输入。