OrderedTask extends Task implements Serializable { @Override public Step getStepAfterStep(Step step, TaskResult result) { if (step == null) { return steps.get(0); } int nextIndex = steps.indexOf(step) + 1; if (nextIndex < steps.size()) { return steps.get(nextIndex); } return null; } OrderedTask(String identifier, List<Step> steps);  OrderedTask(String identifier, Step... steps); @Override Step getStepAfterStep(Step step, TaskResult result); @Override Step getStepBeforeStep(Step step, TaskResult result); @Override Step getStepWithIdentifier(String identifier); @Override TaskProgress getProgressOfCurrentStep(Step step, TaskResult result); @Override String getTitleForStep(Context context, Step step); @Override void validateParameters(); List<Step> getSteps();  }
@Test public void testGetStepAfterStep() throws Exception { Step nextStep = testTask.getStepAfterStep(stepOne, null); assertEquals("Returns the next sequential step in the task", stepTwo, nextStep); nextStep = testTask.getStepAfterStep(stepThree, null); assertNull("Returns null if passed in step is the last", nextStep); }