@Test public void shouldFailFastWhenArgumentMatchersAbused() { misplacedArgumentMatcher(); try { mock(IMethods.class); fail(); } catch (InvalidUseOfMatchersException e) { assertContains("Misplaced argument matcher", e.getMessage()); } }
@Test public void shouldResetOngoingStubbingSoThatMoreMeaningfulExceptionsAreRaised() { mock(IMethods.class); mock.booleanReturningMethod(); reset(mock); try { when(null).thenReturn("anything"); fail(); } catch (MissingMethodInvocationException e) { } }