File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes Junit, Jmock test: how to test a void method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Junit, Jmock test: how to test a void method" Watch "Junit, Jmock test: how to test a void method" New topic
Author

Junit, Jmock test: how to test a void method

Mi Na Mi
Greenhorn

Joined: Jan 09, 2012
Posts: 4
Hello,

I'd like to ask a question, how can I test a void method.

For example smth like this
Class A{

void method(){
...
some objects, which state can be changed.
...
}
}


I mock some objects, but I have no idea how to test a method which does not return anything....
Thank you
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Does the method throws an Exception?

Does the method change the stated of an object (that goes as parameter)?


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Junit, Jmock test: how to test a void method
 
Similar Threads
Object HashCode in HashMap
how to test void method.
testing void methods which insert in database
Help need to write a test junit test case
Testing of system.out.println