diff --git a/pom.xml b/pom.xml index c0c237a..1c925df 100644 --- a/pom.xml +++ b/pom.xml @@ -156,7 +156,7 @@ SOFTWARE. com.yegor256 farea - 0.3.0 + 0.4.0 test diff --git a/src/test/java/org/eolang/hone/BuildMojoTest.java b/src/test/java/org/eolang/hone/BuildMojoTest.java index 0a40b29..a3b250f 100644 --- a/src/test/java/org/eolang/hone/BuildMojoTest.java +++ b/src/test/java/org/eolang/hone/BuildMojoTest.java @@ -24,6 +24,7 @@ package org.eolang.hone; import com.yegor256.farea.Farea; +import com.yegor256.farea.RequisiteMatcher; import java.nio.file.Path; import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Test; @@ -42,6 +43,7 @@ final class BuildMojoTest { void skipsOptimizationOnFlag(@Mktmp final Path dir) throws Exception { new Farea(dir).together( f -> { + f.clean(); f.build() .plugins() .appendItself() @@ -54,7 +56,7 @@ void skipsOptimizationOnFlag(@Mktmp final Path dir) throws Exception { MatcherAssert.assertThat( "the build must be successful", f.log(), - new LogMatcher() + RequisiteMatcher.SUCCESS ); } ); @@ -78,7 +80,7 @@ void buildsDockerImage(@Mktmp final Path dir, MatcherAssert.assertThat( "the build must be successful", f.log(), - new LogMatcher() + RequisiteMatcher.SUCCESS ); } ); diff --git a/src/test/java/org/eolang/hone/OptimizeMojoTest.java b/src/test/java/org/eolang/hone/OptimizeMojoTest.java index d26a3df..ceb29a8 100644 --- a/src/test/java/org/eolang/hone/OptimizeMojoTest.java +++ b/src/test/java/org/eolang/hone/OptimizeMojoTest.java @@ -24,6 +24,7 @@ package org.eolang.hone; import com.yegor256.farea.Farea; +import com.yegor256.farea.RequisiteMatcher; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -47,6 +48,7 @@ final class OptimizeMojoTest { void skipsOptimizationOnFlag(@Mktmp final Path dir) throws Exception { new Farea(dir).together( f -> { + f.clean(); f.build() .plugins() .appendItself() @@ -59,7 +61,7 @@ void skipsOptimizationOnFlag(@Mktmp final Path dir) throws Exception { MatcherAssert.assertThat( "the build must be successful", f.log(), - new LogMatcher("Execution skipped") + RequisiteMatcher.SUCCESS ); } ); @@ -71,6 +73,7 @@ void optimizesSimpleApp(@Mktmp final Path home, @RandomImage final String image) throws Exception { new Farea(home).together( f -> { + f.clean(); f.files() .file("src/main/java/foo/AbstractParent.java") .write( @@ -125,7 +128,7 @@ void worksAfterOptimization() { MatcherAssert.assertThat( "the build must be successful", f.log(), - new LogMatcher() + RequisiteMatcher.SUCCESS ); MatcherAssert.assertThat( "optimized .xmir must be present", @@ -142,6 +145,7 @@ void optimizesTwice(@Mktmp final Path home, @RandomImage final String image) throws Exception { new Farea(home).together( f -> { + f.clean(); f.files() .file("src/main/java/Hello.java") .write("class Hello { double foo() { return Math.sin(42); } }".getBytes()); @@ -166,7 +170,7 @@ void optimizesTwice(@Mktmp final Path home, MatcherAssert.assertThat( "the build must be successful", f.log(), - new LogMatcher() + RequisiteMatcher.SUCCESS ); MatcherAssert.assertThat( "optimized .phi must be present", @@ -181,6 +185,7 @@ void optimizesTwice(@Mktmp final Path home, void printsHelp(@Mktmp final Path dir) throws Exception { new Farea(dir).together( f -> { + f.clean(); f.files() .file("src/main/java/Hello.java") .write("class Hello { double foo() { return Math.sin(42); } }".getBytes()); @@ -191,7 +196,7 @@ void printsHelp(@Mktmp final Path dir) throws Exception { MatcherAssert.assertThat( "the build must be successful", f.log(), - new LogMatcher() + RequisiteMatcher.SUCCESS ); } ); @@ -204,6 +209,7 @@ void optimizesJnaClasses(@Mktmp final Path dir, @RandomImage final String image) throws Exception { new Farea(dir).together( f -> { + f.clean(); final String[] classes = { "Pointer.class", "Library.class", "Native.class", "Version.class", "Callback$UncaughtExceptionHandler.class", @@ -231,6 +237,7 @@ void optimizesJnaClasses(@Mktmp final Path dir, """ import com.sun.jna.Library; import com.sun.jna.Native; + import com.sun.jna.Pointer; import org.junit.jupiter.api.Test; class GoTest { interface Foo extends Library { @@ -259,7 +266,7 @@ void worksAfterOptimization() { MatcherAssert.assertThat( "the build must be successful", f.log(), - new LogMatcher() + RequisiteMatcher.SUCCESS ); } ); @@ -271,6 +278,7 @@ void optimizesJustOneLargeJnaClass(@Mktmp final Path dir, @RandomImage final String image) throws Exception { new Farea(dir).together( f -> { + f.clean(); f.files() .file("target/classes/com/sun/jna/Pointer.class") .write( @@ -299,7 +307,7 @@ void optimizesJustOneLargeJnaClass(@Mktmp final Path dir, MatcherAssert.assertThat( "the build must be successful", f.log(), - new LogMatcher() + RequisiteMatcher.SUCCESS ); } ); diff --git a/src/test/java/org/eolang/hone/PullMojoTest.java b/src/test/java/org/eolang/hone/PullMojoTest.java index e537d49..f68be6a 100644 --- a/src/test/java/org/eolang/hone/PullMojoTest.java +++ b/src/test/java/org/eolang/hone/PullMojoTest.java @@ -24,6 +24,7 @@ package org.eolang.hone; import com.yegor256.farea.Farea; +import com.yegor256.farea.RequisiteMatcher; import java.nio.file.Path; import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Test; @@ -42,6 +43,7 @@ final class PullMojoTest { void pullsDockerImage(@Mktmp final Path dir) throws Exception { new Farea(dir).together( f -> { + f.clean(); f.build() .plugins() .appendItself() @@ -54,7 +56,7 @@ void pullsDockerImage(@Mktmp final Path dir) throws Exception { MatcherAssert.assertThat( "the build must be successful", f.log(), - new LogMatcher() + RequisiteMatcher.SUCCESS ); } );