Debian Codegraph @

jmock-junit5/src/test/java/org/jmock/junit5/acceptance/JUnit5WithRulesTestRunnerTests.java

raw
1 package org.jmock.junit5.acceptance;
2
3 import org.jmock.junit5.testdata.jmock.acceptance.JUnit5WithRulesExamples;
4 import org.junit.jupiter.api.Test;
5 import org.junit.jupiter.api.extension.ExtensionConfigurationException;
6
7 public class JUnit5WithRulesTestRunnerTests {
8 FailureRecordingTestExecutionListener listener = new FailureRecordingTestExecutionListener();
9
10 @Test
11 public void testTheJUnit4TestRunnerReportsPassingTestsAsSuccessful() {
12 listener.runTestIn(JUnit5WithRulesExamples.SatisfiesExpectations.class);
13 listener.assertTestSucceeded();
14 }
15
16 @Test
17 public void testTheJUnit4TestRunnerAutomaticallyAssertsThatAllExpectationsHaveBeenSatisfied() {
18 listener.runTestIn(JUnit5WithRulesExamples.DoesNotSatisfyExpectations.class);
19 listener.assertTestFailedWith(AssertionError.class);
20 }
21
22 @Test
23 public void testTheJUnit4TestRunnerLooksForTheMockeryInBaseClasses() {
24 listener.runTestIn(JUnit5WithRulesExamples.DerivedAndDoesNotSatisfyExpectations.class);
25 listener.assertTestFailedWith(AssertionError.class);
26 }
27
28
29 // See issue JMOCK-156
30 @Test
31 public void testReportsMocksAreNotSatisfiedWhenExpectedExceptionIsThrown() {
32 listener.runTestIn(JUnit5WithRulesExamples.ThrowsExpectedException.class);
33 listener.assertTestFailedWith(AssertionError.class);
34 }
35
36 @Test
37 public void testFailsWhenMoreThanOneJMockContextField() {
38 listener.runTestIn(JUnit5WithRulesExamples.CreatesTwoMockeries.class);
39 listener.assertTestFailedWith(ExtensionConfigurationException.class);
40 }
41
42 @Test
43 public void testAutoInstantiatesMocks() {
44 listener.runTestIn(JUnit5WithRulesExamples.AutoInstantiatesMocks.class);
45 listener.assertTestSucceeded();
46 }
47 }