javax.naming.event.ObjectChangeListener Java Examples

The following examples show how to use javax.naming.event.ObjectChangeListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EventUtilsTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@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());
    }
}
 
Example #2
Source File: EventUtilsTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@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());
    }
}
 
Example #3
Source File: EventUtilsTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@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());
    }
}
 
Example #4
Source File: EventUtilsTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}