diff --git a/src/test/java/org/eolang/hone/OptimizeMojoTest.java b/src/test/java/org/eolang/hone/OptimizeMojoTest.java index e632e0f..d26a3df 100644 --- a/src/test/java/org/eolang/hone/OptimizeMojoTest.java +++ b/src/test/java/org/eolang/hone/OptimizeMojoTest.java @@ -24,13 +24,11 @@ package org.eolang.hone; import com.yegor256.farea.Farea; -import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -111,9 +109,23 @@ void worksAfterOptimization() { } """.getBytes() ); - Assertions.assertTrue( - OptimizeMojoTest.optimizeAndTest(f, image), - "must optimize without mistakes" + f.dependencies() + .append("org.junit.jupiter", "junit-jupiter-engine", "5.10.2"); + f.dependencies() + .append("org.junit.jupiter", "junit-jupiter-params", "5.10.2"); + f.build() + .plugins() + .appendItself() + .execution("default") + .phase("process-classes") + .goals("build", "optimize", "rmi") + .configuration() + .set("image", image); + f.exec("test"); + MatcherAssert.assertThat( + "the build must be successful", + f.log(), + new LogMatcher() ); MatcherAssert.assertThat( "optimized .xmir must be present", @@ -231,9 +243,23 @@ void worksAfterOptimization() { } """.getBytes() ); - Assertions.assertTrue( - OptimizeMojoTest.optimizeAndTest(f, image), - "must optimize without mistakes" + f.dependencies() + .append("org.junit.jupiter", "junit-jupiter-engine", "5.10.2"); + f.dependencies() + .append("org.junit.jupiter", "junit-jupiter-params", "5.10.2"); + f.build() + .plugins() + .appendItself() + .execution("default") + .phase("process-classes") + .goals("build", "optimize", "rmi") + .configuration() + .set("image", image); + f.exec("test"); + MatcherAssert.assertThat( + "the build must be successful", + f.log(), + new LogMatcher() ); } ); @@ -278,34 +304,4 @@ void optimizesJustOneLargeJnaClass(@Mktmp final Path dir, } ); } - - /** - * Run optimization. - * @param farea The farea - * @param image The image name - * @return TRUE if success - * @throws IOException If fails - */ - private static boolean optimizeAndTest(final Farea farea, - final String image) throws IOException { - farea.dependencies() - .append("org.junit.jupiter", "junit-jupiter-engine", "5.10.2"); - farea.dependencies() - .append("org.junit.jupiter", "junit-jupiter-params", "5.10.2"); - farea.build() - .plugins() - .appendItself() - .execution("default") - .phase("process-classes") - .goals("build", "optimize", "rmi") - .configuration() - .set("image", image); - farea.exec("test"); - MatcherAssert.assertThat( - "the build must be successful", - farea.log(), - new LogMatcher() - ); - return true; - } }