Search in sources :

Example 1 with EagerTestExecutionListener

use of org.junit.platform.launcher.core.CompositeTestExecutionListener.EagerTestExecutionListener in project junit5 by junit-team.

the class CompositeTestExecutionListenerTests method shouldThrowOutOfMemoryExceptionAndStopEagerListenerWithoutLog.

@Test
void shouldThrowOutOfMemoryExceptionAndStopEagerListenerWithoutLog(LogRecordListener logRecordListener) {
    listeners.add(new EagerTestExecutionListener() {

        @Override
        public void executionJustStarted(TestIdentifier testIdentifier) {
            throw new OutOfMemoryError();
        }
    });
    var testIdentifier = getSampleMethodTestIdentifier();
    assertThatThrownBy(() -> compositeTestExecutionListener().executionStarted(testIdentifier)).isInstanceOf(OutOfMemoryError.class);
    assertNotLogs(logRecordListener);
}
Also used : EagerTestExecutionListener(org.junit.platform.launcher.core.CompositeTestExecutionListener.EagerTestExecutionListener) TestIdentifier(org.junit.platform.launcher.TestIdentifier) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 TestIdentifier (org.junit.platform.launcher.TestIdentifier)1 EagerTestExecutionListener (org.junit.platform.launcher.core.CompositeTestExecutionListener.EagerTestExecutionListener)1