AbstractPropertyAccessorTests.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:spring4-understanding 作者:
@Test
public void setEnumProperty() {
    EnumTester target = new EnumTester();
    AbstractPropertyAccessor accessor = createAccessor(target);

    accessor.setPropertyValue("autowire", "BY_NAME");
    assertEquals(Autowire.BY_NAME, target.getAutowire());

    accessor.setPropertyValue("autowire", "  BY_TYPE ");
    assertEquals(Autowire.BY_TYPE, target.getAutowire());

    try {
        accessor.setPropertyValue("autowire", "NHERITED");
        fail("Should have thrown TypeMismatchException");
    }
    catch (TypeMismatchException ex) {
        // expected
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号