AggregateRepository extends Repository<I, A> implements CommandDispatcher, EventProducingRepository, EventDispatcherDelegate { @Override public final EventBus eventBus() { return context().eventBus(); } protected  AggregateRepository(); @Override @OverridingMethodsMustInvokeSuper void registerWith(BoundedContext context); @Override final EventBus eventBus(); @Override A create(I id); @Override final ImmutableSet<CommandClass> messageClasses(); @Override final void dispatch(CommandEnvelope cmd); @Override ImmutableSet<EventClass> events(); @Override ImmutableSet<EventClass> domesticEvents(); @Override ImmutableSet<EventClass> externalEvents(); ImmutableSet<EventClass> importableEvents(); @Override ImmutableSet<EventClass> outgoingEvents(); @Override void dispatchEvent(EventEnvelope event); @Override Optional<A> find(I id); @OverridingMethodsMustInvokeSuper @Override void close();  }
@Test @DisplayName("do nothing when event reaction fails") @MuteLogging void doNothingWhenEventReactionFails() { FailingAggregateRepository repository = new FailingAggregateRepository(); BoundedContext.InternalAccess contextAccess = context().internalAccess(); contextAccess.register(repository); DiagnosticMonitor monitor = new DiagnosticMonitor(); contextAccess.registerEventDispatcher(monitor); TestEventFactory factory = TestEventFactory.newInstance(getClass()); EventEnvelope envelope = EventEnvelope.of(factory.createEvent(FloatEncountered.newBuilder() .setNumber(-412.0f) .build())); context().eventBus() .post(envelope.outerObject()); List<HandlerFailedUnexpectedly> handlerFailureEvents = monitor.handlerFailureEvents(); assertThat(handlerFailureEvents).hasSize(1); HandlerFailedUnexpectedly event = handlerFailureEvents.get(0); assertThat(event.getHandledSignal()).isEqualTo(envelope.messageId()); assertThat(event.getEntity() .getTypeUrl()) .isEqualTo(repository.entityStateType() .value()); assertThat(event.getError() .getType()) .isEqualTo(IllegalArgumentException.class.getCanonicalName()); }