Package stack.source.junit4
Class ErrorDecorator
java.lang.Object
stack.source.junit4.ErrorDecorator
- All Implemented Interfaces:
org.junit.rules.TestRule
public final class ErrorDecorator
extends java.lang.Object
implements org.junit.rules.TestRule
Decorates stack traces with source code snippets.
Example output:
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:
public class BaseTest { @Rule public final ErrorDecorator errorDecorator = new ErrorDecorator(); } public final class MyTest extends BaseTest { @Test public void myTest() { // ... } }
-
Constructor Summary
Constructors Constructor Description ErrorDecorator()
-
Method Summary
Modifier and Type Method Description org.junit.runners.model.Statement
apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
-
Constructor Details
-
ErrorDecorator
public ErrorDecorator()
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)- Specified by:
apply
in interfaceorg.junit.rules.TestRule
-