类javax.naming.event.ObjectChangeListener源码实例Demo

下面列出了怎么用javax.naming.event.ObjectChangeListener的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: astor   文件: EventUtilsTest.java
@Test
public void testAddEventListenerWithNoAddMethod()
{
    final PropertyChangeSource src = new PropertyChangeSource();
    EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
    ObjectChangeListener listener = handler.createListener(ObjectChangeListener.class);
    try
    {
        EventUtils.addEventListener(src, ObjectChangeListener.class, listener);
        fail("Should not be allowed to add a listener to an object that doesn't support it.");
    }
    catch (IllegalArgumentException e)
    {
        assertEquals("Class " + src.getClass().getName() + " does not have a public add" + ObjectChangeListener.class.getSimpleName() + " method which takes a parameter of type " + ObjectChangeListener.class.getName() + ".", e.getMessage());
    }
}
 
源代码2 项目: astor   文件: EventUtilsTest.java
@Test
public void testAddEventListenerWithNoAddMethod()
{
    final PropertyChangeSource src = new PropertyChangeSource();
    final EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
    final ObjectChangeListener listener = handler.createListener(ObjectChangeListener.class);
    try
    {
        EventUtils.addEventListener(src, ObjectChangeListener.class, listener);
        fail("Should not be allowed to add a listener to an object that doesn't support it.");
    }
    catch (final IllegalArgumentException e)
    {
        assertEquals("Class " + src.getClass().getName() + " does not have a public add" + ObjectChangeListener.class.getSimpleName() + " method which takes a parameter of type " + ObjectChangeListener.class.getName() + ".", e.getMessage());
    }
}
 
源代码3 项目: astor   文件: EventUtilsTest.java
@Test
public void testAddEventListenerWithNoAddMethod()
{
    final PropertyChangeSource src = new PropertyChangeSource();
    EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
    ObjectChangeListener listener = handler.createListener(ObjectChangeListener.class);
    try
    {
        EventUtils.addEventListener(src, ObjectChangeListener.class, listener);
        fail("Should not be allowed to add a listener to an object that doesn't support it.");
    }
    catch (IllegalArgumentException e)
    {
        assertEquals("Class " + src.getClass().getName() + " does not have a public add" + ObjectChangeListener.class.getSimpleName() + " method which takes a parameter of type " + ObjectChangeListener.class.getName() + ".", e.getMessage());
    }
}
 
源代码4 项目: astor   文件: EventUtilsTest.java
public void testAddEventListenerWithNoAddMethod()
{
    final PropertyChangeSource src = new PropertyChangeSource();
    EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
    ObjectChangeListener listener = handler.createListener(ObjectChangeListener.class);
    try
    {
        EventUtils.addEventListener(src, ObjectChangeListener.class, listener);
        fail("Should not be allowed to add a listener to an object that doesn't support it.");
    }
    catch (IllegalArgumentException e)
    {
        assertEquals("Class " + src.getClass().getName() + " does not have a public add" + ObjectChangeListener.class.getSimpleName() + " method which takes a parameter of type " + ObjectChangeListener.class.getName() + ".", e.getMessage());
    }
}
 
 类所在包
 类方法
 同包方法