且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Eclipse中将命令行参数传递给JUnit

更新时间:2022-04-04 23:57:21

要测试您的类main方法,只需编写如下内容:

To test your class main method simply write something like:

@Test(expected = IllegalArgumentException.class)
public void testMainWithBadCommandLine()
{
     YourClass.main(new String[] { "NaN" });
}