-
Notifications
You must be signed in to change notification settings - Fork 70
Error Messages
Oli Bye edited this page Oct 31, 2018
·
1 revision
jmock-junit5 requires:
- @org.junit.jupiter.api.extension.RegisterExtension is used to register the JUnit5Mockery field
- The field type to be JUnit5Mockery. Otherwise JUnit5 will silently ignore the extension.
- The field type to be non-private. Otherwise, again, JUnit5 will silently ignore the extension.
package org.jmock.junit5.testdata;
import org.jmock.Expectations;
import org.jmock.auto.Mock;
import org.jmock.junit5.JUnit5Mockery;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
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();
}
}