use of org.mockito.exceptions.verification.SmartNullPointerException in project mockito by mockito.
the class SmartNullsStubbingTest method shouldSmartNPEPointToUnstubbedCall.
@Test
public void shouldSmartNPEPointToUnstubbedCall() throws Exception {
IMethods methods = unstubbedMethodInvokedHere(mock);
try {
methods.simpleMethod();
fail();
} catch (SmartNullPointerException e) {
assertThat(e).hasMessageContaining("unstubbedMethodInvokedHere(");
}
}
use of org.mockito.exceptions.verification.SmartNullPointerException in project mockito by mockito.
the class MocksCreationTest method shouldCombineMockNameAndSmartNulls.
@Test
public void shouldCombineMockNameAndSmartNulls() {
//given
IMethods mock = mock(IMethods.class, withSettings().defaultAnswer(RETURNS_SMART_NULLS).name("great mockie"));
//when
IMethods smartNull = mock.iMethodsReturningMethod();
String name = mock.toString();
//then
assertThat(name).contains("great mockie");
//and
try {
smartNull.simpleMethod();
fail();
} catch (SmartNullPointerException e) {
}
}
Aggregations