Tabnine Logo
UseCasePart.flow
Code IndexAdd Tabnine to your IDE (free)

How to use
flow
method
in
org.requirementsascode.UseCasePart

Best Java code snippets using org.requirementsascode.UseCasePart.flow (Showing top 8 results out of 315)

origin: bertilmuth/requirementsascode

/**
 * Creates a new flow in the current use case.
 *
 * @param flowName
 *            the name of the flow to be created.
 * @return the newly created flow part
 * @throws ElementAlreadyInModel
 *             if a flow with the specified name already exists in the use case
 */
public FlowPart flow(String flowName) {
Objects.requireNonNull(flowName);
FlowPart useCaseFlowPart = stepPart.getUseCasePart().flow(flowName);
return useCaseFlowPart;
}
origin: bertilmuth/requirementsascode

@Test
public void throwsExceptionIfFlowIsCreatedTwice() {
thrown.expect(ElementAlreadyInModel.class);
thrown.expectMessage(ALTERNATIVE_FLOW);
modelBuilder
  .useCase(USE_CASE)
    .flow(ALTERNATIVE_FLOW)
      .step(SYSTEM_DISPLAYS_TEXT).system(displaysConstantText())
    .flow(ALTERNATIVE_FLOW);
}
origin: bertilmuth/requirementsascode

public Model buildWith(ModelBuilder modelBuilder) {
normalUser = modelBuilder.actor("Normal User");
anonymousUser = modelBuilder.actor("Anonymous User");
Model model = modelBuilder.useCase("Get greeted")
  .basicFlow()
    .step("S1").as(normalUser).system(this::promptsUserToEnterFirstName)
    .step("S2").as(normalUser).user(ENTERS_FIRST_NAME).system(this::savesFirstName)
    .step("S3").as(normalUser, anonymousUser).system(this::promptsUserToEnterAge)
    .step("S4").as(normalUser, anonymousUser).user(ENTERS_AGE).system(this::savesAge)
    .step("S5").as(normalUser).system(this::greetsUserWithFirstName)
    .step("S6").as(normalUser, anonymousUser).system(this::greetsUserWithAge)
    .step("S7").as(normalUser, anonymousUser).system(this::stops)
  .flow("Handle out-of-bounds age").insteadOf("S5").condition(this::ageIsOutOfBounds)
    .step("S5a_1").system(this::informsUserAboutOutOfBoundsAge)
    .step("S5a_2").continuesAt("S3")
  .flow("Handle non-numerical age").insteadOf("S5")
    .step("S5b_1").on(NON_NUMERICAL_AGE).system(this::informsUserAboutNonNumericalAge)
    .step("S5b_2").continuesAt("S3")
  .flow("Anonymous greeted with age only").insteadOf("S5").condition(this::ageIsOk)
    .step("S5c_1").as(anonymousUser).continuesAt("S6")
  .flow("Anonymous does not enter name").insteadOf("S1")
    .step("S1a_1").as(anonymousUser).continuesAt("S3")
  .build();
return model;
}
origin: bertilmuth/requirementsascode

public Model buildWith(ModelBuilder modelBuilder) {
Model model = modelBuilder.useCase("Get greeted")
  .basicFlow()
    .step("S1").system(this::promptsUserToEnterFirstName)
    .step("S2").user(ENTERS_FIRST_NAME).system(this::savesFirstName)
    .step("S3").system(this::promptsUserToEnterAge)
    .step("S4").user(ENTERS_AGE).system(this::savesAge)
    .step("S5").system(this::greetsUserWithFirstNameAndAge)
    .step("S6").system(this::stops)
  .flow("Handle out-of-bounds age").insteadOf("S5").condition(this::ageIsOutOfBounds)
    .step("S5a_1").system(this::informsUserAboutOutOfBoundsAge)
    .step("S5a_2").continuesAt("S3")
  .flow("Handle non-numerical age").insteadOf("S5")
    .step("S5b_1").on(NON_NUMERICAL_AGE).system(this::informsUserAboutNonNumericalAge)
    .step("S5b_2").continuesAt("S3")
  .build();
return model;
}
origin: bertilmuth/requirementsascode

  .step("S4a_1").system(blowsUp())
  .step("S4a_2").continuesAt("S1")
 .flow("Alternative flow B").after("S3")
  .step("S4b_1").continuesAfter("S2")
 .flow("Alternative flow C").condition(thereIsNoAlternative())
  .step("S5a").continuesWithoutAlternativeAt("S4")
 .flow("Alternative flow D").insteadOf("S4").condition(thereIsNoAlternative())
  .step("S4c_1").includesUseCase("Included use case")
  .step("S4c_2").continuesAt("S1")
 .flow("EX").anytime()
   .step("EX1").on(Exception.class).system(logsException())
.build();    
origin: bertilmuth/requirementsascode

@Test
public void continuesAfterCalledFromMultipleMutuallyExclusiveAlternativeFlows() {		
  Model model = modelBuilder
    .useCase(USE_CASE)
      .basicFlow()
        .step(CUSTOMER_ENTERS_TEXT).user(EntersText.class).system(displaysEnteredText())
        .step(CUSTOMER_ENTERS_TEXT_AGAIN).user(EntersText.class).system(displaysEnteredText())
        .step(CUSTOMER_ENTERS_NUMBER).user(EntersNumber.class).system(displaysEnteredNumber())		
      .flow(ALTERNATIVE_FLOW).insteadOf(CUSTOMER_ENTERS_TEXT_AGAIN).condition(this::textIsAvailable)
        .step(CUSTOMER_ENTERS_ALTERNATIVE_TEXT).user(EntersText.class).system(displaysEnteredText())
        .step(CONTINUE).continuesAfter(CUSTOMER_ENTERS_TEXT_AGAIN)        
      .flow(ALTERNATIVE_FLOW_2).insteadOf(CUSTOMER_ENTERS_TEXT_AGAIN).condition(this::textIsNotAvailable)
        .step("Customer enters alternative number").user(EntersNumber.class).system(displaysEnteredNumber())
        .step(CONTINUE_2).continuesAfter(CUSTOMER_ENTERS_TEXT_AGAIN)
    .build();
  
  modelRunner.run(model).reactTo(entersText(), entersAlternativeText(), entersText(), entersNumber());
  
  assertRecordedStepNames(CUSTOMER_ENTERS_TEXT, CUSTOMER_ENTERS_ALTERNATIVE_TEXT, CONTINUE, 
    CUSTOMER_ENTERS_NUMBER);
}

origin: bertilmuth/requirementsascode

@Test
public void continuesAtCalledFromMultipleMutuallyExclusiveAlternativeFlows() {		
  Model model = modelBuilder
    .useCase(USE_CASE)
      .basicFlow()        
        .step(CUSTOMER_ENTERS_TEXT).user(EntersText.class).system(displaysEnteredText())
        .step(CUSTOMER_ENTERS_TEXT_AGAIN).user(EntersText.class).system(displaysEnteredText())
        .step(CUSTOMER_ENTERS_NUMBER).user(EntersNumber.class).system(displaysEnteredNumber())		
      .flow(ALTERNATIVE_FLOW).insteadOf(CUSTOMER_ENTERS_TEXT_AGAIN).condition(this::textIsAvailable)
        .step(CUSTOMER_ENTERS_ALTERNATIVE_TEXT).user(EntersText.class).system(displaysEnteredText())
        .step(CONTINUE).continuesAt(CUSTOMER_ENTERS_NUMBER)        
      .flow(ALTERNATIVE_FLOW_2).insteadOf(CUSTOMER_ENTERS_TEXT_AGAIN).condition(this::textIsNotAvailable)
        .step("Customer enters alternative number").user(EntersNumber.class).system(displaysEnteredNumber())
        .step(CONTINUE_2).continuesAt(CUSTOMER_ENTERS_NUMBER)
    .build();
  
  modelRunner.run(model).reactTo(entersText(), entersAlternativeText(), entersText(), entersNumber());
  
  assertRecordedStepNames(CUSTOMER_ENTERS_TEXT, CUSTOMER_ENTERS_ALTERNATIVE_TEXT, CONTINUE,
    CUSTOMER_ENTERS_NUMBER);
}

origin: bertilmuth/requirementsascode

  @Test
  public void continuesWithoutAlternativeAtCalledFromMultipleMutuallyExclusiveAlternativeFlows() {		
    Model model = modelBuilder
      .useCase(USE_CASE)
        .basicFlow()        
          .step(CUSTOMER_ENTERS_TEXT).user(EntersText.class).system(displaysEnteredText())
          .step(CUSTOMER_ENTERS_TEXT_AGAIN).user(EntersText.class).system(displaysEnteredText())
          .step(CUSTOMER_ENTERS_NUMBER).user(EntersNumber.class).system(displaysEnteredNumber())		
        .flow(ALTERNATIVE_FLOW).insteadOf(CUSTOMER_ENTERS_TEXT_AGAIN).condition(this::textIsAvailable)
          .step(CUSTOMER_ENTERS_ALTERNATIVE_TEXT).user(EntersText.class).system(displaysEnteredText())
          .step(CONTINUE).continuesWithoutAlternativeAt(CUSTOMER_ENTERS_TEXT_AGAIN)        
        .flow(ALTERNATIVE_FLOW_2).insteadOf(CUSTOMER_ENTERS_TEXT_AGAIN).condition(this::textIsNotAvailable)
          .step(CUSTOMER_ENTERS_NUMBER_AGAIN).user(EntersNumber.class).system(displaysEnteredNumber())
          .step(CONTINUE_2).continuesWithoutAlternativeAt(CUSTOMER_ENTERS_TEXT_AGAIN)
      .build();
    
    modelRunner.run(model).reactTo(entersText(), entersAlternativeText(), entersText(), entersNumber());
    
    assertRecordedStepNames(CUSTOMER_ENTERS_TEXT, CUSTOMER_ENTERS_ALTERNATIVE_TEXT, CONTINUE,
      CUSTOMER_ENTERS_TEXT_AGAIN, CUSTOMER_ENTERS_NUMBER);
  }
}
org.requirementsascodeUseCasePartflow

Javadoc

Start a flow with the specified name.

Popular methods of UseCasePart

  • basicFlow
    Start the "happy day scenario" where all is fine and dandy.
  • build
    Returns the model that has been built.
  • condition
  • getUseCase
  • on
  • <init>
  • getModelBuilder

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • findViewById (Activity)
  • scheduleAtFixedRate (Timer)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Notification (javax.management)
  • BoxLayout (javax.swing)
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Runner (org.openjdk.jmh.runner)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now