@Test public void waitForRemoval_SINGLESHOT() throws Exception { AbstractObservableLocalReader r = AbsSmartInsertionTheadedReaderTest.getMock(READER_NAME); WaitForSeRemoval waitForSeRemoval = new WaitForSeRemoval(r); doReturn(ObservableReader.PollingMode.SINGLESHOT).when(r).getPollingMode(); doNothing().when(r).processSeRemoved(); waitForSeRemoval.onActivate(); waitForSeRemoval.onEvent(AbstractObservableLocalReader.InternalEvent.SE_REMOVED); verify(r, times(1)).switchState(WAIT_FOR_START_DETECTION); }
@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_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; } }
WaitForSeRemoval 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_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; } } }
WaitForSeRemoval 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_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; } } WaitForSeRemoval(AbstractObservableLocalReader reader);  WaitForSeRemoval(
      AbstractObservableLocalReader reader,
      AbstractMonitoringJob monitoringJob,
      ExecutorService executorService); }
WaitForSeRemoval 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_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; } } WaitForSeRemoval(AbstractObservableLocalReader reader);  WaitForSeRemoval(
      AbstractObservableLocalReader reader,
      AbstractMonitoringJob monitoringJob,
      ExecutorService executorService); @Override void onEvent(AbstractObservableLocalReader.InternalEvent event); }
WaitForSeRemoval 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_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; } } WaitForSeRemoval(AbstractObservableLocalReader reader);  WaitForSeRemoval(
      AbstractObservableLocalReader reader,
      AbstractMonitoringJob monitoringJob,
      ExecutorService executorService); @Override void onEvent(AbstractObservableLocalReader.InternalEvent event);  }