NextAction extends ModelObject { public static NextAction stopInState(WorkflowState finalState, String reason) { assertNotNull(finalState, "State can not be null"); assertFinalState(finalState); return new NextAction(null, finalState, reason); } private  NextAction(DateTime activation, WorkflowState nextState, String reason); DateTime getActivation(); WorkflowState getNextState(); String getReason(); static NextAction retryAfter(DateTime activation, String reason); static NextAction moveToStateAfter(WorkflowState nextState, DateTime activation, String reason); static NextAction moveToState(WorkflowState nextState, String reason); static NextAction stopInState(WorkflowState finalState, String reason); boolean isRetry();  }
@Test public void stopInStartStateThrowsException() { Assertions.assertThrows(InvalidNextActionException.class, () -> NextAction.stopInState(TestState.initial, "stop reason")); }
@Test public void stopInNormalStateThrowsException() { Assertions.assertThrows(InvalidNextActionException.class, () -> NextAction.stopInState(TestState.state1, "stop reason")); }