WaitForSeProcessing extends AbstractObservableState { @Override public void onEvent(AbstractObservableLocalReader.InternalEvent event) { if (logger.isTraceEnabled()) { logger.trace( "[{}] onEvent => Event {} received in currentState {}", reader.getName(), event, state); } switch (event) { case SE_PROCESSED: if (this.reader.getPollingMode() == ObservableReader.PollingMode.REPEATING) { switchState(MonitoringState.WAIT_FOR_SE_REMOVAL); } else { this.reader.processSeRemoved(); switchState(MonitoringState.WAIT_FOR_START_DETECTION); } break; case SE_REMOVED: reader.processSeRemoved(); if (reader.getPollingMode() == ObservableReader.PollingMode.REPEATING) { switchState(MonitoringState.WAIT_FOR_SE_INSERTION); } else { switchState(MonitoringState.WAIT_FOR_START_DETECTION); } break; case STOP_DETECT: reader.processSeRemoved(); switchState(MonitoringState.WAIT_FOR_START_DETECTION); break; default: logger.warn( "[{}] Ignore => Event {} received in currentState {}", reader.getName(), event, state); break; } } WaitForSeProcessing(AbstractObservableLocalReader reader);  WaitForSeProcessing(
      AbstractObservableLocalReader reader,
      AbstractMonitoringJob monitoringJob,
      ExecutorService executorService); @Override void onEvent(AbstractObservableLocalReader.InternalEvent event);  }
@Test public void waitForProcessed_processed() throws Exception { doReturn(ObservableReader.PollingMode.REPEATING).when(r).getPollingMode(); doReturn(false).when(r).waitForCardAbsentNative(); waitForSeProcessing.onActivate(); waitForSeProcessing.onEvent(AbstractObservableLocalReader.InternalEvent.SE_PROCESSED); verify(r, times(1)).switchState(WAIT_FOR_SE_REMOVAL); }