/** * Makes the model runner continue at the specified step. No alternative flow * starting at the specified step is entered, even if its condition is enabled. * * @param stepName * name of the step to continue at, in this use case. * @return the use case part this step belongs to, to ease creation of further * flows * @throws NoSuchElementInModel * if no step with the specified stepName is found in the current * use case */ public UseCasePart continuesWithoutAlternativeAt(String stepName) { Objects.requireNonNull(stepName); UseCasePart useCasePart = as(systemActor).continuesWithoutAlternativeAt(stepName); return useCasePart; }
@Test public void continuesWithoutAlternativeAtCalledFromFirstStepOfAlternativeFlowWithRightActor() { Model model = modelBuilder .useCase(USE_CASE) .basicFlow() .step(CUSTOMER_ENTERS_TEXT).as(customer).user(EntersText.class).system(displaysEnteredText()) .step(CUSTOMER_ENTERS_TEXT_AGAIN).as(secondActor, customer).user(EntersText.class).system(displaysEnteredText()) .step(CUSTOMER_ENTERS_NUMBER).as(secondActor, customer).user(EntersNumber.class).system(displaysEnteredNumber()) .flow(ALTERNATIVE_FLOW).insteadOf(CUSTOMER_ENTERS_TEXT) .step(CONTINUE).as(customer).continuesWithoutAlternativeAt(CUSTOMER_ENTERS_TEXT) .build(); modelRunner.as(customer).run(model).reactTo(entersText(), entersText(), entersNumber()); assertRecordedStepNames(CONTINUE, CUSTOMER_ENTERS_TEXT, CUSTOMER_ENTERS_TEXT_AGAIN, CUSTOMER_ENTERS_NUMBER); }
@Test public void continuesWithoutAlternativeAtNotCalledWhenActorIsWrong() { Model model = modelBuilder .useCase(USE_CASE) .basicFlow() .step(CUSTOMER_ENTERS_TEXT).as(secondActor).user(EntersText.class).system(displaysEnteredText()) .step(CUSTOMER_ENTERS_TEXT_AGAIN).as(secondActor, customer).user(EntersText.class).system(displaysEnteredText()) .step(CUSTOMER_ENTERS_NUMBER).as(secondActor, customer).user(EntersNumber.class).system(displaysEnteredNumber()) .flow(ALTERNATIVE_FLOW).insteadOf(CUSTOMER_ENTERS_TEXT) .step(CONTINUE).as(customer).continuesWithoutAlternativeAt(CUSTOMER_ENTERS_TEXT) .build(); modelRunner.as(secondActor).run(model).reactTo(entersText(), entersText(), entersNumber()); assertRecordedStepNames(CUSTOMER_ENTERS_TEXT, CUSTOMER_ENTERS_TEXT_AGAIN, CUSTOMER_ENTERS_NUMBER); }