Categories

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, and refactored:

Mockito.doCallRealMethod().when(s1).assertEquals(s2);

Mavica 411

At Bette’s school, the classroom digicam is a Sony Mavica MVC-FD200, circa 2002, very old school with a FLOPPY drive or Memory Stick media.
…Memory Stick card slot and can store up to 128MB of images

(from Steve’s Digicams) We found a compatible Memory Stick on eBay, but this time she did not have it, [...]