org.junit.jupiter.api.extension.Extension
, org.junit.jupiter.api.extension.TestExecutionExceptionHandler
@AutoService(org.junit.jupiter.api.extension.Extension.class)
public final class ErrorDecorator
extends java.lang.Object
implements org.junit.jupiter.api.extension.TestExecutionExceptionHandler
Example output:
decorated org.junit.ComparisonFailure: expected:<H[ello]!> but was:<H[i]!> at org.junit.Assert.assertEquals(Assert.java:115) at example.HelloTest.hello(HelloTest.java:16) 14 @Test 15 public void hello() { -> 16 assertEquals("Hello!", greet()); 17 } ...
Usage:
@ExtendWith(ErrorDecorator.class) class BaseTest {} class MyTest extends BaseTest { @Test void myTest() { // ... } }
Alternatively, run your tests with
-Djunit.jupiter.extensions.autodetection.enabled=true
instead of using annotations.
Constructor | Description |
---|---|
ErrorDecorator() |
Modifier and Type | Method | Description |
---|---|---|
void |
handleTestExecutionException(org.junit.jupiter.api.extension.ExtensionContext context,
java.lang.Throwable e) |
public void handleTestExecutionException(org.junit.jupiter.api.extension.ExtensionContext context, java.lang.Throwable e) throws java.lang.Throwable
handleTestExecutionException
in interface org.junit.jupiter.api.extension.TestExecutionExceptionHandler
java.lang.Throwable
Copyright © 2018. All rights reserved.