use of org.junit.jupiter.engine.TrackLogRecords in project junit5 by junit-team.
the class TestClassWithTemplate method resolvingDynamicTestByUniqueIdResolvesUpToParentTestFactory.
@Test
@TrackLogRecords
void resolvingDynamicTestByUniqueIdResolvesUpToParentTestFactory(LogRecordListener listener) {
Class<?> clazz = MyTestClass.class;
UniqueId factoryUid = uniqueIdForTestFactoryMethod(clazz, "dynamicTest()");
UniqueId dynamicTestUid = factoryUid.append(DYNAMIC_TEST_SEGMENT_TYPE, "#1");
UniqueId differentDynamicTestUid = factoryUid.append(DYNAMIC_TEST_SEGMENT_TYPE, "#2");
resolver.resolveSelectors(request().selectors(selectUniqueId(dynamicTestUid)).build(), engineDescriptor);
assertThat(engineDescriptor.getDescendants()).hasSize(2);
assertThat(uniqueIds()).containsSequence(uniqueIdForClass(clazz), factoryUid);
TestDescriptor testClassDescriptor = getOnlyElement(engineDescriptor.getChildren());
TestDescriptor testFactoryDescriptor = getOnlyElement(testClassDescriptor.getChildren());
DynamicDescendantFilter dynamicDescendantFilter = getDynamicDescendantFilter(testFactoryDescriptor);
assertThat(dynamicDescendantFilter.test(dynamicTestUid)).isTrue();
assertThat(dynamicDescendantFilter.test(differentDynamicTestUid)).isFalse();
assertThat(listener.stream(JavaElementsResolver.class)).isEmpty();
}
use of org.junit.jupiter.engine.TrackLogRecords in project junit5 by junit-team.
the class TestClassWithTemplate method resolvingDynamicContainerByUniqueIdResolvesUpToParentTestFactory.
@Test
@TrackLogRecords
void resolvingDynamicContainerByUniqueIdResolvesUpToParentTestFactory(LogRecordListener listener) {
Class<?> clazz = MyTestClass.class;
UniqueId factoryUid = uniqueIdForTestFactoryMethod(clazz, "dynamicTest()");
UniqueId dynamicContainerUid = factoryUid.append(DYNAMIC_CONTAINER_SEGMENT_TYPE, "#1");
UniqueId differentDynamicContainerUid = factoryUid.append(DYNAMIC_CONTAINER_SEGMENT_TYPE, "#2");
UniqueId dynamicTestUid = dynamicContainerUid.append(DYNAMIC_TEST_SEGMENT_TYPE, "#1");
UniqueId differentDynamicTestUid = dynamicContainerUid.append(DYNAMIC_TEST_SEGMENT_TYPE, "#2");
resolver.resolveSelectors(request().selectors(selectUniqueId(dynamicTestUid)).build(), engineDescriptor);
assertThat(engineDescriptor.getDescendants()).hasSize(2);
assertThat(uniqueIds()).containsSequence(uniqueIdForClass(clazz), factoryUid);
TestDescriptor testClassDescriptor = getOnlyElement(engineDescriptor.getChildren());
TestDescriptor testFactoryDescriptor = getOnlyElement(testClassDescriptor.getChildren());
DynamicDescendantFilter dynamicDescendantFilter = getDynamicDescendantFilter(testFactoryDescriptor);
assertThat(dynamicDescendantFilter.test(dynamicTestUid)).isTrue();
assertThat(dynamicDescendantFilter.test(differentDynamicContainerUid)).isFalse();
assertThat(dynamicDescendantFilter.test(differentDynamicTestUid)).isFalse();
assertThat(listener.stream(JavaElementsResolver.class)).isEmpty();
}
Aggregations