import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertLinesMatch;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

class DemoTests {
  private final CollectingLogger logger = new CollectingLogger("*");
  private final Bach bach = new Bach(logger, Path.of("."), List.of());

  @Nested
  class JigsawQuickStart {

    @Test
    void greetings(@TempDir Path workspace) {
      var demo = Path.of("demo", "jigsaw-quick-start", "greetings");
      var base = workspace.resolve(demo.getFileName());
      bach.run(new Bach.Action.TreeCopy(demo, base));

      var logger = new CollectingLogger("*");
      var bach = new Bach(logger, base, List.of());
      bach.project.dormant = false;
      assertEquals(base, bach.base);
      assertTrue(Files.isDirectory(bach.based("src")));
      assertEquals("greetings", bach.project.name);
      assertEquals("1.0.0-SNAPSHOT", bach.project.version);
      assertEquals(0, bach.run());
      assertLinesMatch(
          List.of(
              "Running action Banner...",
              "Bach.java - " + Bach.VERSION,
              "Action Banner succeeded.",
              "Running action Check...",
              "Action Check succeeded.",
              "Running action Build...",
              ">> BUILD >>",
              "Action Build succeeded."),
          logger.getLines());
      // logger.getLines().forEach(System.out::println);
      // bach.run(new Bach.Action.TreeWalk(base, System.out::println));
    }
  }
}

@@ -323,20 +323,26 @@
 ter.api.
-Test
+io.TempDir
 ;%0Aimport
@@ -360,30 +360,94 @@
 jupiter.
-api.io.TempDir
+params.ParameterizedTest;%0Aimport org.junit.jupiter.params.provider.ValueSource
 ;%0A%0Aclass
@@ -643,20 +643,132 @@
 %7B%0A%0A    @
-Test
+ParameterizedTest%0A    @ValueSource(strings = %7B%22greetings%22, %22greetings-world%22, %22greetings-world-with-main-and-test%22%7D)
 %0A    voi
@@ -779,16 +779,29 @@
 eetings(
+String name, 
 @TempDir
@@ -874,27 +874,20 @@
 start%22, 
-%22greetings%22
+name
 );%0A     
@@ -1238,27 +1238,20 @@
 tEquals(
-%22greetings%22
+name
 , bach.p
@@ -1320,24 +1320,24 @@
 t.version);%0A
-
       assert
@@ -1356,16 +1356,35 @@
 ch.run()
+, logger.toString()
 );%0A     

Build all jigsaw-quick-start demo projects