Integrates jMock with JUnit 5.
To write a mock object test in JUnit 5, declare a non-private field of type JUnit5Mockery
that holds a JUnit5Mockery and annotate the field with
@RegisterExtension, as shown below. The Mockery will
be verified after the test has run and before the fixture is torn down.
public class JUnit5TestThatDoesSatisfyExpectations {
\@RegisterExtension
JUnit5Mockery context = new JUnit5Mockery();
\@Mock
private Runnable runnable;
\@Test
public void doesSatisfyExpectations() {
context.checking(new Expectations() {{
oneOf (runnable).run();
}});
runnable.run();
}
}