Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to use 'default value' in action creatioin time for 'ForEach' action #25

Closed
dakusui opened this issue Mar 6, 2018 · 1 comment
Assignees

Comments

@dakusui
Copy link
Owner

dakusui commented Mar 6, 2018

I want to be able to do this.

  @PerformWith(Test.class)
  public Action composeSingleLoop2() {
    return sequential(
        simple("print hello", () -> System.out.println("hello")),
        forEachOf(
            asList("A", "B", "C")
        ).withDefault(
            "unknown"
        ).concurrently(
        ).perform(
            (Context $, DataHolder<String> value) -> {
              String v = value.isPresent() ?
                  value.get() :
                  String.format("(%s)", value.get());
              return $.sequential(
                  $.simple("print the given value(1st time)", () -> System.out.println(v)),
                  $.simple("print the given value(2nd time)", () -> System.out.println(v)),
                  $.sleep(2, MICROSECONDS)
              );
            }
        ),
        simple("print bye", () -> System.out.println("bye"))
    );
  }
@dakusui
Copy link
Owner Author

dakusui commented May 26, 2018

The value of this enhancement became unclear. Closing this for now.

@dakusui dakusui closed this as completed May 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant