/**
* Test for the method
* removeNotificationListener(javax.management.NotificationListener,
* javax.management.NotificationFilter, java.lang.Object)
*
* @see javax.management.NotificationBroadcasterSupport#removeNotificationListener(javax.management.NotificationListener,
* javax.management.NotificationFilter, java.lang.Object)
*/
public final void testRemoveNotificationListenerNotificationListenerNotificationFilterObject() {
Hello h = new Hello();
// Test exception.
try {
h.removeNotificationListener(this, null, null);
fail("ListenerNotFoundException not thrown!");
} catch (Throwable ex) {
assertTrue("Wrong exception thrown: " + ex,
(ex instanceof ListenerNotFoundException));
}
h.addNotificationListener(this, null, null);
h.addNotificationListener(this, null, null);
removeNL(h, null, null);
h.sayHello();
assertNotNull("Notification has not been received!", n);
removeNL(h, null, null);
n = null;
h.sayHello();
assertNull("Notification has been received!", n);
AttributeChangeNotificationFilter acf = new AttributeChangeNotificationFilter();
acf.enableAttribute("Name");
NotificationFilterSupport f = new NotificationFilterSupport();
f.enableType(Hello.SAY_HELLO_INVOKED);
h.addNotificationListener(this, acf, "handback1");
h.addNotificationListener(this, f, handback);
removeNL(h, f, handback);
n = null;
h.setName("New name");
assertNotNull("Notification has not been received!", n);
assertTrue("Wrong notification received: " + n,
(n instanceof AttributeChangeNotification));
}
NotificationBroadcasterSupportTest.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:freeVM
作者:
评论列表
文章目录