public class PartialMockingExampleTest {
@Test
public void validatingSpiedObjectGivesCorrectNumberOfExpectedInvocations() throws Exception {
final String expected = "TEST VALUE";
PartialMockingExample underTest = spy(new PartialMockingExample());
doReturn(expected).when(underTest).methodToMock();
assertEquals(expected, underTest.methodToTest());
verify(underTest).methodToMock();
}