AbstractOrderEventHandlerImpl extends AbstractEventHandlerImpl implements OrderEventHandler { protected boolean isForceProcessing(final OrderEvent orderEvent) { final Object forceProcessing = orderEvent.getRuntimeParams().get("forceProcessing"); return forceProcessing instanceof Boolean && (Boolean) forceProcessing; }    }
@Test public void testIsForceProcessing() throws Exception { final OrderEvent processing = this.context.mock(OrderEvent.class, "processing"); final OrderEvent forceProcessing = this.context.mock(OrderEvent.class, "forceProcessing"); this.context.checking(new Expectations() {{ allowing(processing).getRuntimeParams(); will(returnValue(Collections.emptyMap())); allowing(forceProcessing).getRuntimeParams(); will(returnValue(Collections.singletonMap("forceProcessing", Boolean.TRUE))); }}); final AbstractOrderEventHandlerImpl handler = new AbstractOrderEventHandlerImpl() { @Override protected String getTransitionTarget(final OrderEvent orderEvent) { return null; } @Override public boolean handle(final OrderEvent orderEvent) throws OrderException { return false; } }; assertFalse(handler.isForceProcessing(processing)); assertTrue(handler.isForceProcessing(forceProcessing)); }