package org.requirementsascode;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;

public class FlowWithCaseStepTest extends AbstractTestCase {
  @Before
  public void setup() {
    setupWithRecordingModelRunner();
  }
  
  @Test
  public void runsTrueCaseStep() {    
    Model model = modelBuilder
      .useCase(USE_CASE)
        .basicFlow()
          .step(CUSTOMER_ENTERS_TEXT).inCase(() -> true).system(displaysConstantText())
      .build();
        
    modelRunner.run(model);
    assertEquals(TEXT, displayedText);
  }
  
  @Test
  public void runsFalseCaseTrueCaseSteps() {    
    Model model = modelBuilder
      .useCase(USE_CASE)
        .basicFlow()
          .step(CUSTOMER_ENTERS_TEXT).user(EntersNumber.class).inCase(() -> false).system(displaysEnteredNumber())
          .step(SYSTEM_DISPLAYS_TEXT).system(super.displaysConstantText())
      .build();
        
    modelRunner.run(model).reactTo(entersNumber());
    assertEquals(TEXT, displayedText);
    
    assertRecordedStepNames(CUSTOMER_ENTERS_TEXT, SYSTEM_DISPLAYS_TEXT);
  }
  
  @Test
  public void runsFalseCaseFalseCaseSteps() {    
    /*Model model = modelBuilder
      .useCase(USE_CASE)
        .basicFlow()
          .step(CUSTOMER_ENTERS_TEXT).inCase(() -> false).user(EntersNumber.class).system(displaysEnteredNumber())
          .step(SYSTEM_DISPLAYS_TEXT).inCase(() -> false).system(displaysConstantText())
      .build();
        
    modelRunner.run(model).reactTo(entersNumber(), entersText());
    assertNull(displayedText);
    
    assertRecordedStepNames(CUSTOMER_ENTERS_TEXT, SYSTEM_DISPLAYS_TEXT);*/
  }
}

@@ -70,16 +70,59 @@
 tEquals;
+%0Aimport static org.junit.Assert.assertNull;
 %0A%0Aimport
@@ -1205,10 +1205,8 @@
     
-/*
 Mode
@@ -1312,36 +1312,16 @@
 S_TEXT).
-inCase(() -%3E false).
 user(Ent
@@ -1337,16 +1337,36 @@
 .class).
+inCase(() -%3E false).
 system(d
@@ -1681,10 +1681,8 @@
 XT);
-*/
 %0A  %7D

Enable inCase()