O'Reilly logo

Learning Modular Java Programming by Tejaswini Mandar Jog

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mockito testing

Mockito is an open source framework used in conjunction with JUnit for testing. Mockito helps in creating Mock objects to be used while testing. Mockito tests help in reducing the tight coupling by removing the requirement of the expectation specification. Mockito creates mock objects with the static method mock() provided by the org.mockito.Mockito class. In Mockito, the when() method defines the action to be taken and then Return() returns the result of the action. When() can define a method call and thenReturn() is expected to return from the method. The when() accepts the argument of the method to be invoked and the result to be returned will be the argument of thenReturn(). when() accepts the method under testing and thenReturn() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required