Skip to content

Commit

Permalink
Upgrade to new Test Kit fluent API
Browse files Browse the repository at this point in the history
Issue: #13
  • Loading branch information
sbrannen committed Nov 9, 2018
1 parent 04f4bba commit 1eebb7d
Showing 1 changed file with 10 additions and 12 deletions.
Expand Up @@ -11,7 +11,6 @@
package org.junit.jupiter.engine.extension; package org.junit.jupiter.engine.extension;


import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.DynamicTest.dynamicTest; import static org.junit.jupiter.api.DynamicTest.dynamicTest;


import java.util.HashSet; import java.util.HashSet;
Expand All @@ -34,7 +33,6 @@
import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.engine.AbstractJupiterTestEngineTests; import org.junit.jupiter.engine.AbstractJupiterTestEngineTests;
import org.junit.jupiter.engine.JupiterTestEngine; import org.junit.jupiter.engine.JupiterTestEngine;
import org.junit.platform.testkit.ExecutionResults;


/** /**
* Integration tests that verify support for custom test method execution order * Integration tests that verify support for custom test method execution order
Expand All @@ -55,10 +53,10 @@ void clearCallSequence() {


@Test @Test
void alphanumeric() { void alphanumeric() {
ExecutionResults executionResults = executeTestsForClass(AlphanumericTestCase.class); var tests = executeTestsForClass(AlphanumericTestCase.class).tests();

tests.assertStatistics(stats -> stats.succeeded(callSequence.size()));


assertEquals(callSequence.size(), executionResults.getTestsStartedCount(), "# tests started");
assertEquals(callSequence.size(), executionResults.getTestsSuccessfulCount(), "# tests succeeded");
assertThat(callSequence).containsExactly("$", "AAA", "ZZ_Top", "___", "a1", "a2", "b", "zzz"); assertThat(callSequence).containsExactly("$", "AAA", "ZZ_Top", "___", "a1", "a2", "b", "zzz");
} }


Expand All @@ -73,10 +71,10 @@ void orderAnnotationInNestedTestClass() {
} }


private void assertOrderAnnotationSupport(Class<?> testClass) { private void assertOrderAnnotationSupport(Class<?> testClass) {
ExecutionResults executionResults = executeTestsForClass(testClass); var tests = executeTestsForClass(testClass).tests();

tests.assertStatistics(stats -> stats.succeeded(callSequence.size()));


assertEquals(callSequence.size(), executionResults.getTestsStartedCount(), "# tests started");
assertEquals(callSequence.size(), executionResults.getTestsSuccessfulCount(), "# tests succeeded");
assertThat(callSequence).containsExactly("test1", "test2", "test3", "test4", "test5", "test6"); assertThat(callSequence).containsExactly("test1", "test2", "test3", "test4", "test5", "test6");
} }


Expand All @@ -87,11 +85,11 @@ void random() {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
callSequence.clear(); callSequence.clear();


ExecutionResults executionResults = executeTestsForClass(RandomTestCase.class); var tests = executeTestsForClass(RandomTestCase.class).tests();
uniqueSequences.add(callSequence.stream().collect(Collectors.joining(",")));


assertEquals(callSequence.size(), executionResults.getTestsStartedCount(), "# tests started"); tests.assertStatistics(stats -> stats.succeeded(callSequence.size()));
assertEquals(callSequence.size(), executionResults.getTestsSuccessfulCount(), "# tests succeeded");
uniqueSequences.add(callSequence.stream().collect(Collectors.joining(",")));
} }


// We assume that at least 3 out of 10 are different... // We assume that at least 3 out of 10 are different...
Expand Down

0 comments on commit 1eebb7d

Please sign in to comment.