Example usage for org.springframework.beans NotReadablePropertyException getMessage

List of usage examples for org.springframework.beans NotReadablePropertyException getMessage

Introduction

In this page you can find the example usage for org.springframework.beans NotReadablePropertyException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:net.sf.juffrou.reflect.spring.BeanWrapperTests.java

@Test
public void testErrorMessageOfNestedProperty() {
    ITestBean parent = new TestBean();
    ITestBean child = new DifferentTestBean();
    child.setName("test");
    parent.setSpouse(child);/*from w  ww.j a  va2 s .  c om*/
    BeanWrapper bw = new JuffrouSpringBeanWrapper(parent);
    try {
        bw.getPropertyValue("spouse.bla");
    } catch (NotReadablePropertyException ex) {
        assertTrue(ex.getMessage().indexOf(TestBean.class.getName()) != -1);
    }
}

From source file:org.springframework.beans.AbstractPropertyAccessorTests.java

@Test
public void testErrorMessageOfNestedProperty() {
    ITestBean target = new TestBean();
    ITestBean child = new DifferentTestBean();
    child.setName("test");
    target.setSpouse(child);//from   w w w .ja  v  a2 s.  c  om
    AbstractPropertyAccessor accessor = createAccessor(target);
    try {
        accessor.getPropertyValue("spouse.bla");
    } catch (NotReadablePropertyException ex) {
        assertTrue(ex.getMessage().contains(TestBean.class.getName()));
    }
}

From source file:org.springframework.beans.BeanWrapperTests.java

@Test
public void testErrorMessageOfNestedProperty() {
    ITestBean parent = new TestBean();
    ITestBean child = new DifferentTestBean();
    child.setName("test");
    parent.setSpouse(child);/*  w w w  .j a  v  a2s.c  o  m*/
    BeanWrapper bw = new BeanWrapperImpl(parent);
    try {
        bw.getPropertyValue("spouse.bla");
    } catch (NotReadablePropertyException ex) {
        assertTrue(ex.getMessage().indexOf(TestBean.class.getName()) != -1);
    }
}