Example #1
0
  @Test
  public void testSpyingOnPrivateMethodWorks() throws Exception {
    when(partialMock, "getMyString").thenReturn("ikk2");

    assertThat(partialMock.getMyString(), equalTo("ikk2"));
    assertThat(partialMock.getStringTwo(), equalTo("two"));
  }
Example #2
0
  @Test
  public void testDoNothingForSpy() {
    doNothing().when(partialMock).throwException();

    partialMock.throwException();
  }