Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Junit, Jmock test: how to test a void method

 
Mi Na Mi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the method throws an Exception?

Does the method change the stated of an object (that goes as parameter)?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic