Example usage for org.apache.commons.lang3 SerializationException getCause

List of usage examples for org.apache.commons.lang3 SerializationException getCause

Introduction

In this page you can find the example usage for org.apache.commons.lang3 SerializationException 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.grouplens.grapht.reflect.QualifiersTest.java

@Test
public void testClassMatcherBadClassError() {
    Qualifiers.AnnotationClassMatcher.SerialProxy proxy = new Qualifiers.AnnotationClassMatcher.SerialProxy(
            String.class);
    byte[] data = SerializationUtils.serialize(proxy);
    try {/*from ww  w. j  ava2s  . c om*/
        SerializationUtils.deserialize(data);
        fail("deserialization should fail with error");
    } catch (SerializationException e) {
        assertThat(e.getCause(), instanceOf(InvalidObjectException.class));
        assertThat(e.getCause().getCause(), instanceOf(ClassCastException.class));
    }
}