diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java index 00d09dde3d..a223cdc9c5 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java @@ -57,12 +57,7 @@ final class AssembleMojoTest { @Test void assemblesTogether(@TempDir final Path temp) throws IOException { final Map result = new FakeMaven(temp) - .withProgram( - "+alias stdout org.eolang.io.stdout", - "", - "[x] > main", - " (stdout \"Hello!\" x).print" - ) + .withHelloWorld() .execute(AssembleMojo.class) .result(); final String parsed = String.format( diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/CleanMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/CleanMojoTest.java index b154e2c496..2b8debf919 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/CleanMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/CleanMojoTest.java @@ -26,10 +26,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import org.cactoos.set.SetOf; -import org.eolang.maven.objectionary.Objectionaries; -import org.eolang.maven.util.Home; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -64,41 +61,20 @@ void cleansSuccessfully(@TempDir final Path temp) throws IOException { @Test @ExtendWith(OnlineCondition.class) void makesFullCompilingLifecycleSuccessfully(@TempDir final Path temp) throws IOException { - final Path src = temp.resolve("src"); - new Home(src).save( - String.join( - "\n", - "+alias stdout org.eolang.io.stdout", - "", - "[x] > main\n (stdout \"Hello!\" x).print\n" - ), - Paths.get("main.eo") - ); - final Path target = temp.resolve("target"); - new Moja<>(RegisterMojo.class) - .with("foreign", temp.resolve("eo-foreign.json").toFile()) - .with("foreignFormat", "json") - .with("sourcesDir", src.toFile()) + new FakeMaven(temp) + .withHelloWorld() .with("includeSources", new SetOf<>("**.eo")) - .execute(); - new Moja<>(AssembleMojo.class) .with("outputDir", temp.resolve("out").toFile()) - .with("targetDir", target.toFile()) - .with("foreign", temp.resolve("eo-foreign.json").toFile()) - .with("foreignFormat", "json") .with("placed", temp.resolve("list").toFile()) .with("cache", temp.resolve("cache/parsed")) .with("skipZeroVersions", true) .with("central", Central.EMPTY) .with("ignoreTransitive", true) - .with("plugin", FakeMaven.pluginDescriptor()) - .with("objectionaries", new Objectionaries.Fake()) - .execute(); - new Moja<>(CleanMojo.class) - .with("targetDir", target.toFile()) - .execute(); + .execute(RegisterMojo.class) + .execute(AssembleMojo.class) + .execute(CleanMojo.class); MatcherAssert.assertThat( - target.toFile().exists(), + temp.resolve("target").toFile().exists(), Matchers.is(false) ); } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java b/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java index 310ff30442..90a42c9497 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java @@ -322,7 +322,12 @@ FakeMaven withPlacedBinary(final Path binary) { * @throws IOException If method can't save eo program to the workspace. */ FakeMaven withHelloWorld() throws IOException { - return this.withProgram("+package f\n", "[args] > main", " (stdout \"Hello!\").print"); + return this.withProgram( + "+alias stdout org.eolang.io.stdout", + "+package f\n", + "[x] > main", + " (stdout \"Hello!\" x).print > @" + ); } /**