EventBus extends MulticastBus<Event, EventEnvelope, EventClass, EventDispatcher> implements ContextAware { public final void post(Event event) { post(event, observer()); } private  EventBus(Builder builder); static Builder newBuilder(); final Set<EventClass> registeredEventClasses(); EventStore eventStore(); final void post(Event event); final void post(Iterable<Event> events); @VisibleForTesting final Optional<Enricher> enricher(); @Override void close(); @Override @Internal void registerWith(BoundedContext context); @Override boolean isRegistered();  }
@Test @DisplayName("store only events passing filters") void filterOutFailingEvents() { eventBus.register(new EBTaskAddedNoOpSubscriber()); Command command = command(addTasks(newTask(false), newTask(true), newTask(false), newTask(true), newTask(true))); commandBus.post(command, StreamObservers.noOpObserver()); List<Event> storedEvents = readEvents(eventBus); assertThat(storedEvents).hasSize(2); for (Event event : storedEvents) { EBTaskAdded contents = unpack(event.getMessage(), EBTaskAdded.class); Task task = contents.getTask(); assertFalse(task.getDone()); } }