class MessageTrap implements Subscriber {

    public static <N extends Notification> void verifyNotificationNotBroadcast(Class<N> notificationClass, Runnable action, EventSchedulerType schedulerType) {
        MessageTrap<N> messageTrap = MessageTrap.createAndSubscribe(notificationClass, schedulerType);
        action.run();
        messageTrap.getCapture().ifPresent(n -> {
            throw new AssertionError("Unexpected notification of type [" + notificationClass.getName() + "] broadcast: " + n);
        });
    }

    private  MessageTrap(Class<T> type, EventSchedulerType schedulerType);

}