Example usage for org.apache.commons.beanutils ConversionException getCause

List of usage examples for org.apache.commons.beanutils ConversionException getCause

Introduction

In this page you can find the example usage for org.apache.commons.beanutils ConversionException getCause.

Prototype

public Throwable getCause() 

Source Link

Usage

From source file:com.puppycrawl.tools.checkstyle.checks.header.HeaderCheckTest.java

@Test
public void testIoExceptionWhenLoadingHeader() throws Exception {
    HeaderCheck check = PowerMockito.spy(new HeaderCheck());
    PowerMockito.doThrow(new IOException("expected exception")).when(check, "loadHeader", anyObject());

    try {/*from ww w .  j av a2 s  . c  om*/
        check.setHeader("header");
        fail("Exception expected");
    } catch (ConversionException ex) {
        assertTrue(ex.getCause() instanceof IOException);
        assertEquals("unable to load header", ex.getMessage());
    }
}