@Test public void testHandleClosed() { RaiseExceptionOutOfStateHandler outOfStateHandler = new RaiseExceptionOutOfStateHandler(); outOfStateHandler.setCorrectState(ConfiguredComponentState.STARTED); component.changeState(ClosedState.getInstance()); try { outOfStateHandler.handleOutOfState(component); fail("Expected an OutOfStateException"); } catch (OutOfStateException ex) { } }
@Override public void handleOutOfState(StateManagedComponent component) throws OutOfStateException { if(!this.isInCorrectState(component)) throw new OutOfStateException("Expected state: " + this.getCorrectState().getClass().getSimpleName() + " but got " + component.retrieveComponentState().getClass().getSimpleName()); }
RaiseExceptionOutOfStateHandler extends OutOfStateHandlerImp { @Override public void handleOutOfState(StateManagedComponent component) throws OutOfStateException { if(!this.isInCorrectState(component)) throw new OutOfStateException("Expected state: " + this.getCorrectState().getClass().getSimpleName() + " but got " + component.retrieveComponentState().getClass().getSimpleName()); } }
RaiseExceptionOutOfStateHandler extends OutOfStateHandlerImp { @Override public void handleOutOfState(StateManagedComponent component) throws OutOfStateException { if(!this.isInCorrectState(component)) throw new OutOfStateException("Expected state: " + this.getCorrectState().getClass().getSimpleName() + " but got " + component.retrieveComponentState().getClass().getSimpleName()); } RaiseExceptionOutOfStateHandler(); }
RaiseExceptionOutOfStateHandler extends OutOfStateHandlerImp { @Override public void handleOutOfState(StateManagedComponent component) throws OutOfStateException { if(!this.isInCorrectState(component)) throw new OutOfStateException("Expected state: " + this.getCorrectState().getClass().getSimpleName() + " but got " + component.retrieveComponentState().getClass().getSimpleName()); } RaiseExceptionOutOfStateHandler(); @Override void handleOutOfState(StateManagedComponent component); }
RaiseExceptionOutOfStateHandler extends OutOfStateHandlerImp { @Override public void handleOutOfState(StateManagedComponent component) throws OutOfStateException { if(!this.isInCorrectState(component)) throw new OutOfStateException("Expected state: " + this.getCorrectState().getClass().getSimpleName() + " but got " + component.retrieveComponentState().getClass().getSimpleName()); } RaiseExceptionOutOfStateHandler(); @Override void handleOutOfState(StateManagedComponent component);  }