public void testUsageOfExplicitPropertyDescriptor() throws Exception {
PropertyDescriptor pd = new PropertyDescriptor(
"myProp", this.getClass(),
"getterUsageOfExplicitPropertyDescriptor",
"setterUsageOfExplicitPropertyDescriptor"
);
DefaultPropertyModel model = new DefaultPropertyModel(this, pd);
assertEquals("Getter returns this", model.getValue(), this);
String msgToThrow = "msgToThrow";
try {
model.setValue(msgToThrow);
fail("Setter should throw an exception");
} catch (InvocationTargetException ex) {
// when an exception occurs it should throw InvocationTargetException
assertEquals("The right message", msgToThrow, ex.getTargetException().getMessage());
}
}
DefaultPropertyModelTest.java 文件源码
java
阅读 16
收藏 0
点赞 0
评论 0
项目:incubator-netbeans
作者:
评论列表
文章目录