Example usage for org.springframework.beans NotReadablePropertyException getPropertyName

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

Introduction

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

Prototype

public String getPropertyName() 

Source Link

Document

Return the name of the offending property.

Usage

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

@Test
public void getUnknownProperty() {
    Simple target = new Simple("John", 2);
    AbstractPropertyAccessor accessor = createAccessor(target);

    try {//w w  w  . j ava 2s .c  om
        accessor.getPropertyValue("foo");
        fail("Should have failed to get an unknown property.");
    } catch (NotReadablePropertyException e) {
        assertEquals(Simple.class, e.getBeanClass());
        assertEquals("foo", e.getPropertyName());
    }
}