use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class ExecutionConditionTests method conditionWorksOnTest.
@Test
void conditionWorksOnTest() {
LauncherDiscoveryRequest request = request().selectors(selectClass(TestCaseWithExecutionConditionOnMethods.class)).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertEquals(2, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(2, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(3, eventRecorder.getTestSkippedCount(), "# tests skipped");
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class ExecutionConditionTests method conditionWorksOnContainer.
@Test
void conditionWorksOnContainer() {
LauncherDiscoveryRequest request = request().selectors(selectClass(TestCaseWithExecutionConditionOnClass.class)).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
assertEquals(1, eventRecorder.getContainerSkippedCount(), "# container skipped");
assertEquals(0, eventRecorder.getTestStartedCount(), "# tests started");
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class ParameterResolverTests method executeTestsForNullValuedMethodInjectionCases.
@Test
void executeTestsForNullValuedMethodInjectionCases() {
ExecutionEventRecorder eventRecorder = executeTestsForClass(NullMethodInjectionTestCase.class);
assertEquals(2, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(1, eventRecorder.getTestFailedCount(), "# 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");
assertRecordedExecutionEventsContainsExactly(eventRecorder.getFailedTestFinishedEvents(), event(test("injectPrimitive"), finishedWithFailure(allOf(isA(ParameterResolutionException.class), message(expectations)))));
// @formatter:on
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class ParameterResolverTests method executeTestsForMethodWithExtendWithAnnotation.
@Test
void executeTestsForMethodWithExtendWithAnnotation() {
ExecutionEventRecorder eventRecorder = executeTestsForClass(ExtendWithOnMethodTestCase.class);
assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(0, eventRecorder.getTestSkippedCount(), "# tests skipped");
assertEquals(0, eventRecorder.getTestAbortedCount(), "# tests aborted");
assertEquals(0, eventRecorder.getTestFailedCount(), "# tests failed");
}
use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.
the class ParameterResolverTests method constructorInjection.
@Test
void constructorInjection() {
ExecutionEventRecorder eventRecorder = executeTestsForClass(ConstructorInjectionTestCase.class);
assertEquals(2, eventRecorder.getTestStartedCount(), "# tests started");
assertEquals(2, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
assertEquals(0, eventRecorder.getTestSkippedCount(), "# tests skipped");
assertEquals(0, eventRecorder.getTestAbortedCount(), "# tests aborted");
assertEquals(0, eventRecorder.getTestFailedCount(), "# tests failed");
}
Aggregations