Two Laptop Bag*
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
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