@Test public void throwsNullPointerExceptionForNullEvents() { FsmEventProcessor<String> processor = new FsmEventProcessor<>(stateMachine, errorHandler, "prefix"); assertThrows(NullPointerException.class, () -> processor.submit(null)); }
@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 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 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); }
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); }
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);  }