diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeMojoTest.java index 0bc2626e3a..1f99afb893 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeMojoTest.java @@ -50,11 +50,6 @@ final class BinarizeMojoTest { */ public static final Path SRC = Paths.get("src/test/resources/org/eolang/maven/binarize/"); - /** - * Empty message for JUnit Assertions. - */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; - /** * BinarizeMojo can binarize without errors. * @param temp Temporary directory. @@ -72,7 +67,7 @@ void binarizesWithoutErrors(@TempDir final Path temp) throws Exception { } Assertions.assertDoesNotThrow( () -> maven.execute(new FakeMaven.Binarize()), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } @@ -87,7 +82,7 @@ void failsWithIncorrectInsert(@TempDir final Path temp) throws IOException { Assertions.assertThrows( IllegalStateException.class, () -> maven.execute(new FakeMaven.Binarize()), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } @@ -105,14 +100,14 @@ void savesToCache(@TempDir final Path temp) throws IOException { .execute(new FakeMaven.Binarize()) .result(); MatcherAssert.assertThat( - BinarizeMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasValue( cache.resolve("Lib") ) ); MatcherAssert.assertThat( - BinarizeMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.not( Matchers.hasValue( @@ -124,7 +119,7 @@ void savesToCache(@TempDir final Path temp) throws IOException { ); Assertions.assertDoesNotThrow( () -> maven.execute(new FakeMaven.Binarize()), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } @@ -147,7 +142,7 @@ void boostsSecondCompilation(@TempDir final Path temp) throws IOException { finish = System.currentTimeMillis(); final long second = finish - start; MatcherAssert.assertThat( - BinarizeMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, second, Matchers.lessThan(first) ); @@ -172,12 +167,12 @@ void doesNotRecompile(@TempDir final Path temp) throws IOException { maven.execute(new FakeMaven.Binarize()); final long second = executable.lastModified(); MatcherAssert.assertThat( - BinarizeMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, first, Matchers.not(0L) ); MatcherAssert.assertThat( - BinarizeMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, second, Matchers.equalTo(first) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeParseTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeParseTest.java index 58f35d0081..ff38088529 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeParseTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/BinarizeParseTest.java @@ -43,14 +43,20 @@ * Test case for {@link BinarizeParse}. * * @since 0.1 + * + * @todo #2297:60m Replace all appearances of {@link BinarizeParseTest#TO_ADD_MESSAGE} field in + * assertions with meaningful assert messages. Don't forget to remove + * {@link BinarizeParseTest#TO_ADD_MESSAGE} field and remove public modifier from this class if no + * longer need. */ +@SuppressWarnings("PMD.JUnit5TestShouldBePackagePrivate") @Execution(ExecutionMode.CONCURRENT) -final class BinarizeParseTest { +public final class BinarizeParseTest { /** - * Empty message for JUnit Assertions. + * Empty message for JUnit Assertions. To be removed. */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; + public static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @Test void parsesSimpleEoProgram(@TempDir final Path temp) throws Exception { diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/CatalogsTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/CatalogsTest.java index 3114191364..c5f134dd80 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/CatalogsTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/CatalogsTest.java @@ -54,7 +54,7 @@ final class CatalogsTest { void readsFromTojosConcurrently(@TempDir final Path tmp) { final Tojos tojos = Catalogs.INSTANCE.make(tmp.resolve("foreign"), "json"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new SumOf( new Threads<>( CatalogsTest.CORES, 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 3c463d6e77..2ed0f91802 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 @@ -54,7 +54,7 @@ void cleansSuccessfully(@TempDir final Path temp) throws IOException { .with("targetDir", dir.toFile()) .execute(CleanMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, !file.toFile().exists() && !small.toFile().exists(), Matchers.is(true) ); @@ -76,7 +76,7 @@ void makesFullCompilingLifecycleSuccessfully(@TempDir final Path temp) throws IO .execute(AssembleMojo.class) .execute(CleanMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, temp.resolve("target").toFile().exists(), Matchers.is(false) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/CopyMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/CopyMojoTest.java index 323c79fcca..46d247544a 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/CopyMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/CopyMojoTest.java @@ -57,12 +57,12 @@ void copiesSources(@TempDir final Path temp) throws Exception { .execute(CopyMojo.class); final Path out = classes.resolve("EO-SOURCES/foo/main.eo"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new HmBase(classes).exists(classes.relativize(out)), Matchers.is(true) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(new HmBase(classes).load(classes.relativize(out))).asString(), Matchers.allOf( Matchers.containsString("+rt foo:"), @@ -90,7 +90,7 @@ void skipsCopyMojo(@TempDir final Path temp) throws IOException { .execute(CopyMojo.class); final Path out = classes.resolve("EO-SOURCES/foo/main.eo"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new HmBase(classes).exists(classes.relativize(out)), Matchers.is(false) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/DepDirsTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/DepDirsTest.java index e71a0c9a4e..7b5273c527 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/DepDirsTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/DepDirsTest.java @@ -47,12 +47,12 @@ void findsDirs(@TempDir final Path temp) throws IOException { new HmBase(temp).save("", Paths.get("test/f.txt")); new HmBase(temp).save("", Paths.get("a/g")); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new DepDirs(temp), Matchers.contains(String.format("a%sb%1$sc%1$sf", File.separator)) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new DepDirs(temp), Matchers.iterableWithSize(1) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/DiscoverMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/DiscoverMojoTest.java index 45862b4f9a..4c41542bb1 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/DiscoverMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/DiscoverMojoTest.java @@ -89,12 +89,12 @@ void executesDiscoveryPhaseForCorrectEoPrograms( ); final Map first = json.removeFirst(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, dependencies, Matchers.equalTo(json.size()) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, String.valueOf(dependencies), Matchers.equalTo(first.get("discovered")) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/JavaFilesTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/JavaFilesTest.java index 05ed25a2cc..133fa77ebe 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/JavaFilesTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/JavaFilesTest.java @@ -66,7 +66,7 @@ void convertsXmirtoJavaSuccessfully(@TempDir final Path temp) throws Exception { Paths.get("sum.xmir") ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( new InputOf( new JavaFiles( @@ -86,7 +86,7 @@ void convertsXmirtoJavaWithoutJavaClasses(@TempDir final Path temp) throws Excep Paths.get("sum.xmir") ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new JavaFiles( temp.resolve("xml").resolve("sum.xmir"), temp.resolve("java") diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/LatexMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/LatexMojoTest.java index 134bd9629d..10439e4094 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/LatexMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/LatexMojoTest.java @@ -46,7 +46,7 @@ final class LatexMojoTest { @Test void generatesTexFile(@TempDir final Path temp) throws Exception { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new FakeMaven(temp) .withHelloWorld() .execute(new FakeMaven.Latex()) @@ -64,7 +64,7 @@ void generatesTexFile(@TempDir final Path temp) throws Exception { @Test void checksLastName() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, LatexMojo.last("foo.bar.hello"), Matchers.equalTo("hello") ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/LogFormatTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/LogFormatTest.java index 64902efac2..68d65e54d0 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/LogFormatTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/LogFormatTest.java @@ -78,7 +78,7 @@ void printsFormattedMessage(final Logs out) { @Test void matchesCorrectly() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, "16:02:08 [INFO] org.eolang.maven.LogFormatTest: Wake up, Neo...\n", Matchers.matchesPattern(LogFormatTest.FORMAT) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/MarkMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/MarkMojoTest.java index 3e8628f4aa..5b01625077 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/MarkMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/MarkMojoTest.java @@ -52,7 +52,7 @@ void extendsForeignWithNewObjects(@TempDir final Path temp) throws IOException { final FakeMaven maven = new FakeMaven(temp); maven.execute(MarkMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.foreignTojos() .all() .iterator() @@ -71,12 +71,12 @@ void updatesVersionIfItExists(@TempDir final Path temp) throws IOException { .withVersion("*.*.*"); maven.execute(MarkMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, foreign.all().iterator().next().version(), Matchers.equalTo(MarkMojoTest.VERSION) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, foreign.size(), Matchers.equalTo(1) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java index a81ea5a8ca..e0d7e0a06c 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java @@ -66,7 +66,7 @@ void checksPacks(final String pack) throws IOException { ); } MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, check.failures(), Matchers.empty() ); @@ -83,7 +83,7 @@ void skipsAlreadyOptimized(@TempDir final Path temp) throws IOException { final long mtime = path.toFile().lastModified(); maven.execute(OptimizeMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, path.toFile().lastModified(), Matchers.is(mtime) ); @@ -145,7 +145,7 @@ void getsAlreadyOptimizedResultsFromCache(@TempDir final Path temp) throws Excep .allTojosWithHash(() -> hash) .execute(new FakeMaven.Optimize()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new XMLDocument( new HmBase(temp).load( Paths.get( @@ -171,7 +171,7 @@ void savesOptimizedResultsToCache(@TempDir final Path temp) throws IOException { .allTojosWithHash(() -> hash) .execute(new FakeMaven.Optimize()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, cache.resolve(OptimizeMojo.OPTIMIZED) .resolve(hash) .resolve("foo/x/main.xmir").toFile(), @@ -188,14 +188,14 @@ void optimizesSuccessfully(@TempDir final Path temp) throws IOException { .execute(new FakeMaven.Optimize()) .result(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey( String.format("target/%s/foo/x/main/01-not-empty-atoms.xml", OptimizeMojo.STEPS) ) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey( String.format("target/%s/foo/x/main.%s", OptimizeMojo.DIR, TranspileMojo.EXT) @@ -221,7 +221,7 @@ void optimizesConcurrentlyWithLotsOfPrograms(@TempDir final Path temp) throws IO .result(); for (int program = 0; program < total; ++program) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey( String.format( @@ -238,7 +238,7 @@ void optimizesConcurrentlyWithLotsOfPrograms(@TempDir final Path temp) throws IO @Test void doesNotCrashesOnError(@TempDir final Path temp) throws Exception { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new FakeMaven(temp) .withProgram( "+package f\n", @@ -258,7 +258,7 @@ void doesNotCrashesOnError(@TempDir final Path temp) throws Exception { @Test void choosesTransformerFactoryOnce() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, TransformerFactory.newInstance().getClass(), Matchers.typeCompatibleWith(TransformerFactoryImpl.class) ); @@ -270,7 +270,7 @@ void choosesTransformerFactoryInConcurrentEnvironment() { .mapToObj(i -> TransformerFactory.newInstance().getClass()) .collect(Collectors.toList())) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, clazz, Matchers.typeCompatibleWith(TransformerFactoryImpl.class) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/ParseMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/ParseMojoTest.java index 0dbf434c52..a47c29091a 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/ParseMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/ParseMojoTest.java @@ -59,7 +59,7 @@ final class ParseMojoTest { void parsesSuccessfully(@TempDir final Path temp) throws Exception { final FakeMaven maven = new FakeMaven(temp); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.withHelloWorld() .execute(new FakeMaven.Parse()) .result(), @@ -68,7 +68,7 @@ void parsesSuccessfully(@TempDir final Path temp) throws Exception { ) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.foreign().getById("foo.x.main").exists("xmir"), Matchers.is(true) ); @@ -82,7 +82,7 @@ void failsOnTimeout(@TempDir final Path temp) { .withHelloWorld() .with("timeout", 0) .execute(InfiniteMojo.class), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } @@ -122,7 +122,7 @@ void parsesWithCache(@TempDir final Path temp) throws Exception { @Test void doesNotCrashesOnError(@TempDir final Path temp) throws Exception { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new FakeMaven(temp) .withProgram("something < is wrong here") .execute(new FakeMaven.Parse()) @@ -169,7 +169,7 @@ void parsesConcurrentlyWithLotsOfPrograms(@TempDir final Path temp) throws IOExc final Map res = maven.execute(new FakeMaven.Parse()).result(); for (int program = 0; program < total; ++program) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey( String.format( diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/PhiMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/PhiMojoTest.java index db407690ce..821aea909c 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/PhiMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/PhiMojoTest.java @@ -74,7 +74,7 @@ void convertsXmirsToPhiWithoutErrors(final String xmir, @TempDir final Path temp new HmBase(temp).save(xmir, Paths.get("target/2-optimize/test.xmir")); Assertions.assertDoesNotThrow( () -> maven.execute(PhiMojo.class), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/PlaceMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/PlaceMojoTest.java index 49a60902cd..4f87fa473b 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/PlaceMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/PlaceMojoTest.java @@ -49,11 +49,6 @@ @SuppressWarnings("PMD.TooManyMethods") final class PlaceMojoTest { - /** - * Empty message for JUnit Assertions. - */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; - /** * The default folder for placed binaries. */ @@ -73,17 +68,17 @@ void placesBinaries(@TempDir final Path temp) throws Exception { .execute(PlaceMojo.class) .result(); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey("target/classes/EObar/x.bin") ); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey("target/classes/org/eolang/f/x.a.class") ); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey("target/classes/org/eolang/t.txt") ); @@ -94,7 +89,7 @@ void skipsEoSources(@TempDir final Path temp) throws IOException { final String expected = String.format("%s/EObar/x.bin", CopyMojo.DIR); PlaceMojoTest.saveBinary(temp, expected); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new FakeMaven(temp) .execute(PlaceMojo.class) .result(), @@ -121,7 +116,7 @@ void placesOnlyClassesFromPackageThatHaveSources(@TempDir final Path temp) throw PlaceMojoTest.saveBinary(temp, binary); } MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new FakeMaven(temp) .with("placeBinariesThatHaveSources", true) .execute(PlaceMojo.class) @@ -157,7 +152,7 @@ void skipsAlreadyPlacedBinaries(@TempDir final Path temp) throws IOException { binary ).toFile().lastModified(); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new FakeMaven(temp) .withPlacedBinary( temp.resolve(PlaceMojoTest.TARGET_CLASSES).resolve(binary) @@ -181,12 +176,12 @@ void rewritesAlreadyPlacedBinaries(@TempDir final Path temp) throws Exception { final FakeMaven maven = new FakeMaven(temp).withPlacedBinary(path); maven.placed().unplaceAll(); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, maven.execute(PlaceMojo.class).result(), Matchers.hasValue(path) ); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, content, Matchers.is(new TextOf(path).asString()) ); @@ -196,7 +191,7 @@ void rewritesAlreadyPlacedBinaries(@TempDir final Path temp) throws Exception { void placesWithoutBinaries(@TempDir final Path temp) throws IOException { Files.createDirectories(temp.resolve("target").resolve(ResolveMojo.DIR)); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new FakeMaven(temp) .execute(PlaceMojo.class) .result(), @@ -207,7 +202,7 @@ void placesWithoutBinaries(@TempDir final Path temp) throws IOException { @Test void placesWithoutResolveDirectory(@TempDir final Path temp) throws IOException { MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new FakeMaven(temp) .execute(PlaceMojo.class) .result(), @@ -226,12 +221,12 @@ void placesMissing(@TempDir final Path temp) throws IOException { .execute(PlaceMojo.class) .result(); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasValue(PlaceMojoTest.pathToPlacedBinary(temp, first)) ); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasValue(PlaceMojoTest.pathToPlacedBinary(temp, second)) ); @@ -250,7 +245,7 @@ void placesMissing(@TempDir final Path temp) throws IOException { void placesAllEoRuntimeClasses(@TempDir final Path temp) throws IOException { final FakeMaven maven = new FakeMaven(temp); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, maven.withHelloWorld() .execute(new FakeMaven.Place()) .result() @@ -258,7 +253,7 @@ void placesAllEoRuntimeClasses(@TempDir final Path temp) throws IOException { new ContainsFiles("**/eo-runtime-*.jar") ); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, maven.placed().jars().size(), Matchers.is(1) ); @@ -268,7 +263,7 @@ void placesAllEoRuntimeClasses(@TempDir final Path temp) throws IOException { void placesWithoutEoRuntimeClasses(@TempDir final Path temp) throws IOException { final FakeMaven maven = new FakeMaven(temp); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, maven.withHelloWorld() .with("withRuntimeDependency", false) .execute(new FakeMaven.Place()) @@ -277,7 +272,7 @@ void placesWithoutEoRuntimeClasses(@TempDir final Path temp) throws IOException Matchers.not(new ContainsFiles("**/eo-runtime-*.jar")) ); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, maven.placed().jars().isEmpty(), Matchers.is(true) ); @@ -293,7 +288,7 @@ void doesNotPlacesAgainIfWasNotUnplaced(@TempDir final Path temp) throws Excepti PlaceMojoTest.saveBinary(temp, "new content", binary); maven.execute(PlaceMojo.class).result(); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(PlaceMojoTest.pathToPlacedBinary(temp, binary)).asString(), Matchers.equalTo(old) ); @@ -310,7 +305,7 @@ void placesAgainIfWasUnplaced(@TempDir final Path temp) throws Exception { maven.placed().unplaceAll(); maven.execute(PlaceMojo.class).result(); MatcherAssert.assertThat( - PlaceMojoTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(PlaceMojoTest.pathToPlacedBinary(temp, binary)).asString(), Matchers.equalTo(updated) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/PlaceTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/PlaceTest.java index 9bd7360c0d..4f461602e5 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/PlaceTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/PlaceTest.java @@ -39,7 +39,7 @@ final class PlaceTest { @Test void makesPath() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new Place("hello.foo.bar") .make(Paths.get("/tmp/test"), TranspileMojo.EXT) .toString() @@ -51,7 +51,7 @@ void makesPath() { @Test void makesSimplePath() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new Place("hey") .make(Paths.get("/tmp"), "xml") .toString() diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java index 6c15a65e40..56ae806619 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java @@ -80,7 +80,7 @@ void pullsSuccessfully(@TempDir final Path temp) throws IOException { maven.with("skip", false) .execute(PullMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, PullMojoTest.exists(temp, PullMojoTest.STDOUT), Matchers.is(true) ); @@ -110,7 +110,7 @@ void pullsFromProbes(@TempDir final Path temp) throws IOException { ) .execute(new FakeMaven.Pull()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, PullMojoTest.exists(temp, PullMojoTest.STDOUT), Matchers.is(true) ); @@ -133,7 +133,7 @@ void pullsUsingOfflineHashFile(@TempDir final Path temp) throws IOException { ) .execute(PullMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new LinkedList<>(new MnCsv(maven.foreignPath()).read()).getFirst().get("hash"), Matchers.equalTo("mmmmmmm") ); @@ -157,7 +157,7 @@ void pullsUsingOfflineHash(@TempDir final Path temp) throws IOException { ) .execute(PullMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new LinkedList<>(new MnCsv(maven.foreignPath()).read()).getFirst().get("hash"), Matchers.equalTo("abcdefg") ); @@ -173,7 +173,7 @@ void skipsPullMojo(@TempDir final Path temp) throws IOException { maven.with("skip", true) .execute(PullMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, PullMojoTest.exists(temp, PullMojoTest.STDOUT), Matchers.is(false) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/RegisterMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/RegisterMojoTest.java index 64e4f8bb47..4ef80d2518 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/RegisterMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/RegisterMojoTest.java @@ -60,7 +60,7 @@ void registersOkNames(@TempDir final Path temp) throws IOException { .with(RegisterMojoTest.PARAM, temp.resolve(RegisterMojoTest.SOURCES).toFile()) .execute(new FakeMaven.Register()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.foreign().getById("org.eolang.maven.abc-def").exists("id"), Matchers.is(true) ); @@ -81,7 +81,7 @@ void failsWithDotNames(@TempDir final Path temp) throws IOException { } ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, exception.getCause().getCause().getMessage(), Matchers.containsString("Incorrect name found: '.abc.eo'") ); @@ -98,7 +98,7 @@ void doesNotFailWhenNoStrictNames(@TempDir final Path temp) throws IOException { .with("strictFileNames", false) .execute(new FakeMaven.Register()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.foreign().getById("org.eolang.maven..abc").exists("id"), Matchers.is(true) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/ResolveMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/ResolveMojoTest.java index 40d7e3f1e5..15d6dd5b1c 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/ResolveMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/ResolveMojoTest.java @@ -62,12 +62,12 @@ void resolvesWithSingleDependency(@TempDir final Path temp) throws IOException { .resolve(ResolveMojo.DIR) .resolve("org.eolang/eo-runtime/-/0.7.0"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, path.toFile(), FileMatchers.anExistingDirectory() ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, path.resolve("eo-runtime-0.7.0.jar").toFile(), FileMatchers.anExistingFile() ); @@ -88,12 +88,12 @@ void resolvesWithoutAnyDependencies(@TempDir final Path temp) throws IOException .resolve(ResolveMojo.DIR) .resolve("org.eolang/eo-runtime/-/"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, path.toFile(), FileMatchers.anExistingDirectory() ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, path, new ContainsFiles("**/eo-runtime-*.jar") ); @@ -104,7 +104,7 @@ void resolvesWithEoRuntimeDependency(@TempDir final Path temp) throws IOExceptio final FakeMaven maven = new FakeMaven(temp); maven.withHelloWorld().execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.targetPath(), new ContainsFiles("**/eo-runtime-*.jar") ); @@ -117,7 +117,7 @@ void resolvesWithoutEoRuntimeDependency(@TempDir final Path temp) throws IOExcep .with("withRuntimeDependency", false) .execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.targetPath(), Matchers.not(new ContainsFiles("**/eo-runtime-*.jar")) ); @@ -130,7 +130,7 @@ void resolvesIfRuntimeDependencyComesFromTojos(@TempDir final Path temp) throws .withProgram("+rt jvm org.eolang:eo-runtime:0.22.1", "", "[] > main") .execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.targetPath(), new ContainsFiles("**/eo-runtime-0.22.1.jar") ); @@ -145,7 +145,7 @@ void resolvesIfRuntimeDependencyComesFromTojosButParamIsFalse(@TempDir final Pat .with("withRuntimeDependency", false) .execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.targetPath(), Matchers.not(new ContainsFiles("**/eo-runtime-*.jar")) ); @@ -164,7 +164,7 @@ void resolvesWithRuntimeDependencyFromPom(@TempDir final Path temp) throws IOExc .with("project", project) .execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.targetPath(), new ContainsFiles("**/eo-runtime-0.7.0.jar") ); @@ -181,7 +181,7 @@ void resolvesWithoutTransitiveDependencies(@TempDir final Path temp) throws IOEx ) .execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.targetPath(), new ContainsFiles("**/eo-runtime-*.jar") ); @@ -210,7 +210,7 @@ void throwsExceptionWithTransitiveDependency(@TempDir final Path temp) { ) ) .execute(new FakeMaven.Resolve()), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } @@ -240,7 +240,7 @@ void resolvesWithConflictingDependencies(@TempDir final Path temp) throws IOExce () -> maven.execute(new FakeMaven.Resolve()) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, excpt.getCause().getCause().getMessage(), Matchers.containsString( "1 conflicting dependencies are found: {org.eolang:eo-runtime:jar:=[0.22.0, 0.22.1]}" @@ -267,7 +267,7 @@ void resolvesWithConflictingDependenciesNoFail(@TempDir final Path temp) throws maven.with("ignoreVersionConflicts", true) .execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.targetPath(), new ContainsFiles("**/eo-runtime-*.jar") ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/SafeMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/SafeMojoTest.java index 59f7562cb4..c2585de20b 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/SafeMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/SafeMojoTest.java @@ -46,10 +46,10 @@ void logsStackTrace(final Logs out, @TempDir final Path temp) { () -> new FakeMaven(temp) .withProgram("something > is definitely wrong here") .execute(new FakeMaven.Parse()), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, String.join("\n", out.captured()), Matchers.containsString("Failed to parse") ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/SodgMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/SodgMojoTest.java index 1fa93d0655..7ac7ad429c 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/SodgMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/SodgMojoTest.java @@ -70,7 +70,7 @@ void convertsToGraph() throws Exception { } final XML graph = SodgMojoTest.toGraph(program.toString(), "**"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, ".foo .foo", new SodgMojoTest.ExistsIn(graph) ); @@ -80,7 +80,7 @@ void convertsToGraph() throws Exception { @ClasspathSource(value = "org/eolang/maven/sodg-packs", glob = "**.yaml") void transformsThroughSheets(final String yaml) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new XaxStory(yaml), Matchers.is(true) ); @@ -114,7 +114,7 @@ void generatesSodgForPacks(final String pack) throws Exception { for (final String loc : (Iterable) map.get("locators")) { assertions.add( () -> MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, loc, new SodgMojoTest.ExistsIn(graph) ) diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java index 2f4c034047..c669fbf43c 100755 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java @@ -76,7 +76,7 @@ void setUp() throws Exception { @ClasspathSource(value = "org/eolang/maven/pre/", glob = "**.yaml") void createsPreStylesheets(final String yaml) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new XaxStory(yaml), Matchers.is(true) ); @@ -92,13 +92,13 @@ void recompilesIfModified(@TempDir final Path temp) throws IOException { final Path java = res.get(this.compiled); final long before = java.toFile().lastModified(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, res.get("foo/x/main.eo").toFile().setLastModified(before + 1L), Matchers.is(true) ); maven.execute(TranspileMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, java.toFile().lastModified(), Matchers.greaterThan(before) ); @@ -116,22 +116,22 @@ void recompilesIfExpired(@TempDir final Path temp) throws IOException { String.format("target/%s/foo/x/main.xmir", TranspileMojo.DIR) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, java.toFile(), FileMatchers.anExistingFile() ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, xmir.toFile(), FileMatchers.anExistingFile() ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, java.toFile().setLastModified(0L), Matchers.is(true) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, xmir.toFile().setLastModified(0L), Matchers.is(true) ); @@ -139,12 +139,12 @@ void recompilesIfExpired(@TempDir final Path temp) throws IOException { maven.execute(TranspileMojo.class); final long after = java.toFile().lastModified(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, after, Matchers.greaterThan(0L) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, before, Matchers.not(Matchers.equalTo(after)) ); @@ -158,18 +158,18 @@ void doesNotRetranspileIfNotModified(@TempDir final Path temp) throws IOExceptio .execute(new FakeMaven.Transpile()) .result().get(this.compiled); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, java.toFile(), FileMatchers.anExistingFile() ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, java.toFile().setLastModified(0L), Matchers.is(true) ); maven.execute(TranspileMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, java.toFile().lastModified(), Matchers.is(0L) ); @@ -184,11 +184,11 @@ void transpilesSimpleEoProgram(@TempDir final Path temp) throws Exception { .result(); final String java = "target/generated/EOorg/EOeolang/EOtuple.java"; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey(java) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(res.get(java)).asString(), Matchers.containsString("class EOtuple") ); @@ -203,7 +203,7 @@ void transpilesSeveralEoProgramsInParallel(@TempDir final Path temp) throws IOEx } maven.execute(new FakeMaven.Transpile()).result(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, Files.list(maven.generatedPath() .resolve("EOorg") .resolve("EOeolang") @@ -233,7 +233,7 @@ void transpilesSourcesForDifferentScopesWithoutIntersections( .withProgram(this.program) .execute(new FakeMaven.Transpile()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.foreign().size(), Matchers.equalTo(2) ); @@ -259,7 +259,7 @@ void transpilesAndCleansGarbageFromDirtyDependency(@TempDir final Path temp) .withHelloWorld() .execute(new FakeMaven.Transpile()); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, maven.targetPath().resolve(binary).toFile(), Matchers.not(FileMatchers.anExistingFile()) ); @@ -277,7 +277,7 @@ void throwsExpectionIfWasNotVerified( .execute(OptimizeMojo.class) .execute(ShakeMojo.class) .execute(TranspileMojo.class), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); Assertions.assertTrue( out.captured().stream().anyMatch( diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceMojoTest.java index 9206e6726c..8acefe97cb 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceMojoTest.java @@ -68,7 +68,7 @@ void cleansClasses(@TempDir final Path temp) throws IOException { UnplaceMojoTest.placeClass(temp, UnplaceMojoTest.clazz(temp)); final Path placed = UnplaceMojoTest.placeClass(temp, UnplaceMojoTest.clazz(temp)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new FakeMaven(temp) .with("placed", placed.toFile()) .execute(UnplaceMojo.class) @@ -92,12 +92,12 @@ void cleansBinariesWithJar(@TempDir final Path temp) throws IOException { .with("placed", placed.toFile()) .execute(UnplaceMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, tojos.size(), Matchers.equalTo(5) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, tojos.stream().allMatch(PlacedTojo::unplaced), Matchers.is(true) ); @@ -116,12 +116,12 @@ void keepsJarBecauseItIsStillInUse(@TempDir final Path temp) throws IOException .with("placed", placed.toFile()) .execute(UnplaceMojo.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, tojos.size(), Matchers.equalTo(5) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, tojos.stream() .filter(tojo -> tojo.identifier().equals(other)) .allMatch(PlacedTojo::placed), @@ -139,12 +139,12 @@ void unplacesWithKeepAndRemoveBinariesParamTogether(@TempDir final Path temp) th .execute(UnplaceMojo.class) .result(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, res.values().stream().noneMatch(UnplaceMojoTest::isClass), Matchers.is(true) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(res.get(placed.getFileName().toString())).asString(), Matchers.allOf( Matchers.not(Matchers.containsString("false")), @@ -162,12 +162,12 @@ void unplacesWithRemoveBinariesParam(@TempDir final Path temp) throws Exception .execute(UnplaceMojo.class) .result(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, res.values().stream().noneMatch(UnplaceMojoTest::isClass), Matchers.is(true) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(res.get(placed.getFileName().toString())).asString(), Matchers.allOf( Matchers.not(Matchers.containsString("false")), @@ -185,12 +185,12 @@ void unplacesWithKeepBinariesParam(@TempDir final Path temp) throws Exception { .execute(UnplaceMojo.class) .result(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, res.values().stream().anyMatch(UnplaceMojoTest::isClass), Matchers.is(true) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(res.get(placed.getFileName().toString())).asString(), Matchers.allOf( Matchers.containsString("false"), diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceTest.java index 8a31137e45..06308547bf 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceTest.java @@ -47,7 +47,7 @@ void makesName( final String name ) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new Unplace(Paths.get(base)).make( Paths.get(source) ), diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java index 512ab01b3b..a4caff7ff3 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java @@ -195,7 +195,7 @@ void failsOptimizationOnCritical(@TempDir final Path temp) { " FALSE > x" ).with("trackOptimizationSteps", true) .execute(new FakeMaven.Verify()), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsDepgraphTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsDepgraphTest.java index 0d8371e82e..8fa62c2403 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsDepgraphTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsDepgraphTest.java @@ -28,6 +28,7 @@ import java.nio.file.Paths; import org.cactoos.io.ResourceOf; import org.cactoos.scalar.LengthOf; +import org.eolang.maven.BinarizeParseTest; import org.eolang.maven.util.HmBase; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -53,7 +54,7 @@ void readsAllDependenciesFromJsonFile( @TempDir final Path tmp ) throws Exception { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new LengthOf(new DcsDepgraph.DcsJson(this.file(tmp, name))).value(), Matchers.equalTo(number) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsEachWithoutTransitiveTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsEachWithoutTransitiveTest.java index 9e222175c4..b2b1d16ce1 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsEachWithoutTransitiveTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsEachWithoutTransitiveTest.java @@ -27,6 +27,7 @@ import java.util.stream.Collectors; import org.apache.maven.model.Dependency; import org.cactoos.list.ListOf; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.Matcher; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -48,7 +49,7 @@ void failsIfHasTransitiveDependencies() { new DcsFake(), dep -> new DcsFake(100) ).iterator().next(), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } @@ -56,7 +57,7 @@ void failsIfHasTransitiveDependencies() { void keepsDependenciesThatHaveTeStDependenciesAsTransitive() { final DcsFake original = new DcsFake(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new DcsEachWithoutTransitive( original, dep -> Collections.singleton(DcsFake.randDep("test")) @@ -69,7 +70,7 @@ void keepsDependenciesThatHaveTeStDependenciesAsTransitive() { void keepsDependencyThatHasTheSameDependencyAsTransitive() { final DcsFake original = new DcsFake(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new DcsEachWithoutTransitive( original, DcsFake::new @@ -82,7 +83,7 @@ void keepsDependencyThatHasTheSameDependencyAsTransitive() { void keepsDependencyThatHasRuntimeDependencyAsTransitive() { final DcsFake original = new DcsFake(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new DcsEachWithoutTransitive( original, dep -> Collections.singleton(DcsFake.runtimeDep()) diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsWithRuntimeTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsWithRuntimeTest.java index 877b1ee966..9ced089e3b 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsWithRuntimeTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/dependencies/DcsWithRuntimeTest.java @@ -24,6 +24,7 @@ package org.eolang.maven.dependencies; import com.yegor256.WeAreOnline; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -40,7 +41,7 @@ final class DcsWithRuntimeTest { @ExtendWith(WeAreOnline.class) void addsHardcodedVersionOfRuntimeDependency() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new DcsWithRuntime( new DcsFake(5), DcsFake.runtimeDep() @@ -53,7 +54,7 @@ void addsHardcodedVersionOfRuntimeDependency() { @ExtendWith(WeAreOnline.class) void addsRemoteVersionOfRuntimeDependency() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new DcsWithRuntime( new DcsFake(2) ), diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/CacheVersionTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/CacheVersionTest.java index d2312ff6a7..54f4bac0d6 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/CacheVersionTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/CacheVersionTest.java @@ -25,6 +25,7 @@ import java.io.File; import java.nio.file.Paths; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.params.ParameterizedTest; @@ -56,7 +57,7 @@ void checksIfVersionIsCacheable( final boolean expected ) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new CacheVersion(version, hash).cacheable(), Matchers.is(expected) ); @@ -82,7 +83,7 @@ void returnsCorrectCachePath( final String expected ) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new CacheVersion(version, hash).path(), Matchers.equalTo(Paths.get(expected.replace("|", File.separator))) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/FtCachedTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/FtCachedTest.java index 5989737993..6587263bde 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/FtCachedTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/FtCachedTest.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.nio.file.Path; import org.cactoos.Scalar; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.hamcrest.io.FileMatchers; @@ -38,11 +39,6 @@ */ final class FtCachedTest { - /** - * Empty message for JUnit Assertions. - */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; - /** * Default content. */ @@ -69,12 +65,12 @@ void loadsContentOfCachedFile(@TempDir final Path temp) throws Exception { final String program = "org.eolang.txt.format"; cached.save(program, FtCachedTest.EXTENSION, FtCachedTest.CONTENT); MatcherAssert.assertThat( - FtCachedTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, cached.load(program, FtCachedTest.EXTENSION), Matchers.equalTo(FtCachedTest.CONTENT.value()) ); MatcherAssert.assertThat( - FtCachedTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, temp.resolve(FtCachedTest.CACHE).toFile(), FileMatchers.anExistingDirectory() ); @@ -86,12 +82,12 @@ void loadsContentOfRealFileCachingDoesNotWork(@TempDir final Path temp) throws E final String program = "org.eolang.txt.regex"; cached.save(program, FtCachedTest.EXTENSION, FtCachedTest.CONTENT); MatcherAssert.assertThat( - FtCachedTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, cached.load(program, FtCachedTest.EXTENSION), Matchers.equalTo(FtCachedTest.CONTENT.value()) ); MatcherAssert.assertThat( - FtCachedTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, temp.resolve(FtCachedTest.CACHE).toFile(), Matchers.not(FileMatchers.anExistingFileOrDirectory()) ); @@ -102,7 +98,7 @@ void returnsListOfSavedFilesFromDelegate(@TempDir final Path temp) throws IOExce final Footprint footprint = FtCachedTest.footprint("0.22.1", temp); footprint.save("prog", FtCachedTest.EXTENSION, FtCachedTest.CONTENT); MatcherAssert.assertThat( - FtCachedTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, footprint.list(FtCachedTest.EXTENSION), Matchers.hasItem(temp.resolve(FtCachedTest.TARGET).resolve("prog.xmir")) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/FtDefaultTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/FtDefaultTest.java index 9c2a4e0a47..b529935474 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/FtDefaultTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/FtDefaultTest.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.nio.file.Path; import org.cactoos.Scalar; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -53,7 +54,7 @@ void loadsContentOfNoCacheFile(@TempDir final Path temp) throws Exception { final Path target = temp.resolve("target"); new FtDefault(target).save(program, FtDefaultTest.XMIR, FtDefaultTest.CONTENT); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new FtDefault(target).load(program, FtDefaultTest.XMIR), Matchers.equalTo(FtDefaultTest.CONTENT.value()) ); @@ -68,7 +69,7 @@ void returnsListOfSavedFilesWithoutDirectory(@TempDir final Path temp) throws IO footprint.save("org.eolang.dir.sub", "o", FtDefaultTest.CONTENT); final Path subfolder = temp.resolve("org").resolve("eolang"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, footprint.list("xmir"), Matchers.containsInAnyOrder( subfolder.resolve("a.xmir"), @@ -76,7 +77,7 @@ void returnsListOfSavedFilesWithoutDirectory(@TempDir final Path temp) throws IO ) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, footprint.list("o"), Matchers.containsInAnyOrder( subfolder.resolve("c.o"), @@ -84,7 +85,7 @@ void returnsListOfSavedFilesWithoutDirectory(@TempDir final Path temp) throws IO ) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, footprint.list("org"), Matchers.empty() ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChCachedTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChCachedTest.java index 1e18c20909..641835ac76 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChCachedTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChCachedTest.java @@ -24,6 +24,7 @@ package org.eolang.maven.hash; import java.util.concurrent.atomic.AtomicInteger; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -46,13 +47,13 @@ void cachesHashAndInvokesDelegateOnlyOnce() { ); for (int idx = 0; idx < 10; ++idx) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, cached.value(), Matchers.equalTo("dummy") ); } MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, invocations.get(), Matchers.equalTo(1) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChNarrowTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChNarrowTest.java index cbd119fae8..8198928096 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChNarrowTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChNarrowTest.java @@ -23,6 +23,7 @@ */ package org.eolang.maven.hash; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Assertions; @@ -62,7 +63,7 @@ void throwsExceptionIfEmpty() { Assertions.assertThrows( IllegalArgumentException.class, () -> new ChNarrow(new CommitHash.ChConstant("")).value(), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChPatternTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChPatternTest.java index c08f28ae6f..5fb64a6fcb 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChPatternTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChPatternTest.java @@ -23,6 +23,7 @@ */ package org.eolang.maven.hash; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.params.ParameterizedTest; @@ -63,7 +64,7 @@ void returnsCorrectHashByPattern( final String expected ) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new ChPattern(pattern, tag).value(), Matchers.equalTo(expected) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java index b052fa8a70..7e3c048a9d 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java @@ -25,6 +25,7 @@ package org.eolang.maven.hash; import com.yegor256.WeAreOnline; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Assertions; @@ -42,7 +43,7 @@ final class ChRemoteTest { void getsCommitHashTag() { final String hash = new ChRemote("0.26.0").value(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, hash, Matchers.equalTo("e0b783692ef749bb184244acb2401f551388a328") ); @@ -52,7 +53,7 @@ void getsCommitHashTag() { void getsCommitHashOldTag() { final String hash = new ChRemote("0.23.19").value(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, hash, Matchers.equalTo("4b19944d86058e3c81e558340a3a13bc335a2b48") ); @@ -63,7 +64,7 @@ void throwsCommitHashException() { Assertions.assertThrows( ChText.NotFound.class, () -> new ChRemote("nonsense").value(), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChTextTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChTextTest.java index 7f23ef2f03..ad1e6c91bf 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChTextTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChTextTest.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.nio.file.Path; import org.cactoos.io.ResourceOf; +import org.eolang.maven.BinarizeParseTest; import org.eolang.maven.util.HmBase; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -85,7 +86,7 @@ void readsCorrectHashByTagFromFile( final String tag ) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new ChText(ChTextTest.file, tag).value(), Matchers.equalTo(hash) ); @@ -94,7 +95,7 @@ void readsCorrectHashByTagFromFile( @Test void readsCorrectHashByTagFromSimpleString() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new ChText( () -> "434868a411b9741fdd4f8a38a5c576e8733345c9 gh-pages", "gh-pages" @@ -111,7 +112,7 @@ void readsHashByNonExistedTag() { () -> "434868a411b9741fdd4f8a38a5c576e8733345c9 gh-pages", "non-existent-tag" ).value(), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/ObjectsIndexTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/ObjectsIndexTest.java index 0cab421497..8199dd28cc 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/ObjectsIndexTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/ObjectsIndexTest.java @@ -27,6 +27,7 @@ import java.util.Collections; import java.util.concurrent.atomic.AtomicInteger; import org.cactoos.scalar.ScalarOf; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -39,11 +40,6 @@ */ final class ObjectsIndexTest { - /** - * Empty message for JUnit Assertions. - */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; - @Test void contains() throws Exception { final AtomicInteger calls = new AtomicInteger(0); @@ -57,22 +53,22 @@ void contains() throws Exception { ) ); MatcherAssert.assertThat( - ObjectsIndexTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, index.contains(object), Matchers.is(true) ); MatcherAssert.assertThat( - ObjectsIndexTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, index.contains(object), Matchers.is(true) ); MatcherAssert.assertThat( - ObjectsIndexTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, index.contains("unknown"), Matchers.is(false) ); MatcherAssert.assertThat( - ObjectsIndexTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, calls.get(), Matchers.is(1) ); @@ -82,7 +78,7 @@ void contains() throws Exception { @ExtendWith(WeAreOnline.class) void downloadsAndChecksFromRealSource() throws Exception { MatcherAssert.assertThat( - ObjectsIndexTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new ObjectsIndex().contains("org.eolang.io.stdout"), Matchers.is(true) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyCachingTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyCachingTest.java index 14b0a55d66..30729a6aef 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyCachingTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyCachingTest.java @@ -27,6 +27,7 @@ import java.nio.file.Paths; import org.cactoos.io.InputOf; import org.cactoos.text.TextOf; +import org.eolang.maven.BinarizeParseTest; import org.eolang.maven.util.HmBase; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -45,7 +46,7 @@ final class OyCachingTest { void putsObjectToLocalCache(@TempDir final Path path) throws Exception { final String content = "[] > main\n"; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( new OyCaching( "master", @@ -59,7 +60,7 @@ void putsObjectToLocalCache(@TempDir final Path path) throws Exception { path.resolve("pulled/master/org/example/main.eo") .toFile() .exists(), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } @@ -70,7 +71,7 @@ void checksPresenceOfObject(@TempDir final Path path) throws Exception { Paths.get("pulled/master/org/example/main.eo") ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new OyCaching( "master", path, diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyEmptyTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyEmptyTest.java index 3e9880ed15..6fa419a2b7 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyEmptyTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyEmptyTest.java @@ -24,6 +24,7 @@ package org.eolang.maven.objectionary; import java.io.IOException; +import org.eolang.maven.BinarizeParseTest; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -39,7 +40,7 @@ void resolvesObject() { Assertions.assertThrows( IOException.class, () -> new OyEmpty().get("org.eolang.io.stdin"), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } @@ -48,7 +49,7 @@ void checksPresenceOfObject() { Assertions.assertThrows( IOException.class, () -> new OyEmpty().contains("org.eolang.io.stdin"), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackSwapTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackSwapTest.java index 2cbf2ed1f5..2c1dc82b6d 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackSwapTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackSwapTest.java @@ -27,6 +27,7 @@ import java.nio.file.Path; import org.cactoos.io.InputOf; import org.cactoos.text.TextOf; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -35,21 +36,13 @@ /** * Tests for {@link OyFallbackSwap}. * @since 1.0 - * - * @todo #2297:60m Replace all appearances of TO_ADD_MESSAGE variable or "TO ADD ASSERTION MESSAGE" - * strings in assertions with meaningful assert messages. Don't forget to remove the puzzle. */ final class OyFallbackSwapTest { - /** - * Empty message for JUnit Assertions. - */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; - @Test void getsWithFallbackNoSwapOy() throws Exception { MatcherAssert.assertThat( - OyFallbackSwapTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( new OyFallbackSwap( new Objectionary.Fake(s -> new InputOf("[] > local\n")), @@ -64,7 +57,7 @@ void getsWithFallbackNoSwapOy() throws Exception { @Test void getsWithFallbackSwapOyFail() throws Exception { MatcherAssert.assertThat( - OyFallbackSwapTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( new OyFallbackSwap( new Objectionary.Fake(s -> new InputOf("[] > local\n")), @@ -83,7 +76,7 @@ void getsWithFallbackSwapOyFail() throws Exception { @Test void getsWithFallbackSwapOy() throws Exception { MatcherAssert.assertThat( - OyFallbackSwapTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( new OyFallbackSwap( new Objectionary.Fake(s -> new InputOf("[] > local\n")), @@ -110,7 +103,7 @@ void checksPresenceOfObject(@TempDir final Path path) throws Exception { ) ); MatcherAssert.assertThat( - OyFallbackSwapTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new OyFallbackSwap( home, cache, @@ -119,7 +112,7 @@ void checksPresenceOfObject(@TempDir final Path path) throws Exception { Matchers.is(false) ); MatcherAssert.assertThat( - OyFallbackSwapTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( new OyFallbackSwap( home, @@ -130,7 +123,7 @@ void checksPresenceOfObject(@TempDir final Path path) throws Exception { Matchers.is(Matchers.notNullValue()) ); MatcherAssert.assertThat( - OyFallbackSwapTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new OyFallbackSwap( home, cache, diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackTest.java index f8864c4d18..93ef0b4c36 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackTest.java @@ -28,6 +28,7 @@ import org.cactoos.Input; import org.cactoos.io.InputOf; import org.cactoos.text.TextOf; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.BeforeEach; @@ -40,11 +41,6 @@ */ final class OyFallbackTest { - /** - * Empty message for JUnit Assertions. - */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; - /** * Primary objectionary. */ @@ -68,17 +64,17 @@ void setUp() { @Test void getsObjectWhenPrimaryContains() throws Exception { MatcherAssert.assertThat( - OyFallbackTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(this.fallback.get("org.example.main")).asString(), Matchers.equalTo(this.primary.source) ); MatcherAssert.assertThat( - OyFallbackTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.primary.invocations.get(), Matchers.equalTo(1) ); MatcherAssert.assertThat( - OyFallbackTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.secondary.invocations.get(), Matchers.equalTo(0) ); @@ -87,17 +83,17 @@ void getsObjectWhenPrimaryContains() throws Exception { @Test void getsObjectWhenPrimaryNotContains() throws Exception { MatcherAssert.assertThat( - OyFallbackTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(this.fallback.get("org.example.secondary")).asString(), Matchers.equalTo(this.secondary.source) ); MatcherAssert.assertThat( - OyFallbackTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.primary.invocations.get(), Matchers.equalTo(1) ); MatcherAssert.assertThat( - OyFallbackTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.secondary.invocations.get(), Matchers.equalTo(1) ); @@ -106,22 +102,22 @@ void getsObjectWhenPrimaryNotContains() throws Exception { @Test void containsObject() throws IOException { MatcherAssert.assertThat( - OyFallbackTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.fallback.contains("org.example.main"), Matchers.is(true) ); MatcherAssert.assertThat( - OyFallbackTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.fallback.contains("org.example.absent"), Matchers.is(false) ); MatcherAssert.assertThat( - OyFallbackTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.primary.invocations.get(), Matchers.equalTo(2) ); MatcherAssert.assertThat( - OyFallbackTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.secondary.invocations.get(), Matchers.equalTo(1) ); @@ -130,7 +126,7 @@ void containsObject() throws IOException { @Test void convertsToString() { MatcherAssert.assertThat( - OyFallbackTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.fallback.toString(), Matchers.equalTo(String.format("[%s]+[fallback to %s]", this.primary, this.secondary)) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFilesystemTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFilesystemTest.java index 7676f9b9f2..ef1c75799b 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFilesystemTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFilesystemTest.java @@ -32,6 +32,7 @@ import java.util.Arrays; import org.cactoos.io.InputOf; import org.cactoos.text.TextOf; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Assertions; @@ -56,7 +57,7 @@ void containsObject(@TempDir final Path home) throws IOException { final String object = "org.eolang.found"; OyFilesystemTest.save(object, home); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, objectionary.contains(object), Matchers.is(true) ); @@ -68,7 +69,7 @@ void containsObjectWithDefaultHome(@TempDir final Path home) throws IOException final String object = "org.eolang.malloc"; OyFilesystemTest.save(object, home); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, objectionary.contains(object), Matchers.is(true) ); @@ -94,7 +95,7 @@ void getsObjectSuccessfully(@TempDir final Path home) throws IOException { final String object = "org.eolang.get"; OyFilesystemTest.save(object, home); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(objectionary.get(object)), Matchers.equalTo(new TextOf(new InputOf(OyFilesystemTest.OBJECT_CONTENT))) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyHomeTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyHomeTest.java index c7ad05afbb..04708f2274 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyHomeTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyHomeTest.java @@ -26,6 +26,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import org.cactoos.text.TextOf; +import org.eolang.maven.BinarizeParseTest; import org.eolang.maven.util.HmBase; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -47,7 +48,7 @@ void resolvesObjectInLocalStorage(@TempDir final Path path) throws Exception { Paths.get("pulled/master/org/example/main.eo") ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( new OyHome("master", path) .get("org.example.main") @@ -64,7 +65,7 @@ void checksPresenceOfObjectInLocalStorage(@TempDir final Path path) throws Excep Paths.get("pulled/master/org/example/main.eo") ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( new OyHome("master", path) .get("org.example.main") @@ -72,7 +73,7 @@ void checksPresenceOfObjectInLocalStorage(@TempDir final Path path) throws Excep Matchers.is(content) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new OyHome("master", path) .contains("org.example.main"), Matchers.is(true) diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyIndexedTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyIndexedTest.java index 5c7e02f0c3..930e2ab55f 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyIndexedTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyIndexedTest.java @@ -27,6 +27,7 @@ import java.io.IOException; import java.util.Collections; import org.cactoos.text.TextOf; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -47,7 +48,7 @@ final class OyIndexedTest { @Test void getsFromDelegate() throws Exception { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(new OyIndexed(new Objectionary.Fake()).get("foo")).asString(), Matchers.equalTo( "# This is the default 64+ symbols comment in front of named abstract object.\n[] > sprintf\n" @@ -59,7 +60,7 @@ void getsFromDelegate() throws Exception { @ExtendWith(WeAreOnline.class) void containsInRealIndex() throws IOException { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new OyIndexed(new Objectionary.Fake()).contains(OyIndexedTest.STDOUT_OBJECT), Matchers.is(true) ); @@ -68,7 +69,7 @@ void containsInRealIndex() throws IOException { @Test void containsInFakeIndex() throws IOException { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new OyIndexed( new Objectionary.Fake(), new ObjectsIndex(() -> Collections.singleton(OyIndexedTest.STDOUT_OBJECT)) @@ -80,7 +81,7 @@ void containsInFakeIndex() throws IOException { @Test void checksContainsInDelegateIfExceptionHappensInIndex() throws IOException { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new OyIndexed( new Objectionary.Fake(), new ObjectsIndex( diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyRemoteTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyRemoteTest.java index 9535dddc21..09396c538c 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyRemoteTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyRemoteTest.java @@ -27,6 +27,7 @@ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import org.eolang.maven.BinarizeParseTest; import org.eolang.maven.hash.ChNarrow; import org.eolang.maven.hash.ChRemote; import org.eolang.maven.hash.CommitHash; @@ -65,7 +66,7 @@ void throwsExceptionOnInvalidUrl() { "hts:raw.githubusercontent.com/objectionary/home/%s/objects/%s.eo", "abcde" ).value("org.eolang.app"), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/rust/ModuleTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/rust/ModuleTest.java index 314f541105..12b739d136 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/rust/ModuleTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/rust/ModuleTest.java @@ -26,6 +26,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import org.cactoos.text.TextOf; +import org.eolang.maven.BinarizeParseTest; import org.eolang.maven.footprint.FtDefault; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -45,7 +46,7 @@ void savesCorrectly(@TempDir final Path temp) throws Exception { final Module module = new Module(content, name); module.save(new FtDefault(temp)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( temp.resolve(Paths.get(name.concat(".rs"))) ).asString(), diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/rust/NamesTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/rust/NamesTest.java index 2fc7ba667c..e54a51239a 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/rust/NamesTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/rust/NamesTest.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.stream.Collectors; import java.util.stream.IntStream; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -46,12 +47,12 @@ void solvesSameHashes(@TempDir final Path temp) { final String one = "AaAaAa"; final String two = "AaAaBB"; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, one.hashCode(), Matchers.equalTo(two.hashCode()) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, dispatcher.name(one), Matchers.not( dispatcher.name(two) @@ -70,14 +71,14 @@ void recoversNames(@TempDir final Path temp) throws IOException { Collectors.toMap(loc -> loc, before::name) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, locations.size(), Matchers.equalTo(functions.size()) ); before.save(); final Names after = new Names(temp.resolve(names)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, before, Matchers.equalTo(after) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/rust/NativeTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/rust/NativeTest.java index 8770488ed7..5e56595c7a 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/rust/NativeTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/rust/NativeTest.java @@ -26,6 +26,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import org.cactoos.text.TextOf; +import org.eolang.maven.BinarizeParseTest; import org.eolang.maven.footprint.FtDefault; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -45,7 +46,7 @@ void savesCorrectly(@TempDir final Path temp) throws Exception { final Native java = new Native("name", target.toString()); java.save(new FtDefault(temp.resolve(target))); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( temp.resolve(target.resolve("name.java")) ).asString(), diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/rust/PrimeModuleTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/rust/PrimeModuleTest.java index 2793a97ca0..b7b64fa897 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/rust/PrimeModuleTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/rust/PrimeModuleTest.java @@ -26,6 +26,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import org.cactoos.text.TextOf; +import org.eolang.maven.BinarizeParseTest; import org.eolang.maven.footprint.FtDefault; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -44,7 +45,7 @@ void savesCorrectly(@TempDir final Path temp) throws Exception { final String name = "name"; new PrimeModule(method, name).save(new FtDefault(temp)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( temp.resolve(Paths.get(name.concat(".rs"))) ).asString(), diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java index 69632ad5de..85f288121d 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/ForeignTojosTest.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.stream.Stream; import org.cactoos.Func; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.AfterEach; @@ -69,7 +70,7 @@ void setUp() { void contains(final String name) { this.tojos.add(name); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, this.tojos.contains(name), Matchers.is(true) ); @@ -84,7 +85,7 @@ void contains(final String name) { void doesNotContain(final String existing, final String considered) { this.tojos.add(existing); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, this.tojos.contains(considered), Matchers.is(false) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/TranspiledTojosTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/TranspiledTojosTest.java index caad88866d..31fa998b6c 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/TranspiledTojosTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/TranspiledTojosTest.java @@ -37,6 +37,7 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.AfterEach; @@ -51,11 +52,6 @@ */ final class TranspiledTojosTest { - /** - * Empty message for JUnit Assertions. - */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; - /** * Transpiled files. */ @@ -99,7 +95,7 @@ void setUp(@TempDir final Path tmp) throws IOException { void adds() { this.tojos.add(this.transpiled.get(0), Paths.get("first.optimized.xmir")); MatcherAssert.assertThat( - TranspiledTojosTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.original.select(all -> true), Matchers.hasSize(1) ); @@ -113,22 +109,22 @@ void removesExistingTranspiledFiles() { this.tojos.add(this.transpiled.get(1), first); this.tojos.add(this.transpiled.get(2), second); MatcherAssert.assertThat( - TranspiledTojosTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.tojos.remove(first), Matchers.equalTo(1L) ); MatcherAssert.assertThat( - TranspiledTojosTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.tojos.remove(second), Matchers.equalTo(1L) ); MatcherAssert.assertThat( - TranspiledTojosTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.temp.toFile().listFiles(File::isFile), Matchers.arrayWithSize(1) ); MatcherAssert.assertThat( - TranspiledTojosTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.original.select(all -> true), Matchers.hasSize(3) ); @@ -137,17 +133,17 @@ void removesExistingTranspiledFiles() { @Test void removesAbsent() { MatcherAssert.assertThat( - TranspiledTojosTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.tojos.remove(Paths.get("absent.xmir")), Matchers.equalTo(0L) ); MatcherAssert.assertThat( - TranspiledTojosTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.temp.toFile().listFiles(File::isFile), Matchers.arrayWithSize(3) ); MatcherAssert.assertThat( - TranspiledTojosTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, this.original.select(all -> true), Matchers.hasSize(0) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/util/FileHashTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/util/FileHashTest.java index be3a0a8164..c0cb5a82c4 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/util/FileHashTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/util/FileHashTest.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.nio.file.Path; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -42,7 +43,7 @@ void readsFromExistingFile(@TempDir final Path temp) throws IOException { final Path path = temp.resolve("1.txt"); new HmBase(temp).save("hey, you", temp.relativize(path)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new FileHash(path).toString(), Matchers.startsWith("[-26, 1, -29, 113, ") ); @@ -52,7 +53,7 @@ void readsFromExistingFile(@TempDir final Path temp) throws IOException { void readsFromAbsentFile(@TempDir final Path temp) { final Path path = temp.resolve("2.txt"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new FileHash(path).toString(), Matchers.equalTo("") ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmBaseTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmBaseTest.java index 64d1ef5398..70465bd1ab 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmBaseTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmBaseTest.java @@ -32,6 +32,7 @@ import org.cactoos.text.Randomized; import org.cactoos.text.TextOf; import org.cactoos.text.UncheckedText; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Assertions; @@ -47,11 +48,6 @@ */ final class HmBaseTest { - /** - * Empty message for JUnit Assertions. - */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; - @ValueSource(ints = {0, 100, 1_000, 10_000}) @ParameterizedTest void saves(final int size, @TempDir final Path temp) throws IOException { @@ -59,7 +55,7 @@ void saves(final int size, @TempDir final Path temp) throws IOException { final String content = new UncheckedText(new Randomized(size)).asString(); new HmBase(temp).save(content, resolve); MatcherAssert.assertThat( - HmBaseTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new UncheckedText(new TextOf(temp.resolve(resolve))).asString(), Matchers.is(content) ); @@ -70,7 +66,7 @@ void exists(@TempDir final Path temp) throws IOException { final Path path = Paths.get("file.txt"); Files.write(temp.resolve(path), "any content".getBytes()); MatcherAssert.assertThat( - HmBaseTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new HmBase(temp).exists(path), Matchers.is(true) ); @@ -82,7 +78,7 @@ void existsInDir(@TempDir final Path temp) throws IOException { target.getParent().toFile().mkdirs(); Files.write(target, "any content".getBytes()); MatcherAssert.assertThat( - HmBaseTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new HmBase(temp.resolve("dir")).exists(Paths.get("subdir/file.txt")), Matchers.is(true) ); @@ -96,7 +92,7 @@ void existsInDirDifferentEncryption(@TempDir final Path temp) throws IOException final Path directory = temp.resolve("directory"); new HmBase(directory).save("any content", Paths.get(decoded)); MatcherAssert.assertThat( - HmBaseTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new HmBase(directory).exists(Paths.get(filename)), Matchers.is(true) ); @@ -110,7 +106,7 @@ void existsInDirWithSpecialSymbols(@TempDir final Path temp) throws IOException final Path directory = temp.resolve("directory"); new HmBase(directory).save("any content", Paths.get(decoded)); MatcherAssert.assertThat( - HmBaseTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new HmBase(directory).exists(Paths.get(filename)), Matchers.is(true) ); @@ -123,7 +119,7 @@ void loadsBytesFromExistingFile(@TempDir final Path temp) throws IOException { final Path subfolder = Paths.get("subfolder", "foo.txt"); home.save(content, subfolder); MatcherAssert.assertThat( - HmBaseTest.TO_ADD_MESSAGE, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(home.load(subfolder)), Matchers.equalTo(new TextOf(content)) ); @@ -134,7 +130,7 @@ void loadsFromAbsentFile(@TempDir final Path temp) { Assertions.assertThrows( NoSuchFileException.class, () -> new HmBase(temp).load(Paths.get("nonexistent")), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } @@ -143,7 +139,7 @@ void throwsExceptionOnAbsolute(@TempDir final Path temp) { Assertions.assertThrows( IllegalArgumentException.class, () -> new HmBase(temp).exists(temp.toAbsolutePath()), - "TO ADD ASSERTION MESSAGE" + BinarizeParseTest.TO_ADD_MESSAGE ); } } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/util/RelTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/util/RelTest.java index 87ab946eb3..bc20f24397 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/util/RelTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/util/RelTest.java @@ -25,6 +25,7 @@ import java.nio.file.Path; import java.nio.file.Paths; +import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -53,7 +54,7 @@ void returnsRelativePathOfCurrentWorkingDirectory( @TempDir final Path temp ) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new Rel(temp, temp.resolve(file)).toString(), Matchers.is(Paths.get(expected).toString()) ); @@ -62,7 +63,7 @@ void returnsRelativePathOfCurrentWorkingDirectory( @Test void returnsAbsolutePathIfBaseAndOtherFromDifferentHierarchies() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + BinarizeParseTest.TO_ADD_MESSAGE, new Rel( Paths.get("/a/b/c"), Paths.get("/d/e/f")