dcsimg
Testing in JUnit methods that has void return type
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Friday, March 23, 2007 05:09 AM

Hi Group,

I need to know how can I test in Junit a method which has void return.. How can I write a test case for it? My method doesnt update the database nor any files are involved in it.. It doesnt raise any exception.. Anyone explain me with the sample code snippnet if possible..

Re: Testing in JUnit methods that has void return type

Posted By:   soumya_s  
Posted On:   Friday, May 4, 2007 08:41 AM

I know this is an old post, but this might be useful for those who are looking for tips on testing void return - there is one in the junit FAQ under -

How do I test a method that doesn't return anything?

Re: Testing in JUnit methods that has void return type

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, March 25, 2007 11:18 AM

If it doesn't affect anything, then there's nothing to test, right? If it does affect something, then test that something's value, before and after the method call?
About | Sitemap | Contact