notifService.addNotificationListener(notifListener);
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
final int groupPort = getUDPDiscoveryPort();
BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
RandomUtil.randomString(),
null,
-1,
groupAddress,
groupPort,
true);
bg.setNotificationService(notifService);
Assert.assertEquals(0, notifListener.getNotifications().size());
bg.start();
Assert.assertEquals(1, notifListener.getNotifications().size());
Notification notif = notifListener.getNotifications().get(0);
Assert.assertEquals(NotificationType.BROADCAST_GROUP_STARTED, notif.getType());
Assert.assertEquals(bg.getName(), notif.getProperties()
.getSimpleStringProperty(new SimpleString("name"))
.toString());
bg.stop();
Assert.assertEquals(2, notifListener.getNotifications().size());
notif = notifListener.getNotifications().get(1);
Assert.assertEquals(NotificationType.BROADCAST_GROUP_STOPPED, notif.getType());
Assert.assertEquals(bg.getName(), notif.getProperties()
.getSimpleStringProperty(new SimpleString("name"))
.toString());
}