Search in sources :

Example 6 with ClassSelector

use of org.junit.platform.engine.discovery.ClassSelector in project junit5 by junit-team.

the class TestClassWithTemplate method doubleNestedTestResolutionFromClass.

@Test
void doubleNestedTestResolutionFromClass() {
    ClassSelector selector = selectClass(TestCaseWithNesting.NestedTestCase.DoubleNestedTestCase.class);
    resolver.resolveSelectors(request().selectors(selector).build(), engineDescriptor);
    List<UniqueId> uniqueIds = uniqueIds();
    assertEquals(4, uniqueIds.size());
    assertThat(uniqueIds).contains(uniqueIdForClass(TestCaseWithNesting.class));
    assertThat(uniqueIds).contains(uniqueIdForClass(TestCaseWithNesting.NestedTestCase.class));
    assertThat(uniqueIds).contains(uniqueIdForClass(TestCaseWithNesting.NestedTestCase.DoubleNestedTestCase.class));
    assertThat(uniqueIds).contains(uniqueIdForMethod(TestCaseWithNesting.NestedTestCase.DoubleNestedTestCase.class, "testC()"));
}
Also used : DiscoverySelectors.selectUniqueId(org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId) UniqueId(org.junit.platform.engine.UniqueId) ClassSelector(org.junit.platform.engine.discovery.ClassSelector) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 7 with ClassSelector

use of org.junit.platform.engine.discovery.ClassSelector in project junit5 by junit-team.

the class TestClassWithTemplate method nestedTestResolutionFromBaseClass.

@Test
void nestedTestResolutionFromBaseClass() {
    ClassSelector selector = selectClass(TestCaseWithNesting.class);
    resolver.resolveSelectors(request().selectors(selector).build(), engineDescriptor);
    List<UniqueId> uniqueIds = uniqueIds();
    assertEquals(6, uniqueIds.size());
    assertThat(uniqueIds).contains(uniqueIdForClass(TestCaseWithNesting.class));
    assertThat(uniqueIds).contains(uniqueIdForMethod(TestCaseWithNesting.class, "testA()"));
    assertThat(uniqueIds).contains(uniqueIdForClass(TestCaseWithNesting.NestedTestCase.class));
    assertThat(uniqueIds).contains(uniqueIdForMethod(TestCaseWithNesting.NestedTestCase.class, "testB()"));
    assertThat(uniqueIds).contains(uniqueIdForClass(TestCaseWithNesting.NestedTestCase.DoubleNestedTestCase.class));
    assertThat(uniqueIds).contains(uniqueIdForMethod(TestCaseWithNesting.NestedTestCase.DoubleNestedTestCase.class, "testC()"));
}
Also used : DiscoverySelectors.selectUniqueId(org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId) UniqueId(org.junit.platform.engine.UniqueId) ClassSelector(org.junit.platform.engine.discovery.ClassSelector) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 8 with ClassSelector

use of org.junit.platform.engine.discovery.ClassSelector in project junit5 by junit-team.

the class TestClassWithTemplate method nestedTestResolutionFromNestedTestClass.

@Test
void nestedTestResolutionFromNestedTestClass() {
    ClassSelector selector = selectClass(TestCaseWithNesting.NestedTestCase.class);
    resolver.resolveSelectors(request().selectors(selector).build(), engineDescriptor);
    List<UniqueId> uniqueIds = uniqueIds();
    assertEquals(5, uniqueIds.size());
    assertThat(uniqueIds).contains(uniqueIdForClass(TestCaseWithNesting.class));
    assertThat(uniqueIds).contains(uniqueIdForClass(TestCaseWithNesting.NestedTestCase.class));
    assertThat(uniqueIds).contains(uniqueIdForMethod(TestCaseWithNesting.NestedTestCase.class, "testB()"));
    assertThat(uniqueIds).contains(uniqueIdForClass(TestCaseWithNesting.NestedTestCase.DoubleNestedTestCase.class));
    assertThat(uniqueIds).contains(uniqueIdForMethod(TestCaseWithNesting.NestedTestCase.DoubleNestedTestCase.class, "testC()"));
}
Also used : DiscoverySelectors.selectUniqueId(org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId) UniqueId(org.junit.platform.engine.UniqueId) ClassSelector(org.junit.platform.engine.discovery.ClassSelector) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Aggregations

ClassSelector (org.junit.platform.engine.discovery.ClassSelector)8 Test (org.junit.jupiter.api.Test)7 DynamicTest (org.junit.jupiter.api.DynamicTest)6 UniqueId (org.junit.platform.engine.UniqueId)6 DiscoverySelectors.selectUniqueId (org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId)6 LauncherDiscoveryRequest (org.junit.platform.launcher.LauncherDiscoveryRequest)2 Launcher (org.junit.platform.launcher.Launcher)1 LoggingListener (org.junit.platform.launcher.listeners.LoggingListener)1