Search in sources :

Example 46 with TestExecutionResult

use of org.junit.platform.engine.TestExecutionResult in project mockito by mockito.

the class StrictnessTest method session_does_not_check_for_strict_stubs_on_test_failure.

@Test
void session_does_not_check_for_strict_stubs_on_test_failure() {
    TestExecutionResult result = invokeTestClassAndRetrieveMethodResult(StrictStubsNotReportedOnTestFailure.class);
    assertThat(result.getStatus()).isEqualTo(TestExecutionResult.Status.FAILED);
    Throwable throwable = result.getThrowable().get();
    assertThat(throwable).isInstanceOf(MyAssertionError.class);
    assertThat(throwable.getSuppressed()).isEmpty();
}
Also used : TestExecutionResult(org.junit.platform.engine.TestExecutionResult) Test(org.junit.jupiter.api.Test)

Example 47 with TestExecutionResult

use of org.junit.platform.engine.TestExecutionResult in project mockito by mockito.

the class StrictnessTest method inherits_strictness_from_base_class.

@Test
void inherits_strictness_from_base_class() {
    TestExecutionResult result = invokeTestClassAndRetrieveMethodResult(InheritedWarnStubs.class);
    assertThat(result.getStatus()).isEqualTo(TestExecutionResult.Status.SUCCESSFUL);
}
Also used : TestExecutionResult(org.junit.platform.engine.TestExecutionResult) Test(org.junit.jupiter.api.Test)

Example 48 with TestExecutionResult

use of org.junit.platform.engine.TestExecutionResult in project neo4j by neo4j.

the class ProfilerExtensionTest method profilingExtensionMustNotBreakOnUninitialisedTestDirectory.

@Test
void profilingExtensionMustNotBreakOnUninitialisedTestDirectory() {
    // Because this test *aborts* rather than fails or completes normally, we will be in a state where we both have an
    // execution exception *and* the TestDirectoryExtension cleans up after itself as if the test was a success.
    // In this case, the profiler extension will see an uninitialised TestDirectoryExtension, and must be able to cope
    // with that. Furthermore, these particular tests are arranged such that the TestDirectoryExtension has its
    // lifecycle nested within the ProfilerExtension, which means that the test directory will do its cleanup
    // before the profiler extension gets to write its results.
    CONTEXT.clear();
    execute(ProfiledTemplateVerification.class, "testThatFailsBeforeInitialisingTestDirectory", new TestExecutionListener() {

        @Override
        public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
            // Notably, we should not see any FAILED results.
            assertThat(testExecutionResult.getStatus()).isIn(SUCCESSFUL, ABORTED);
        }
    });
}
Also used : TestExecutionListener(org.junit.platform.launcher.TestExecutionListener) TestIdentifier(org.junit.platform.launcher.TestIdentifier) TestExecutionResult(org.junit.platform.engine.TestExecutionResult) Test(org.junit.jupiter.api.Test)

Aggregations

TestExecutionResult (org.junit.platform.engine.TestExecutionResult)48 Test (org.junit.jupiter.api.Test)41 TestIdentifier (org.junit.platform.launcher.TestIdentifier)15 InOrder (org.mockito.InOrder)15 TestPlan (org.junit.platform.launcher.TestPlan)14 LauncherDiscoveryRequestBuilder (org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder)11 Categories (org.junit.vintage.engine.samples.junit4.Categories)10 TestExecutionListener (org.junit.platform.launcher.TestExecutionListener)6 EnclosedJUnit4TestCase (org.junit.vintage.engine.samples.junit4.EnclosedJUnit4TestCase)6 PlainJUnit4TestCaseWithFiveTestMethods (org.junit.vintage.engine.samples.junit4.PlainJUnit4TestCaseWithFiveTestMethods)6 Launcher (org.junit.platform.launcher.Launcher)5 LauncherDiscoveryRequest (org.junit.platform.launcher.LauncherDiscoveryRequest)5 LinkedHashMap (java.util.LinkedHashMap)4 JUnit4SuiteWithTwoTestCases (org.junit.vintage.engine.samples.junit4.JUnit4SuiteWithTwoTestCases)4 JUnit4TestCaseWithNotFilterableRunner (org.junit.vintage.engine.samples.junit4.JUnit4TestCaseWithNotFilterableRunner)4 Map (java.util.Map)3 Level (java.util.logging.Level)3 LogRecord (java.util.logging.LogRecord)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 TrackLogRecords (org.junit.jupiter.engine.TrackLogRecords)3