wood burning stoves 2.0*
The moose likes Testing and the fly likes Mockito selective use of matchers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Mockito selective use of matchers" Watch "Mockito selective use of matchers" New topic
Author

Mockito selective use of matchers

Joseph Abraham
Greenhorn

Joined: Jun 05, 2013
Posts: 1

I am trying to clean up the unit test code.

I have a line of code in the setup (@Before) which says

mockXX.hasProp(anyString()).thenReturn(false)

But I want to account for the fact that this method may return true in a particular scenario. eg. mockXX.hasProp("id").thenReturn(true)

Any suggestions on how to go about handling this?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mockito selective use of matchers
 
Similar Threads
JUnit Mockito - Spy creating mock - how to stub that mock
Mockito Help - Problem to sort a List of mock objects.
JUnit giving null pointer exception but temp variable fixes exception
Mockito, testing org.hibernate.ScrollableResults count of 1000
final class with inner static class