Example usage for org.apache.commons.validator ValidatorException getCause

List of usage examples for org.apache.commons.validator ValidatorException getCause

Introduction

In this page you can find the example usage for org.apache.commons.validator ValidatorException 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:jp.terasoluna.fw.validation.springmodules.DefaultBeanValidatorExTest.java

/**
 * testCleanupValidator01() <br>/*  w w w . jav  a2s  .co  m*/
 * <br>
 * () <br>
 * A,E <br>
 * <br>
 * () validator:CommonsValidatorEx<br>
 * (????) validator.getValidatorException():ValidatorException<br>
 * <br>
 * () :ValidatorExceptionterasoluna-spring-validator)<br>
 * ?ValidatorException(commons)<br>
 * <br>
 * validator?ValidatorException????????????? <br>
 * @throws Exception ?????
 */
@Test
public void testCleanupValidator01() throws Exception {
    // ??
    ValidatorResources resources = new ValidatorResources();
    CommonsValidatorEx commonsValidatorEx = new CommonsValidatorEx(resources, null);
    ValidatorException validatorException = new ValidatorException();
    ReflectionTestUtils.setField(commonsValidatorEx, "validatorException", validatorException);

    DefaultBeanValidatorEx defaultBeanValidatorEx = new DefaultBeanValidatorEx();
    try {
        // 
        defaultBeanValidatorEx.cleanupValidator(commonsValidatorEx);
        fail();
    } catch (jp.terasoluna.fw.validation.springmodules.ValidatorException e) {
        // 
        assertSame(validatorException, e.getCause());
    }
}