Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Mockito and void methods on mock objects

SO I have class TestFoo {

} TestFoo s1 = Mockito.mock(TestFoo.class); TestFoo s2 = Mockito.mock(TestFoo.class);

The Mockito doc “Real Partial Mocks” says to do this:

when(mock.someMethod()).thenCallRealMethod();

we get the error

“The method when(T) in the type Mockito is not applicable for the arguments (void)”

After 1/2 hour of hunting I found a hint, [...]