Example usage for org.springframework.context NoSuchMessageException getCause

List of usage examples for org.springframework.context NoSuchMessageException getCause

Introduction

In this page you can find the example usage for org.springframework.context NoSuchMessageException 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.synyx.sample.ResourceBundleMessageSourceTest.java

@Test
public void test_resource_bundle_msg_source_broken() throws Exception {
    try {/*from  w  w w.  ja va2s . c  om*/
        ResourceBundleMessageSource bundle = new ResourceBundleMessageSource();
        bundle.setBasename("broken_messages");
        bundle.getMessage("test.1", new Object[0], Locale.getDefault());
        fail("Should throw Exception due to wrong format of file");
    } catch (NoSuchMessageException e) {
        // SHOULD have a cause to indicate why the message is missing
        assertNotNull(e.getCause());
    }
}