### Question:
FsmEventProcessor implements EventProcessor { @Override public void submit(Object event) { requireNonNull(event); try { stateMachine.handle(event, loggingPrefix); } catch (Throwable cause) { String eventName = event.getClass().getSimpleName(); LOGGER.error("{} {} -> ???: Exception occurred while processing event={}. Cause=\"{}\"", new Object[]{loggingPrefix, stateMachine.currentState(), eventName, cause}); errorHandler.accept(cause, stateMachine.currentState()); } } FsmEventProcessor(StateMachine<S> stateMachine, BiConsumer<Throwable, S> errorHandler, String loggingPrefix); @Override void submit(Object event);  }### Answer:
@Test public void throwsNullPointerExceptionForNullEvents() { FsmEventProcessor<String> processor = new FsmEventProcessor<>(stateMachine, errorHandler, "prefix"); assertThrows(NullPointerException.class, () -> processor.submit(null)); }
@Test public void propagatesEventToFsm() { FsmEventProcessor<String> processor = new FsmEventProcessor<>(stateMachine, errorHandler, "prefix"); processor.submit(new TestEventOk()); assertThat(stateMachine.currentState(), is("end")); }
@Test public void handlesStateMachineExceptions() { FsmEventProcessor<String> processor = new FsmEventProcessor<>(stateMachine, errorHandler, "prefix"); processor.submit(new TestEventError()); verify(errorHandler).accept(any(RuntimeException.class), eq("start")); assertThat(logger.lastMessage(), is( loggingEvent( ERROR, "prefix start -> \\?\\?\\?: Exception occurred while processing event=TestEventError. Cause=.*", RuntimeException.class, "Test exception message"))); }