MessageListTrap implements Subscriber { public ImmutableList<T> getCapturedNotifications() { return ImmutableList.copyOf(trappedNotifications); } private  MessageListTrap(Class<T> type, boolean acceptSubclasses, EventSchedulerType schedulerType); static MessageListTrap<T> createAndSubscribe(Class<T> type, boolean acceptSubclasses, EventSchedulerType schedulerType); @Subscribe void anyNotificationOfType(T n); ImmutableList<T> getCapturedNotifications(); @Override EventSchedulerType getSchedulerType();  }
@Test public void getCapturedNotifications() { MessageListTrap<TestNotification> trap = MessageListTrap.createAndSubscribe(TestNotification.class, false, TestSchedulerType.TEST_SCHEDULER_TYPE); NotificationRouter.get().broadcast(new TestNotification()); NotificationRouter.get().broadcast(new TestNotification()); NotificationRouter.get().broadcast(new TestNotification()); Assertions.assertEquals(3, trap.getCapturedNotifications().size(), "Expected 3 Notifications"); }