use of org.junit.platform.engine.discovery.UniqueIdSelector in project junit5 by junit-team.
the class TestClassWithTemplate method staticNestedClassResolutionByUniqueId.
@Test
void staticNestedClassResolutionByUniqueId() {
UniqueIdSelector selector = selectUniqueId(uniqueIdForClass(OtherTestClass.NestedTestClass.class).toString());
resolver.resolveSelectors(request().selectors(selector).build(), engineDescriptor);
assertEquals(3, engineDescriptor.getDescendants().size());
List<UniqueId> uniqueIds = uniqueIds();
assertThat(uniqueIds).contains(uniqueIdForClass(OtherTestClass.NestedTestClass.class));
assertThat(uniqueIds).contains(uniqueIdForMethod(OtherTestClass.NestedTestClass.class, "test5()"));
assertThat(uniqueIds).contains(uniqueIdForMethod(OtherTestClass.NestedTestClass.class, "test6()"));
}
use of org.junit.platform.engine.discovery.UniqueIdSelector in project junit5 by junit-team.
the class TestClassWithTemplate method resolvingUniqueIdOfNonTestMethodResolvesNothing.
@Test
void resolvingUniqueIdOfNonTestMethodResolvesNothing() {
UniqueIdSelector selector = selectUniqueId(uniqueIdForMethod(MyTestClass.class, "notATest()"));
EngineDiscoveryRequest request = request().selectors(selector).build();
resolver.resolveSelectors(request, engineDescriptor);
assertTrue(engineDescriptor.getDescendants().isEmpty());
}
use of org.junit.platform.engine.discovery.UniqueIdSelector in project junit5 by junit-team.
the class TestClassWithTemplate method methodResolutionByUniqueIdWithMissingParameters.
@Test
void methodResolutionByUniqueIdWithMissingParameters() {
UniqueIdSelector selector = selectUniqueId(uniqueIdForMethod(getClass(), "methodName"));
assertMethodDoesNotMatchPattern(selector);
}
use of org.junit.platform.engine.discovery.UniqueIdSelector in project junit5 by junit-team.
the class TestClassWithTemplate method nestedTestResolutionFromUniqueId.
@Test
void nestedTestResolutionFromUniqueId() {
UniqueIdSelector selector = selectUniqueId(uniqueIdForClass(TestCaseWithNesting.NestedTestCase.DoubleNestedTestCase.class).toString());
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()"));
}
use of org.junit.platform.engine.discovery.UniqueIdSelector in project junit5 by junit-team.
the class TestClassWithTemplate method methodResolutionByUniqueIdWithParams.
@Test
@TrackLogRecords
void methodResolutionByUniqueIdWithParams(LogRecordListener listener) {
UniqueIdSelector selector = selectUniqueId(uniqueIdForMethod(HerTestClass.class, "test7(java.lang.String)").toString());
resolver.resolveSelectors(request().selectors(selector).build(), engineDescriptor);
assertEquals(2, engineDescriptor.getDescendants().size());
List<UniqueId> uniqueIds = uniqueIds();
assertThat(uniqueIds).contains(uniqueIdForClass(HerTestClass.class));
assertThat(uniqueIds).contains(uniqueIdForMethod(HerTestClass.class, "test7(java.lang.String)"));
assertThat(listener.stream(JavaElementsResolver.class)).isEmpty();
}
Aggregations