Skip to content

Commit

Permalink
farea 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 1, 2024
1 parent 4e5f490 commit 18ea4a4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ SOFTWARE.
<dependency>
<groupId>com.yegor256</groupId>
<artifactId>farea</artifactId>
<version>0.3.0</version>
<version>0.4.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
6 changes: 4 additions & 2 deletions src/test/java/org/eolang/hone/BuildMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()
Expand All @@ -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
);
}
);
Expand All @@ -78,7 +80,7 @@ void buildsDockerImage(@Mktmp final Path dir,
MatcherAssert.assertThat(
"the build must be successful",
f.log(),
new LogMatcher()
RequisiteMatcher.SUCCESS
);
}
);
Expand Down
20 changes: 14 additions & 6 deletions src/test/java/org/eolang/hone/OptimizeMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()
Expand All @@ -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
);
}
);
Expand All @@ -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(
Expand Down Expand Up @@ -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",
Expand All @@ -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());
Expand All @@ -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",
Expand All @@ -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());
Expand All @@ -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
);
}
);
Expand All @@ -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",
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -259,7 +266,7 @@ void worksAfterOptimization() {
MatcherAssert.assertThat(
"the build must be successful",
f.log(),
new LogMatcher()
RequisiteMatcher.SUCCESS
);
}
);
Expand All @@ -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(
Expand Down Expand Up @@ -299,7 +307,7 @@ void optimizesJustOneLargeJnaClass(@Mktmp final Path dir,
MatcherAssert.assertThat(
"the build must be successful",
f.log(),
new LogMatcher()
RequisiteMatcher.SUCCESS
);
}
);
Expand Down
4 changes: 3 additions & 1 deletion src/test/java/org/eolang/hone/PullMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()
Expand All @@ -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
);
}
);
Expand Down

0 comments on commit 18ea4a4

Please sign in to comment.