Skip to content

Commit

Permalink
Rename Java selector methods to align with test sources
Browse files Browse the repository at this point in the history
This commit picks up where d85ea4d
left off by renaming the following Java "select" factory methods in
DiscoverySelectors.

 - Renamed `selectPackage(*)` to `selectJavaPackage(*)`

 - Renamed `selectClass(*)` to `selectJavaClass(*)`

 - Renamed `selectMethod(*)` to `selectJavaMethod(*)`

Issue: #472
  • Loading branch information
sbrannen committed Aug 18, 2016
1 parent 1ace408 commit d34ac46
Show file tree
Hide file tree
Showing 32 changed files with 198 additions and 181 deletions.
15 changes: 11 additions & 4 deletions documentation/src/docs/asciidoc/release-notes-5.0.0-M3.adoc
Expand Up @@ -31,10 +31,17 @@ on GitHub.


====== Deprecations and Breaking Changes ====== Deprecations and Breaking Changes


* `ClasspathSelector` has been renamed to `ClasspathRootSelector`. * `ClasspathSelector` has been renamed to `ClasspathRootSelector` to avoid confusion with
* `PackageSelector` has been renamed to `JavaPackageSelector` to align with `JavaPackageSource`. `ClasspathResourceSelector`.
* `ClassSelector` has been renamed to `JavaClassSelector` to align with `JavaClassSource`. * `PackageSelector` and `DiscoverySelectors.selectPackage()` have been renamed to
* `MethodSelector` has been renamed to `JavaMethodSelector` to align with `JavaMethodSource`. `JavaPackageSelector` and `DiscoverySelectors.selectJavaPackage()` to align with
`JavaPackageSource`.
* `ClassSelector` and `DiscoverySelectors.selectClass()` have been renamed to
`JavaClassSelector` and `DiscoverySelectors.selectJavaClass()` to align with
`JavaClassSource`.
* `MethodSelector` and `DiscoverySelectors.selectMethod()` have been renamed to
`JavaMethodSelector` and `DiscoverySelectors.selectJavaMethod()` to align with
`JavaMethodSource`.
* The `-p` command-line option for configuring additional classpath entries for the * The `-p` command-line option for configuring additional classpath entries for the
`ConsoleLauncher` has been renamed to `-cp` in order to align with the option names for `ConsoleLauncher` has been renamed to `-cp` in order to align with the option names for
the standard `java` executable. In addition, a new `--class-path` alias has been the standard `java` executable. In addition, a new `--class-path` alias has been
Expand Down
12 changes: 6 additions & 6 deletions documentation/src/test/java/example/UsingTheLauncherDemo.java
Expand Up @@ -12,8 +12,8 @@


// tag::imports[] // tag::imports[]
import static org.junit.platform.engine.discovery.ClassFilter.includeClassNamePattern; import static org.junit.platform.engine.discovery.ClassFilter.includeClassNamePattern;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaClass;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectPackage; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaPackage;


import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.platform.launcher.Launcher; import org.junit.platform.launcher.Launcher;
Expand All @@ -37,8 +37,8 @@ void discovery() {
// tag::discovery[] // tag::discovery[]
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request() LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
.selectors( .selectors(
selectPackage("com.example.mytests"), selectJavaPackage("com.example.mytests"),
selectClass(MyTestClass.class) selectJavaClass(MyTestClass.class)
) )
.filters(includeClassNamePattern(".*Test")) .filters(includeClassNamePattern(".*Test"))
.build(); .build();
Expand All @@ -54,8 +54,8 @@ void execution() {
// tag::execution[] // tag::execution[]
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request() LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
.selectors( .selectors(
selectPackage("com.example.mytests"), selectJavaPackage("com.example.mytests"),
selectClass(MyTestClass.class) selectJavaClass(MyTestClass.class)
) )
.filters(includeClassNamePattern(".*Test")) .filters(includeClassNamePattern(".*Test"))
.build(); .build();
Expand Down
Expand Up @@ -10,7 +10,7 @@


package org.junit.jupiter.engine; package org.junit.jupiter.engine;


import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaClass;
import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request;


import org.junit.platform.engine.ExecutionRequest; import org.junit.platform.engine.ExecutionRequest;
Expand All @@ -29,7 +29,7 @@ public abstract class AbstractJupiterTestEngineTests {
private final JupiterTestEngine engine = new JupiterTestEngine(); private final JupiterTestEngine engine = new JupiterTestEngine();


protected ExecutionEventRecorder executeTestsForClass(Class<?> testClass) { protected ExecutionEventRecorder executeTestsForClass(Class<?> testClass) {
return executeTests(request().selectors(selectClass(testClass)).build()); return executeTests(request().selectors(selectJavaClass(testClass)).build());
} }


protected ExecutionEventRecorder executeTests(LauncherDiscoveryRequest request) { protected ExecutionEventRecorder executeTests(LauncherDiscoveryRequest request) {
Expand Down
Expand Up @@ -12,7 +12,7 @@


import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaClass;
import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request;


import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
Expand All @@ -29,7 +29,8 @@ public class DisabledTests extends AbstractJupiterTestEngineTests {


@Test @Test
public void executeTestsWithDisabledTestClass() { public void executeTestsWithDisabledTestClass() {
LauncherDiscoveryRequest request = request().selectors(selectClass(DisabledTestClassTestCase.class)).build(); LauncherDiscoveryRequest request = request().selectors(
selectJavaClass(DisabledTestClassTestCase.class)).build();
ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


assertEquals(1, eventRecorder.getContainerSkippedCount(), "# container skipped"); assertEquals(1, eventRecorder.getContainerSkippedCount(), "# container skipped");
Expand All @@ -38,7 +39,8 @@ public void executeTestsWithDisabledTestClass() {


@Test @Test
public void executeTestsWithDisabledTestMethods() { public void executeTestsWithDisabledTestMethods() {
LauncherDiscoveryRequest request = request().selectors(selectClass(DisabledTestMethodsTestCase.class)).build(); LauncherDiscoveryRequest request = request().selectors(
selectJavaClass(DisabledTestMethodsTestCase.class)).build();
ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started"); assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started");
Expand Down
Expand Up @@ -15,8 +15,8 @@
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.DynamicTest.dynamicTest; import static org.junit.jupiter.api.DynamicTest.dynamicTest;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaClass;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectMethod; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaMethod;
import static org.junit.platform.engine.test.event.ExecutionEventConditions.assertRecordedExecutionEventsContainsExactly; import static org.junit.platform.engine.test.event.ExecutionEventConditions.assertRecordedExecutionEventsContainsExactly;
import static org.junit.platform.engine.test.event.ExecutionEventConditions.container; import static org.junit.platform.engine.test.event.ExecutionEventConditions.container;
import static org.junit.platform.engine.test.event.ExecutionEventConditions.dynamicTestRegistered; import static org.junit.platform.engine.test.event.ExecutionEventConditions.dynamicTestRegistered;
Expand Down Expand Up @@ -51,23 +51,23 @@ class DynamicTestGenerationTests extends AbstractJupiterTestEngineTests {


@Test @Test
void testFactoryMethodsAreCorrectlyDiscoveredForClassSelector() { void testFactoryMethodsAreCorrectlyDiscoveredForClassSelector() {
LauncherDiscoveryRequest request = request().selectors(selectClass(MyDynamicTestCase.class)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaClass(MyDynamicTestCase.class)).build();
TestDescriptor engineDescriptor = discoverTests(request); TestDescriptor engineDescriptor = discoverTests(request);
assertEquals(5, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors"); assertEquals(5, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors");
} }


@Test @Test
void testFactoryMethodIsCorrectlyDiscoveredForMethodSelector() { void testFactoryMethodIsCorrectlyDiscoveredForMethodSelector() {
LauncherDiscoveryRequest request = request().selectors( LauncherDiscoveryRequest request = request().selectors(
selectMethod(MyDynamicTestCase.class, "dynamicStream")).build(); selectJavaMethod(MyDynamicTestCase.class, "dynamicStream")).build();
TestDescriptor engineDescriptor = discoverTests(request); TestDescriptor engineDescriptor = discoverTests(request);
assertEquals(2, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors"); assertEquals(2, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors");
} }


@Test @Test
void dynamicTestsAreExecutedFromStream() { void dynamicTestsAreExecutedFromStream() {
LauncherDiscoveryRequest request = request().selectors( LauncherDiscoveryRequest request = request().selectors(
selectMethod(MyDynamicTestCase.class, "dynamicStream")).build(); selectJavaMethod(MyDynamicTestCase.class, "dynamicStream")).build();


ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


Expand All @@ -89,7 +89,7 @@ void dynamicTestsAreExecutedFromStream() {
@Test @Test
void dynamicTestsAreExecutedFromCollection() { void dynamicTestsAreExecutedFromCollection() {
LauncherDiscoveryRequest request = request().selectors( LauncherDiscoveryRequest request = request().selectors(
selectMethod(MyDynamicTestCase.class, "dynamicCollection")).build(); selectJavaMethod(MyDynamicTestCase.class, "dynamicCollection")).build();


ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


Expand All @@ -105,7 +105,7 @@ void dynamicTestsAreExecutedFromCollection() {
@Test @Test
void dynamicTestsAreExecutedFromIterator() { void dynamicTestsAreExecutedFromIterator() {
LauncherDiscoveryRequest request = request().selectors( LauncherDiscoveryRequest request = request().selectors(
selectMethod(MyDynamicTestCase.class, "dynamicIterator")).build(); selectJavaMethod(MyDynamicTestCase.class, "dynamicIterator")).build();


ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


Expand All @@ -121,7 +121,7 @@ void dynamicTestsAreExecutedFromIterator() {
@Test @Test
void dynamicTestsAreExecutedFromIterable() { void dynamicTestsAreExecutedFromIterable() {
LauncherDiscoveryRequest request = request().selectors( LauncherDiscoveryRequest request = request().selectors(
selectMethod(MyDynamicTestCase.class, "dynamicIterable")).build(); selectJavaMethod(MyDynamicTestCase.class, "dynamicIterable")).build();


ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


Expand Down
Expand Up @@ -12,7 +12,7 @@


import static org.assertj.core.api.Assertions.allOf; import static org.assertj.core.api.Assertions.allOf;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectMethod; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaMethod;
import static org.junit.platform.engine.test.event.ExecutionEventConditions.assertRecordedExecutionEventsContainsExactly; import static org.junit.platform.engine.test.event.ExecutionEventConditions.assertRecordedExecutionEventsContainsExactly;
import static org.junit.platform.engine.test.event.ExecutionEventConditions.container; import static org.junit.platform.engine.test.event.ExecutionEventConditions.container;
import static org.junit.platform.engine.test.event.ExecutionEventConditions.engine; import static org.junit.platform.engine.test.event.ExecutionEventConditions.engine;
Expand Down Expand Up @@ -50,7 +50,7 @@ public class ExceptionHandlingTests extends AbstractJupiterTestEngineTests {
@Test @Test
public void failureInTestMethodIsRegistered() throws NoSuchMethodException { public void failureInTestMethodIsRegistered() throws NoSuchMethodException {
Method method = FailureTestCase.class.getDeclaredMethod("failingTest"); Method method = FailureTestCase.class.getDeclaredMethod("failingTest");
LauncherDiscoveryRequest request = request().selectors(selectMethod(FailureTestCase.class, method)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaMethod(FailureTestCase.class, method)).build();


ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


Expand All @@ -65,7 +65,7 @@ public void failureInTestMethodIsRegistered() throws NoSuchMethodException {
@Test @Test
public void uncheckedExceptionInTestMethodIsRegistered() throws NoSuchMethodException { public void uncheckedExceptionInTestMethodIsRegistered() throws NoSuchMethodException {
Method method = FailureTestCase.class.getDeclaredMethod("testWithUncheckedException"); Method method = FailureTestCase.class.getDeclaredMethod("testWithUncheckedException");
LauncherDiscoveryRequest request = request().selectors(selectMethod(FailureTestCase.class, method)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaMethod(FailureTestCase.class, method)).build();


ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


Expand All @@ -80,7 +80,7 @@ public void uncheckedExceptionInTestMethodIsRegistered() throws NoSuchMethodExce
@Test @Test
public void checkedExceptionInTestMethodIsRegistered() throws NoSuchMethodException { public void checkedExceptionInTestMethodIsRegistered() throws NoSuchMethodException {
Method method = FailureTestCase.class.getDeclaredMethod("testWithCheckedException"); Method method = FailureTestCase.class.getDeclaredMethod("testWithCheckedException");
LauncherDiscoveryRequest request = request().selectors(selectMethod(FailureTestCase.class, method)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaMethod(FailureTestCase.class, method)).build();


ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


Expand All @@ -95,7 +95,7 @@ public void checkedExceptionInTestMethodIsRegistered() throws NoSuchMethodExcept
@Test @Test
public void checkedExceptionInBeforeEachIsRegistered() throws NoSuchMethodException { public void checkedExceptionInBeforeEachIsRegistered() throws NoSuchMethodException {
Method method = FailureTestCase.class.getDeclaredMethod("succeedingTest"); Method method = FailureTestCase.class.getDeclaredMethod("succeedingTest");
LauncherDiscoveryRequest request = request().selectors(selectMethod(FailureTestCase.class, method)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaMethod(FailureTestCase.class, method)).build();


FailureTestCase.exceptionToThrowInBeforeEach = Optional.of(new IOException("checked")); FailureTestCase.exceptionToThrowInBeforeEach = Optional.of(new IOException("checked"));


Expand All @@ -111,7 +111,7 @@ public void checkedExceptionInBeforeEachIsRegistered() throws NoSuchMethodExcept
@Test @Test
public void checkedExceptionInAfterEachIsRegistered() throws NoSuchMethodException { public void checkedExceptionInAfterEachIsRegistered() throws NoSuchMethodException {
Method method = FailureTestCase.class.getDeclaredMethod("succeedingTest"); Method method = FailureTestCase.class.getDeclaredMethod("succeedingTest");
LauncherDiscoveryRequest request = request().selectors(selectMethod(FailureTestCase.class, method)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaMethod(FailureTestCase.class, method)).build();


FailureTestCase.exceptionToThrowInAfterEach = Optional.of(new IOException("checked")); FailureTestCase.exceptionToThrowInAfterEach = Optional.of(new IOException("checked"));


Expand All @@ -127,7 +127,7 @@ public void checkedExceptionInAfterEachIsRegistered() throws NoSuchMethodExcepti
@Test @Test
public void checkedExceptionInAfterEachIsSuppressedByExceptionInTest() throws NoSuchMethodException { public void checkedExceptionInAfterEachIsSuppressedByExceptionInTest() throws NoSuchMethodException {
Method method = FailureTestCase.class.getDeclaredMethod("testWithUncheckedException"); Method method = FailureTestCase.class.getDeclaredMethod("testWithUncheckedException");
LauncherDiscoveryRequest request = request().selectors(selectMethod(FailureTestCase.class, method)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaMethod(FailureTestCase.class, method)).build();


FailureTestCase.exceptionToThrowInAfterEach = Optional.of(new IOException("checked")); FailureTestCase.exceptionToThrowInAfterEach = Optional.of(new IOException("checked"));


Expand All @@ -149,7 +149,7 @@ public void checkedExceptionInAfterEachIsSuppressedByExceptionInTest() throws No
@Test @Test
public void checkedExceptionInBeforeAllIsRegistered() throws NoSuchMethodException { public void checkedExceptionInBeforeAllIsRegistered() throws NoSuchMethodException {
Method method = FailureTestCase.class.getDeclaredMethod("succeedingTest"); Method method = FailureTestCase.class.getDeclaredMethod("succeedingTest");
LauncherDiscoveryRequest request = request().selectors(selectMethod(FailureTestCase.class, method)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaMethod(FailureTestCase.class, method)).build();


FailureTestCase.exceptionToThrowInBeforeAll = Optional.of(new IOException("checked")); FailureTestCase.exceptionToThrowInBeforeAll = Optional.of(new IOException("checked"));


Expand All @@ -166,7 +166,7 @@ public void checkedExceptionInBeforeAllIsRegistered() throws NoSuchMethodExcepti
@Test @Test
public void checkedExceptionInAfterAllIsRegistered() throws NoSuchMethodException { public void checkedExceptionInAfterAllIsRegistered() throws NoSuchMethodException {
Method method = FailureTestCase.class.getDeclaredMethod("succeedingTest"); Method method = FailureTestCase.class.getDeclaredMethod("succeedingTest");
LauncherDiscoveryRequest request = request().selectors(selectMethod(FailureTestCase.class, method)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaMethod(FailureTestCase.class, method)).build();


FailureTestCase.exceptionToThrowInAfterAll = Optional.of(new IOException("checked")); FailureTestCase.exceptionToThrowInAfterAll = Optional.of(new IOException("checked"));


Expand Down
Expand Up @@ -12,7 +12,7 @@


import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaClass;
import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request;


import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
Expand All @@ -34,7 +34,7 @@ public class NestedTestClassesTests extends AbstractJupiterTestEngineTests {


@Test @Test
public void nestedTestsAreCorrectlyDiscovered() { public void nestedTestsAreCorrectlyDiscovered() {
LauncherDiscoveryRequest request = request().selectors(selectClass(TestCaseWithNesting.class)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaClass(TestCaseWithNesting.class)).build();
TestDescriptor engineDescriptor = discoverTests(request); TestDescriptor engineDescriptor = discoverTests(request);
assertEquals(5, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors"); assertEquals(5, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors");
} }
Expand All @@ -53,7 +53,8 @@ public void nestedTestsAreExecuted() {


@Test @Test
public void doublyNestedTestsAreCorrectlyDiscovered() { public void doublyNestedTestsAreCorrectlyDiscovered() {
LauncherDiscoveryRequest request = request().selectors(selectClass(TestCaseWithDoubleNesting.class)).build(); LauncherDiscoveryRequest request = request().selectors(
selectJavaClass(TestCaseWithDoubleNesting.class)).build();
TestDescriptor engineDescriptor = discoverTests(request); TestDescriptor engineDescriptor = discoverTests(request);
assertEquals(8, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors"); assertEquals(8, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors");
} }
Expand Down
Expand Up @@ -13,8 +13,8 @@
import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaClass;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectMethod; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaMethod;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId;
import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request;


Expand All @@ -37,7 +37,7 @@ public class OverloadedTestMethodTests extends AbstractJupiterTestEngineTests {


@Test @Test
void executeTestCaseWithOverloadedMethodsAndThenRerunOnlyOneOfTheMethodsSelectedByUniqueId() { void executeTestCaseWithOverloadedMethodsAndThenRerunOnlyOneOfTheMethodsSelectedByUniqueId() {
LauncherDiscoveryRequest request = request().selectors(selectClass(TestCase.class)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaClass(TestCase.class)).build();
ExecutionEventRecorder eventRecorder1 = executeTests(request); ExecutionEventRecorder eventRecorder1 = executeTests(request);


// @formatter:off // @formatter:off
Expand Down Expand Up @@ -71,7 +71,7 @@ void executeTestCaseWithOverloadedMethodsAndThenRerunOnlyOneOfTheMethodsSelected
@Test @Test
void executeTestCaseWithOverloadedMethodsWithSingleMethodThatAcceptsArgumentsSelectedByFullyQualifedMethodName() { void executeTestCaseWithOverloadedMethodsWithSingleMethodThatAcceptsArgumentsSelectedByFullyQualifedMethodName() {
String fqmn = TestCase.class.getName() + "#test(" + TestInfo.class.getName() + ")"; String fqmn = TestCase.class.getName() + "#test(" + TestInfo.class.getName() + ")";
LauncherDiscoveryRequest request = request().selectors(selectMethod(fqmn)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaMethod(fqmn)).build();
ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


// @formatter:off // @formatter:off
Expand Down
Expand Up @@ -12,7 +12,7 @@


import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaClass;
import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request;


import java.util.HashMap; import java.util.HashMap;
Expand All @@ -32,7 +32,7 @@ public class ReportingTests extends AbstractJupiterTestEngineTests {


@Test @Test
void threeReportEntriesArePublished() { void threeReportEntriesArePublished() {
LauncherDiscoveryRequest request = request().selectors(selectClass(MyReportingTestCase.class)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaClass(MyReportingTestCase.class)).build();


ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


Expand Down
Expand Up @@ -13,7 +13,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectJavaClass;
import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request;


import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
Expand All @@ -40,22 +40,22 @@ public void init() {


@Test @Test
public void standardTestClassIsCorrectlyDiscovered() { public void standardTestClassIsCorrectlyDiscovered() {
LauncherDiscoveryRequest request = request().selectors(selectClass(MyStandardTestCase.class)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaClass(MyStandardTestCase.class)).build();
TestDescriptor engineDescriptor = discoverTests(request); TestDescriptor engineDescriptor = discoverTests(request);
assertEquals(5, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors"); assertEquals(5, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors");
} }


@Test @Test
public void moreThanOneTestClassIsCorrectlyDiscovered() { public void moreThanOneTestClassIsCorrectlyDiscovered() {
LauncherDiscoveryRequest request = request().selectors(selectClass(SecondOfTwoTestCases.class)).build(); LauncherDiscoveryRequest request = request().selectors(selectJavaClass(SecondOfTwoTestCases.class)).build();
TestDescriptor engineDescriptor = discoverTests(request); TestDescriptor engineDescriptor = discoverTests(request);
assertEquals(2 + 2, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors"); assertEquals(2 + 2, engineDescriptor.getAllDescendants().size(), "# resolved test descriptors");
} }


@Test @Test
public void moreThanOneTestClassIsExecuted() { public void moreThanOneTestClassIsExecuted() {
LauncherDiscoveryRequest request = request().selectors(selectClass(FirstOfTwoTestCases.class), LauncherDiscoveryRequest request = request().selectors(selectJavaClass(FirstOfTwoTestCases.class),
selectClass(SecondOfTwoTestCases.class)).build(); selectJavaClass(SecondOfTwoTestCases.class)).build();


ExecutionEventRecorder eventRecorder = executeTests(request); ExecutionEventRecorder eventRecorder = executeTests(request);


Expand Down

0 comments on commit d34ac46

Please sign in to comment.