}
public void testAddNotificationListenerErrors()
throws Exception
{
NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();
boolean caught = false;
try
{
broadcaster.addNotificationListener(null, null, null);
}
catch (IllegalArgumentException e)
{
caught = true;
}
assertTrue("Expected IllegalArgumentException for null listener", caught);
caught = false;
try
{
broadcaster.addNotificationListener(null, new NotificationFilterSupport(), null);
}
catch (IllegalArgumentException e)
{
caught = true;
}
assertTrue("Expected IllegalArgumentException for null listener", caught);
caught = false;
try
{
broadcaster.addNotificationListener(null, null, new Object());
}
catch (IllegalArgumentException e)
{
caught = true;
}
assertTrue("Expected IllegalArgumentException for null listener", caught);
caught = false;
try
{
broadcaster.addNotificationListener(null, new NotificationFilterSupport(), new Object());
}
catch (IllegalArgumentException e)
{
caught = true;
}