use of org.junit.platform.engine.UniqueId in project junit5 by junit-team.
the class TestClassWithTemplate method classResolutionOfStaticNestedClass.
@Test
void classResolutionOfStaticNestedClass() {
ClassSelector selector = selectClass(OtherTestClass.NestedTestClass.class);
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.UniqueId 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.UniqueId in project junit5 by junit-team.
the class DynamicNodeGenerationTests method singleDynamicTestIsExecutedWhenDiscoveredByUniqueId.
@Test
void singleDynamicTestIsExecutedWhenDiscoveredByUniqueId() {
UniqueId uniqueId = //
discoverUniqueId(MyDynamicTestCase.class, "dynamicStream").append(DYNAMIC_TEST_SEGMENT_TYPE, "#2");
ExecutionEventRecorder eventRecorder = executeTests(selectUniqueId(uniqueId));
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), //
event(engine(), started()), //
event(container(MyDynamicTestCase.class), started()), //
event(container("dynamicStream"), started()), //
event(dynamicTestRegistered("dynamic-test:#2")), //
event(test("dynamic-test:#2", "failingTest"), started()), //
event(test("dynamic-test:#2", "failingTest"), finishedWithFailure(message("failing"))), //
event(container("dynamicStream"), finishedSuccessfully()), //
event(container(MyDynamicTestCase.class), finishedSuccessfully()), event(engine(), finishedSuccessfully()));
}
use of org.junit.platform.engine.UniqueId in project junit5 by junit-team.
the class DynamicNodeGenerationTests method singleDynamicTestInNestedDynamicContainerIsExecutedWhenDiscoveredByUniqueId.
@Test
void singleDynamicTestInNestedDynamicContainerIsExecutedWhenDiscoveredByUniqueId() {
UniqueId uniqueId = //
discoverUniqueId(MyDynamicTestCase.class, "twoNestedContainersWithTwoTestsEach").append(DYNAMIC_CONTAINER_SEGMENT_TYPE, //
"#1").append(DYNAMIC_CONTAINER_SEGMENT_TYPE, //
"#1").append(DYNAMIC_TEST_SEGMENT_TYPE, "#2");
ExecutionEventRecorder eventRecorder = executeTests(selectUniqueId(uniqueId));
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), //
event(engine(), started()), //
event(container(MyDynamicTestCase.class), started()), //
event(container("twoNestedContainersWithTwoTestsEach"), started()), //
event(dynamicTestRegistered(displayName("a"))), //
event(container(displayName("a")), started()), //
event(dynamicTestRegistered(displayName("a1"))), //
event(container(displayName("a1")), started()), //
event(dynamicTestRegistered("dynamic-test:#2")), //
event(test("dynamic-test:#2", "failingTest"), started()), //
event(test("dynamic-test:#2", "failingTest"), finishedWithFailure(message("failing"))), //
event(container(displayName("a1")), finishedSuccessfully()), //
event(container(displayName("a")), finishedSuccessfully()), //
event(container("twoNestedContainersWithTwoTestsEach"), finishedSuccessfully()), //
event(container(MyDynamicTestCase.class), finishedSuccessfully()), event(engine(), finishedSuccessfully()));
}
use of org.junit.platform.engine.UniqueId in project junit5 by junit-team.
the class TestTemplateInvocationTests method singleInvocationIsExecutedWhenDiscoveredByUniqueId.
@Test
void singleInvocationIsExecutedWhenDiscoveredByUniqueId() {
UniqueId uniqueId = discoverUniqueId(MyTestTemplateTestCase.class, //
"templateWithTwoInvocationsFromSingleExtension").append(TestTemplateInvocationTestDescriptor.SEGMENT_TYPE, "#2");
ExecutionEventRecorder eventRecorder = executeTests(selectUniqueId(uniqueId));
assertRecordedExecutionEventsContainsExactly(//
eventRecorder.getExecutionEvents(), wrappedInContainerEvents(//
MyTestTemplateTestCase.class, //
event(container("templateWithTwoInvocationsFromSingleExtension"), started()), //
event(dynamicTestRegistered("test-template-invocation:#2"), displayName("[2]")), //
event(test("test-template-invocation:#2"), started()), event(test("test-template-invocation:#2"), //
finishedWithFailure(message("invocation is expected to fail"))), event(container("templateWithTwoInvocationsFromSingleExtension"), finishedSuccessfully())));
}
Aggregations