package helloworld;

import java.util.function.Consumer;

import org.requirementsascode.AbstractActor;
import org.requirementsascode.Model;

import helloworld.actor.ValidUser;
import helloworld.command.EnterText;

public class HelloWorld03a {
  public static void main(String[] args) {
    HelloWorldActor03a helloWorldActor = new HelloWorldActor03a(HelloWorld03a::greetUser);
    ValidUser validUser03a = new ValidUser(helloWorldActor);
    helloWorldActor.setValidUser(validUser03a);
    validUser03a.run();
  }

  private static void greetUser(EnterText enterText) {
    System.out.println("Hello, " + enterText.text + ".");
  }
}

class HelloWorldActor03a extends AbstractActor {
  private AbstractActor validUser;
  private final Class<EnterText> entersName = EnterText.class;
  private final Consumer<EnterText> greetsUser;

  public HelloWorldActor03a(Consumer<EnterText> greetsUser) {
    this.greetsUser = greetsUser;
  }

  @Override
  public Model behavior() {
    Model model = Model.builder()
      .useCase("Get greeted").as(validUser)
        .basicFlow()
          .step("S1").user(entersName).system(greetsUser)
      .build();

    return model;
  }

  public void setValidUser(AbstractActor validUser) {
    this.validUser = validUser;
  }
}

@@ -205,16 +205,60 @@
 terText;
+%0Aimport helloworld.commandhandler.GreetUser;
 %0A%0Apublic
@@ -391,32 +391,21 @@
 03a(
-HelloWorld03a::g
+new G
 reetUser
 );%0A 
@@ -400,16 +400,18 @@
 reetUser
+()
 );%0A    V
@@ -514,16 +514,16 @@
 er03a);%0A
+
     vali
@@ -545,126 +545,8 @@
 %0A  %7D
-%0A%0A  private static void greetUser(EnterText enterText) %7B%0A    System.out.println(%22Hello, %22 + enterText.text + %22.%22);%0A  %7D
 %0A%7D%0A%0A

Clean design for HelloWorld03a