Example usage for junit.framework AssertionFailedError getSuppressed

List of usage examples for junit.framework AssertionFailedError getSuppressed

Introduction

In this page you can find the example usage for junit.framework AssertionFailedError getSuppressed.

Prototype

public final synchronized Throwable[] getSuppressed() 

Source Link

Document

Returns an array containing all of the exceptions that were suppressed, typically by the try -with-resources statement, in order to deliver this exception.

Usage

From source file:org.nuxeo.runtime.test.Failures.java

@Override
public String toString() {
    StringBuffer buffer = new StringBuffer();
    int i = 1;/*from   w w w  .j a  v  a 2  s  .  c  om*/
    AssertionFailedError errors = new AssertionFailedError();
    for (Failure failure : failures) {
        buffer.append("* Failure " + i + ": ").append(failure.getTestHeader()).append("\n")
                .append(failure.getTrace()).append("\n");
        errors.addSuppressed(failure.getException());
        i++;
    }
    if (errors.getSuppressed().length > 0) {
        // Log because JUnit swallows some parts of the stack trace
        log.debug(errors.getMessage(), errors);
    }
    return buffer.toString();
}