use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class ParameterResolverTests method executeTestsForMethodInjectionCases.
@Test
void executeTestsForMethodInjectionCases() {
EngineExecutionResults executionResults = executeTestsForClass(MethodInjectionTestCase.class);
assertEquals(7, executionResults.testEvents().started().count(), "# tests started");
assertEquals(6, executionResults.testEvents().succeeded().count(), "# tests succeeded");
assertEquals(0, executionResults.testEvents().skipped().count(), "# tests skipped");
assertEquals(0, executionResults.testEvents().aborted().count(), "# tests aborted");
assertEquals(1, executionResults.testEvents().failed().count(), "# tests failed");
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class ParameterResolverTests method executeTestsForNullValuedMethodInjectionCases.
@Test
void executeTestsForNullValuedMethodInjectionCases() {
EngineExecutionResults executionResults = executeTestsForClass(NullMethodInjectionTestCase.class);
Events tests = executionResults.testEvents();
assertEquals(2, executionResults.testEvents().started().count(), "# tests started");
assertEquals(1, executionResults.testEvents().succeeded().count(), "# tests succeeded");
assertEquals(1, executionResults.testEvents().failed().count(), "# tests failed");
// @formatter:off
Predicate<String> expectations = s -> s.contains("NullIntegerParameterResolver") && s.contains("resolved a null value for parameter") && s.contains("but a primitive of type [int] is required");
tests.failed().assertEventsMatchExactly(event(test("injectPrimitive"), finishedWithFailure(instanceOf(ParameterResolutionException.class), message(expectations))));
// @formatter:on
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class ParameterResolverTests method constructorInjection.
@Test
void constructorInjection() {
EngineExecutionResults executionResults = executeTestsForClass(ConstructorInjectionTestCase.class);
assertEquals(2, executionResults.testEvents().started().count(), "# tests started");
assertEquals(2, executionResults.testEvents().succeeded().count(), "# tests succeeded");
assertEquals(0, executionResults.testEvents().skipped().count(), "# tests skipped");
assertEquals(0, executionResults.testEvents().aborted().count(), "# tests aborted");
assertEquals(0, executionResults.testEvents().failed().count(), "# tests failed");
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class ParameterResolverTests method executeTestsForMethodWithExtendWithAnnotation.
@Test
void executeTestsForMethodWithExtendWithAnnotation() {
EngineExecutionResults executionResults = executeTestsForClass(ExtendWithOnMethodTestCase.class);
assertEquals(1, executionResults.testEvents().started().count(), "# tests started");
assertEquals(1, executionResults.testEvents().succeeded().count(), "# tests succeeded");
assertEquals(0, executionResults.testEvents().skipped().count(), "# tests skipped");
assertEquals(0, executionResults.testEvents().aborted().count(), "# tests aborted");
assertEquals(0, executionResults.testEvents().failed().count(), "# tests failed");
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class TestWatcherTests method testWatcherIsNotInvokedForTestFactoryMethods.
@Test
void testWatcherIsNotInvokedForTestFactoryMethods() {
EngineExecutionResults results = executeTestsForClass(TrackingTestWatcherTestFactoryMethodsTestCase.class);
results.containerEvents().assertStatistics(stats -> stats.skipped(1).started(5).succeeded(5).aborted(0).failed(0));
results.testEvents().assertStatistics(stats -> stats.dynamicallyRegistered(6).skipped(0).started(6).succeeded(2).aborted(2).failed(2));
// There should be zero results, since the TestWatcher API is not supported for @TestFactory containers.
assertThat(TrackingTestWatcher.results).isEmpty();
}
Aggregations