MessageTrap implements Subscriber { public Optional<T> getCapture() { return Optional.ofNullable(trappedNotification); } private  MessageTrap(Class<T> type, EventSchedulerType schedulerType); static MessageTrap<T> createAndSubscribe(Class<T> type, EventSchedulerType schedulerType); @Subscribe void anyNotificationOfType(T n); Optional<T> getCapture(); void reset(); @Override EventSchedulerType getSchedulerType(); static void verifyNotificationNotBroadcast(Class<N> notificationClass, Runnable action, EventSchedulerType schedulerType);  }
@Test public void getCapture() { MessageTrap<TestNotification> trap = MessageTrap.createAndSubscribe(TestNotification.class, TestSchedulerType.TEST_SCHEDULER_TYPE); NotificationRouter.get().broadcast(new TestNotification()); Assertions.assertTrue(trap.getCapture().isPresent(), "Expected a Notification"); }