Skip to content

Commit

Permalink
Fixes mockito#2285 : Add tests that verify mockito behavior after ass…
Browse files Browse the repository at this point in the history
…ertion
  • Loading branch information
maciejwalkowiak committed Apr 11, 2023
1 parent 0ecdb54 commit f9aeefe
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/test/java/org/mockitousage/matchers/MatchersTest.java
Expand Up @@ -645,4 +645,32 @@ public void assertArg_matcher_fails_when_assertion_fails() throws Exception {
// do nothing
}
}

@Test
public void can_invoke_method_on_mock_after_assert_arg() throws Exception {
mock.oneArg("hello");

try {
verify(mock).oneArg(assertArg((String it) -> assertEquals("not-hello", it)));
fail("Should throw an exception");
} catch (ComparisonFailure e) {
// do nothing
}

mock.oneArg("hello");
}

@Test
public void can_verify_on_mock_after_assert_arg() throws Exception {
mock.oneArg("hello");

try {
verify(mock).oneArg(assertArg((String it) -> assertEquals("not-hello", it)));
fail("Should throw an exception");
} catch (ComparisonFailure e) {
// do nothing
}

verify(mock).oneArg("hello");
}
}

0 comments on commit f9aeefe

Please sign in to comment.