// Path: jmock-junit5/src/test/java/org/jmock/junit5/testdata/jmock/acceptance/JUnit5TestThatAutoInstantiatesMocks.java
// public class JUnit5TestThatAutoInstantiatesMocks extends BaseClassWithMockery {
//     @Mock Runnable runnable;
//     @Auto States states;
//     @Auto Sequence sequence;
//     
//     @Test
//     public void fieldsHaveBeenAutoInstantiated() {
//         assertThat(runnable, notNullValue());
//         assertThat(states, notNullValue());
//         assertThat(sequence, notNullValue());
//     }
// }
// 
// Path: jmock-junit5/src/test/java/org/jmock/junit5/testdata/jmock/acceptance/JUnit5TestThatDoesNotCreateAMockery.java
// @ExtendWith(JUnit5Mockery.class)
// public class JUnit5TestThatDoesNotCreateAMockery {
//     @RegisterExtension
//     JUnit5Mockery context = null;
//     
//     @Test
//     public void happy() {
//         // a-ok!
//     }
// }
// 
// Path: jmock-junit5/src/test/java/org/jmock/junit5/testdata/jmock/acceptance/JUnit5TestThatDoesSatisfyExpectations.java
// 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();
//     }
// }
// 
// Path: jmock-junit5/src/test/java/org/jmock/junit5/testdata/jmock/acceptance/JUnit5TestThatThrowsExpectedException.java
// @ExtendWith(ExpectationExtension.class)
// public class JUnit5TestThatThrowsExpectedException {
//     @RegisterExtension
//     JUnit5Mockery context = new JUnit5Mockery();
//     private WithException withException = context.mock(WithException.class);
//     
//     @Test
//     @ExpectationThrows(expected=CheckedException.class)
//     public void doesNotSatisfyExpectationsWhenExpectedExceptionIsThrown() throws CheckedException {
//         context.checking(new Expectations() {{
//             oneOf (withException).anotherMethod();
//             oneOf (withException).throwingMethod(); will(throwException(new CheckedException()));
//         }});
//         
//         withException.throwingMethod();
//     }
//     
//     public static class CheckedException extends Exception {
//     }
//     
//     public interface WithException {
//         void throwingMethod() throws CheckedException;
//         void anotherMethod();
//     }
// }


import org.jmock.junit5.testdata.jmock.acceptance.DerivedJUnit5TestThatDoesNotSatisfyExpectations;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatAutoInstantiatesMocks;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatCreatesNoMockery;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatCreatesTwoMockeries;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatDoesNotCreateAMockery;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatDoesNotSatisfyExpectations;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatDoesSatisfyExpectations;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatThrowsExpectedException;
import org.junit.jupiter.api.Test;
package org.jmock.junit5.acceptance;


/**
 * Wrap, running "testdata" testcases. Some of which are supposed to fail
 * @author oliverbye
 *
 */
public class JUnit5TestRunnerTests {

    FailureRecordingTestExecutionListener listener = new FailureRecordingTestExecutionListener();

    @Test
    public void testTheJUnit5TestRunnerReportsPassingTestsAsSuccessful() {
        listener.runTestIn(JUnit5TestThatDoesSatisfyExpectations.class);
        listener.assertTestSucceeded();
    }

    @Test
    public void testTheJUnit5TestRunnerAutomaticallyAssertsThatAllExpectationsHaveBeenSatisfied() {
        listener.runTestIn(JUnit5TestThatDoesNotSatisfyExpectations.class);
        listener.assertTestFailedWith(AssertionError.class);
    }

    @Test
    public void testTheJUnit5TestRunnerLooksForTheMockeryInBaseClasses() {
        listener.runTestIn(DerivedJUnit5TestThatDoesNotSatisfyExpectations.class);
        listener.assertTestFailedWith(AssertionError.class);
    }

    @Test
    public void testTheJUnit5TestRunnerReportsAHelpfulErrorIfTheMockeryIsNull() {
        listener.runTestIn(JUnit5TestThatDoesNotCreateAMockery.class);
        listener.assertTestFailedWith(org.junit.platform.commons.util.PreconditionViolationException.class);
    }

    // See issue JMOCK-156
// Path: jmock-junit5/src/test/java/org/jmock/junit5/testdata/jmock/acceptance/JUnit5TestThatAutoInstantiatesMocks.java
// public class JUnit5TestThatAutoInstantiatesMocks extends BaseClassWithMockery {
//     @Mock Runnable runnable;
//     @Auto States states;
//     @Auto Sequence sequence;
//     
//     @Test
//     public void fieldsHaveBeenAutoInstantiated() {
//         assertThat(runnable, notNullValue());
//         assertThat(states, notNullValue());
//         assertThat(sequence, notNullValue());
//     }
// }
// 
// Path: jmock-junit5/src/test/java/org/jmock/junit5/testdata/jmock/acceptance/JUnit5TestThatDoesNotCreateAMockery.java
// @ExtendWith(JUnit5Mockery.class)
// public class JUnit5TestThatDoesNotCreateAMockery {
//     @RegisterExtension
//     JUnit5Mockery context = null;
//     
//     @Test
//     public void happy() {
//         // a-ok!
//     }
// }
// 
// Path: jmock-junit5/src/test/java/org/jmock/junit5/testdata/jmock/acceptance/JUnit5TestThatDoesSatisfyExpectations.java
// 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();
//     }
// }
// 
// Path: jmock-junit5/src/test/java/org/jmock/junit5/testdata/jmock/acceptance/JUnit5TestThatThrowsExpectedException.java
// @ExtendWith(ExpectationExtension.class)
// public class JUnit5TestThatThrowsExpectedException {
//     @RegisterExtension
//     JUnit5Mockery context = new JUnit5Mockery();
//     private WithException withException = context.mock(WithException.class);
//     
//     @Test
//     @ExpectationThrows(expected=CheckedException.class)
//     public void doesNotSatisfyExpectationsWhenExpectedExceptionIsThrown() throws CheckedException {
//         context.checking(new Expectations() {{
//             oneOf (withException).anotherMethod();
//             oneOf (withException).throwingMethod(); will(throwException(new CheckedException()));
//         }});
//         
//         withException.throwingMethod();
//     }
//     
//     public static class CheckedException extends Exception {
//     }
//     
//     public interface WithException {
//         void throwingMethod() throws CheckedException;
//         void anotherMethod();
//     }
// }


// Path: jmock-junit5/src/test/java/org/jmock/junit5/acceptance/JUnit5TestRunnerTests.java
import org.jmock.junit5.testdata.jmock.acceptance.DerivedJUnit5TestThatDoesNotSatisfyExpectations;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatAutoInstantiatesMocks;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatCreatesNoMockery;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatCreatesTwoMockeries;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatDoesNotCreateAMockery;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatDoesNotSatisfyExpectations;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatDoesSatisfyExpectations;
import org.jmock.junit5.testdata.jmock.acceptance.JUnit5TestThatThrowsExpectedException;
import org.junit.jupiter.api.Test;

package org.jmock.junit5.acceptance;


/**
 * Wrap, running "testdata" testcases. Some of which are supposed to fail
 * @author oliverbye
 *
 */
public class JUnit5TestRunnerTests {

    FailureRecordingTestExecutionListener listener = new FailureRecordingTestExecutionListener();

    @Test
    public void testTheJUnit5TestRunnerReportsPassingTestsAsSuccessful() {
        listener.runTestIn(JUnit5TestThatDoesSatisfyExpectations.class);
        listener.assertTestSucceeded();
    }

    @Test
    public void testTheJUnit5TestRunnerAutomaticallyAssertsThatAllExpectationsHaveBeenSatisfied() {
        listener.runTestIn(JUnit5TestThatDoesNotSatisfyExpectations.class);
        listener.assertTestFailedWith(AssertionError.class);
    }

    @Test
    public void testTheJUnit5TestRunnerLooksForTheMockeryInBaseClasses() {
        listener.runTestIn(DerivedJUnit5TestThatDoesNotSatisfyExpectations.class);
        listener.assertTestFailedWith(AssertionError.class);
    }

    @Test
    public void testTheJUnit5TestRunnerReportsAHelpfulErrorIfTheMockeryIsNull() {
        listener.runTestIn(JUnit5TestThatDoesNotCreateAMockery.class);
        listener.assertTestFailedWith(org.junit.platform.commons.util.PreconditionViolationException.class);
    }

    // See issue JMOCK-156
    @Test