Example usage for junit.framework ComparisonFailure getCause

List of usage examples for junit.framework ComparisonFailure getCause

Introduction

In this page you can find the example usage for junit.framework ComparisonFailure getCause.

Prototype

public synchronized Throwable getCause() 

Source Link

Document

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

Usage

From source file:org.jetbrains.webdemo.executors.JunitFrameworkComparisonFailureSerializer.java

@Override
public void serialize(ComparisonFailure exception, JsonGenerator jsonGenerator,
        SerializerProvider serializerProvider) throws IOException {
    jsonGenerator.writeStartObject();//from  w  w  w  .  j av  a  2 s  .  c om
    jsonGenerator.writeStringField("message", exception.getMessage());
    jsonGenerator.writeStringField("expected", exception.getExpected());
    jsonGenerator.writeStringField("actual", exception.getActual());
    jsonGenerator.writeStringField("fullName", exception.getClass().getName());
    jsonGenerator.writeObjectField("stackTrace", exception.getStackTrace());
    jsonGenerator.writeObjectField("cause", exception.getCause() != exception ? exception.getCause() : null);
    jsonGenerator.writeEndObject();
}