@@ -0,0 +1,2467 @@
+%0Apackage org.junit.gen5.engine.junit5;%0A%0Aimport static org.junit.gen5.api.Assertions.*;%0Aimport static org.junit.gen5.api.Assumptions.*;%0A%0Aimport java.util.List;%0Aimport java.util.concurrent.atomic.AtomicInteger;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.gen5.api.Test;%0Aimport org.junit.gen5.engine.TestDescriptor;%0Aimport org.junit.gen5.engine.TestExecutionListener;%0Aimport org.junit.gen5.engine.TestPlanSpecification;%0A%0A/**%0A * Unit tests for %7B@link JUnit5TestEngine%7D.%0A *%0A * @author Sam Brannen%0A * @since 5.0%0A */%0Apublic class JUnit5TestEngineTests %7B%0A%0A%09@org.junit.Test%0A%09public void executeTestsFromMethodDescriptors() %7B%0A%09%09JUnit5TestEngine engine = new JUnit5TestEngine();%0A%0A%09%09TestPlanSpecification spec = TestPlanSpecification.builder().classNames(LocalTestCase.class.getName()).build();%0A%0A%09%09List%3CTestDescriptor%3E descriptors = engine.discoverTests(spec);%0A%09%09Assert.assertNotNull(descriptors);%0A%09%09Assert.assertEquals(%22# tests%22, 3, descriptors.size());%0A%0A%09%09TrackingTestExecutionListener listener = new TrackingTestExecutionListener();%0A%0A%09%09engine.execute(descriptors, listener);%0A%0A%09%09Assert.assertEquals(3, listener.testStartedCount.get());%0A%09%09Assert.assertEquals(1, listener.testSucceededCount.get());%0A%09%09Assert.assertEquals(1, listener.testAbortedCount.get());%0A%09%09Assert.assertEquals(1, listener.testFailedCount.get());%0A%09%7D%0A%0A%0A%09private static class LocalTestCase %7B%0A%0A%09%09@Test%0A%09%09void alwaysPasses() %7B%0A%09%09%09/* no-op */%0A%09%09%7D%0A%0A%09%09@Test%0A%09%09void aborted() %7B%0A%09%09%09assumeTrue(false);%0A%09%09%7D%0A%0A%09%09@Test%0A%09%09void alwaysFails() %7B%0A%09%09%09fail(%22#fail%22);%0A%09%09%7D%0A%0A%09%7D%0A%0A%09/**%0A%09 * Simple %7B@link TestExecutionListener%7D that tracks the number of times%0A%09 * that certain callbacks are invoked.%0A%09 */%0A%09private static class TrackingTestExecutionListener implements TestExecutionListener %7B%0A%0A%09%09final AtomicInteger testStartedCount = new AtomicInteger();%0A%09%09final AtomicInteger testSucceededCount = new AtomicInteger();%0A%09%09final AtomicInteger testAbortedCount = new AtomicInteger();%0A%09%09final AtomicInteger testFailedCount = new AtomicInteger();%0A%0A%0A%09%09@Override%0A%09%09public void testStarted(TestDescriptor testDescriptor) %7B%0A%09%09%09testStartedCount.incrementAndGet();%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public void testSucceeded(TestDescriptor testDescriptor) %7B%0A%09%09%09testSucceededCount.incrementAndGet();%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public void testAborted(TestDescriptor testDescriptor, Throwable t) %7B%0A%09%09%09testAbortedCount.incrementAndGet();%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public void testFailed(TestDescriptor testDescriptor, Throwable t) %7B%0A%09%09%09testFailedCount.incrementAndGet();%0A%09%09%7D%0A%0A%09%7D%0A%0A%7D%0A

Introduce JUnit5TestEngineTests to verify status quo