Using Junit coverage, it can't cover public static void main method. How can i cover it?
anyone can help me? urgent. Thanks
Using Junit coverage, it can't cover public static void main method. How can i cover it?
anyone can help me? urgent. Thanks
After making sure it's testable just call it as any other public static method:
YourClass.main(new String[] {"parameter 1", "parameter 2"});
And assert the following state afterwards.
Because it does not return anything, you cannot check the output. But what does it do? If it calls another method the write a test for that method. If it doesn't call other methods, then write a test for that.