@Test public void testShouldNotRunService() throws Exception { when(mockCondition.evaluate(message)) .thenReturn(false); logicalExpression.doService(message); verify(mockService, times(0)).doService(message); verify(mockElseService, times(1)).doService(message); }
@Override public void doService(AdaptrisMessage msg) throws ServiceException { try { log.trace("Running logical 'IF', with condition class {}", this.condition().getClass().getSimpleName()); if (this.condition().evaluate(msg)) { log.trace("Logical 'IF' evaluated to true, running service."); this.getThen().getService().doService(msg); } else { log.trace("Logical 'IF' evaluated to false, running 'otherwise' service."); this.getOtherwise().getService().doService(msg); } } catch (Exception e) { throw ExceptionHelper.wrapServiceException(e); } }
IfElse extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { log.trace("Running logical 'IF', with condition class {}", this.condition().getClass().getSimpleName()); if (this.condition().evaluate(msg)) { log.trace("Logical 'IF' evaluated to true, running service."); this.getThen().getService().doService(msg); } else { log.trace("Logical 'IF' evaluated to false, running 'otherwise' service."); this.getOtherwise().getService().doService(msg); } } catch (Exception e) { throw ExceptionHelper.wrapServiceException(e); } } }
IfElse extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { log.trace("Running logical 'IF', with condition class {}", this.condition().getClass().getSimpleName()); if (this.condition().evaluate(msg)) { log.trace("Logical 'IF' evaluated to true, running service."); this.getThen().getService().doService(msg); } else { log.trace("Logical 'IF' evaluated to false, running 'otherwise' service."); this.getOtherwise().getService().doService(msg); } } catch (Exception e) { throw ExceptionHelper.wrapServiceException(e); } } IfElse(); }
IfElse extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { log.trace("Running logical 'IF', with condition class {}", this.condition().getClass().getSimpleName()); if (this.condition().evaluate(msg)) { log.trace("Logical 'IF' evaluated to true, running service."); this.getThen().getService().doService(msg); } else { log.trace("Logical 'IF' evaluated to false, running 'otherwise' service."); this.getOtherwise().getService().doService(msg); } } catch (Exception e) { throw ExceptionHelper.wrapServiceException(e); } } IfElse(); @Override void doService(AdaptrisMessage msg); @Override void prepare(); @Override void start(); @Override void stop(); Condition getCondition(); void setCondition(Condition condition); ThenService getThen(); void setThen(ThenService thenService); ElseService getOtherwise(); void setOtherwise(ElseService elseService); }
IfElse extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { log.trace("Running logical 'IF', with condition class {}", this.condition().getClass().getSimpleName()); if (this.condition().evaluate(msg)) { log.trace("Logical 'IF' evaluated to true, running service."); this.getThen().getService().doService(msg); } else { log.trace("Logical 'IF' evaluated to false, running 'otherwise' service."); this.getOtherwise().getService().doService(msg); } } catch (Exception e) { throw ExceptionHelper.wrapServiceException(e); } } IfElse(); @Override void doService(AdaptrisMessage msg); @Override void prepare(); @Override void start(); @Override void stop(); Condition getCondition(); void setCondition(Condition condition); ThenService getThen(); void setThen(ThenService thenService); ElseService getOtherwise(); void setOtherwise(ElseService elseService);  }