aspose file tools
The moose likes Testing and the fly likes How do I write a Junit test for my main method in the class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Reply Bookmark "How do I write a Junit test for my main method in the class" Watch "How do I write a Junit test for my main method in the class" New topic
Author

How do I write a Junit test for my main method in the class

sandeep wagh
Greenhorn

Joined: Aug 01, 2007
Posts: 9
Hi,
How do I write a Junit test for my main method in the class. It is the only method in the class and as usual returns void. I can't see any side effect also happenning here which will help me test the result.

Thanks,
Sandeep
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35232
    
    7
But the main method does something, right? :-)

I'd restructure the code so that all the functional code moves out of the main method into instance methods that return meaningful results. So instead of


you'd have



Android appsImageJ pluginsJava web charts
sandeep wagh
Greenhorn

Joined: Aug 01, 2007
Posts: 9
Thanks A lot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I write a Junit test for my main method in the class
 
Similar Threads
Static Variable Access from Junit class
Static method -Junit Test class
testing void methods which insert in database
How to write JUnit for Void method
Any one using Eclipse for real development?