use of org.junit.jupiter.engine.TrackLogRecords in project junit5 by junit-team.
the class TestClassWithTemplate method resolvingUniqueIdWithWrongParamsResolvesNothing.
@Test
@TrackLogRecords
void resolvingUniqueIdWithWrongParamsResolvesNothing(LogRecordListener listener) {
UniqueId uniqueId = uniqueIdForMethod(HerTestClass.class, "test7(java.math.BigDecimal)");
EngineDiscoveryRequest request = request().selectors(selectUniqueId(uniqueId)).build();
resolver.resolveSelectors(request, engineDescriptor);
assertTrue(engineDescriptor.getDescendants().isEmpty());
//
assertThat(listener.stream(JavaElementsResolver.class, Level.WARNING).map(LogRecord::getMessage)).contains("Unique ID '" + uniqueId + "' could only be partially resolved. " + "All resolved segments will be executed; however, the following segments " + "could not be resolved: [Segment [type = 'method', value = 'test7(java.math.BigDecimal)']]");
}
use of org.junit.jupiter.engine.TrackLogRecords in project junit5 by junit-team.
the class TestClassWithTemplate method resolvingUniqueIdWithUnknownSegmentTypeResolvesNothing.
@Test
@TrackLogRecords
void resolvingUniqueIdWithUnknownSegmentTypeResolvesNothing(LogRecordListener listener) {
UniqueId uniqueId = engineId().append("bogus", "enigma");
UniqueIdSelector selector = selectUniqueId(uniqueId);
EngineDiscoveryRequest request = request().selectors(selector).build();
resolver.resolveSelectors(request, engineDescriptor);
assertTrue(engineDescriptor.getDescendants().isEmpty());
//
assertThat(listener.stream(JavaElementsResolver.class, Level.WARNING).map(LogRecord::getMessage)).contains("Unique ID '" + uniqueId + "' could not be resolved.");
}
use of org.junit.jupiter.engine.TrackLogRecords in project junit5 by junit-team.
the class VintageLauncherIntegrationTests method executesAllTestsForNotFilterableChildRunnerOfSuite.
@TrackLogRecords
@Test
void executesAllTestsForNotFilterableChildRunnerOfSuite(LogRecordListener logRecordListener) {
Class<?> suiteClass = JUnit4SuiteOfSuiteWithFilterableChildRunner.class;
Class<?> testClass = JUnit4TestCaseWithNotFilterableRunner.class;
LauncherDiscoveryRequestBuilder request = //
request().selectors(//
selectClass(suiteClass)).filters((PostDiscoveryFilter) descriptor -> includedIf(descriptor.getDisplayName().contains("#1")));
TestPlan testPlan = discover(request);
logRecordListener.clear();
assertThat(testPlan.getDescendants(getOnlyElement(testPlan.getRoots()))).hasSize(4);
Map<TestIdentifier, TestExecutionResult> results = execute(request);
//
assertThat(results.keySet().stream().map(TestIdentifier::getDisplayName)).containsExactlyInAnyOrder("JUnit Vintage", suiteClass.getName(), testClass.getName(), "Test #0", "Test #1");
//
assertThat(logRecordListener.stream(RunnerTestDescriptor.class, Level.WARNING).map(LogRecord::getMessage)).containsExactly(//
"Runner " + Suite.class.getName() + " (used on class " + suiteClass.getName() + ")" + " was not able to satisfy all filter requests.");
}
use of org.junit.jupiter.engine.TrackLogRecords in project junit5 by junit-team.
the class VintageLauncherIntegrationTests method executesAllTestsForNotFilterableRunner.
@TrackLogRecords
@Test
void executesAllTestsForNotFilterableRunner(LogRecordListener logRecordListener) {
Class<?> testClass = JUnit4TestCaseWithNotFilterableRunner.class;
LauncherDiscoveryRequestBuilder request = //
request().selectors(//
selectClass(testClass)).filters((PostDiscoveryFilter) descriptor -> includedIf(descriptor.getDisplayName().contains("#1")));
TestPlan testPlan = discover(request);
logRecordListener.clear();
assertThat(testPlan.getDescendants(getOnlyElement(testPlan.getRoots()))).hasSize(3);
Map<TestIdentifier, TestExecutionResult> results = execute(request);
//
assertThat(results.keySet().stream().map(TestIdentifier::getDisplayName)).containsExactlyInAnyOrder("JUnit Vintage", testClass.getName(), "Test #0", "Test #1");
//
assertThat(logRecordListener.stream(RunnerTestDescriptor.class, Level.WARNING).map(LogRecord::getMessage)).containsExactly(//
"Runner " + NotFilterableRunner.class.getName() + " (used on class " + testClass.getName() + ")" + " does not support filtering and will therefore be run completely.");
}
use of org.junit.jupiter.engine.TrackLogRecords 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