From bcc8bcd762f2a4a27b7f61c1de28bf434d827eff Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Mon, 25 Mar 2024 15:26:20 +0300 Subject: [PATCH] #2937 add empty assertion message in eo-maven-plugin --- .../org/eolang/maven/BinarizeMojoTest.java | 15 ++++- .../org/eolang/maven/BinarizeParseTest.java | 18 ++++++ .../java/org/eolang/maven/CatalogsTest.java | 1 + .../java/org/eolang/maven/CleanMojoTest.java | 2 + .../java/org/eolang/maven/CopyMojoTest.java | 3 + .../java/org/eolang/maven/DepDirsTest.java | 2 + .../org/eolang/maven/DiscoverMojoTest.java | 7 ++- .../java/org/eolang/maven/JavaFilesTest.java | 2 + .../java/org/eolang/maven/LatexMojoTest.java | 2 + .../java/org/eolang/maven/LogFormatTest.java | 1 + .../java/org/eolang/maven/MarkMojoTest.java | 3 + .../org/eolang/maven/OptimizeMojoTest.java | 10 +++ .../java/org/eolang/maven/ParseMojoTest.java | 4 ++ .../java/org/eolang/maven/PlaceMojoTest.java | 23 +++++++ .../test/java/org/eolang/maven/PlaceTest.java | 2 + .../java/org/eolang/maven/PullMojoTest.java | 5 ++ .../org/eolang/maven/RegisterMojoTest.java | 3 + .../org/eolang/maven/ResolveMojoTest.java | 22 ++++++- .../java/org/eolang/maven/SafeMojoTest.java | 1 + .../java/org/eolang/maven/SodgMojoTest.java | 3 + .../org/eolang/maven/TranspileMojoTest.java | 62 ++++++++++++++++--- .../org/eolang/maven/UnplaceMojoTest.java | 11 ++++ .../java/org/eolang/maven/UnplaceTest.java | 1 + .../maven/dependencies/DcsDepgraphTest.java | 1 + .../DcsEachWithoutTransitiveTest.java | 3 + .../dependencies/DcsWithRuntimeTest.java | 2 + .../maven/footprint/CacheVersionTest.java | 2 + .../eolang/maven/footprint/FtCachedTest.java | 10 +++ .../eolang/maven/footprint/FtDefaultTest.java | 4 ++ .../org/eolang/maven/hash/ChCachedTest.java | 12 +++- .../org/eolang/maven/hash/ChPatternTest.java | 6 +- .../org/eolang/maven/hash/ChRemoteTest.java | 2 + .../org/eolang/maven/hash/ChTextTest.java | 7 ++- .../maven/objectionary/ObjectsIndexTest.java | 10 +++ .../maven/objectionary/OyCachingTest.java | 2 + .../objectionary/OyFallbackSwapTest.java | 12 ++++ .../maven/objectionary/OyFallbackTest.java | 16 +++++ .../maven/objectionary/OyFilesystemTest.java | 3 + .../eolang/maven/objectionary/OyHomeTest.java | 3 + .../maven/objectionary/OyIndexedTest.java | 4 ++ .../maven/objectionary/OyRemoteTest.java | 2 + .../org/eolang/maven/rust/ModuleTest.java | 1 + .../java/org/eolang/maven/rust/NamesTest.java | 4 ++ .../org/eolang/maven/rust/NativeTest.java | 1 + .../eolang/maven/rust/PrimeModuleTest.java | 1 + .../eolang/maven/tojos/ForeignTojosTest.java | 2 + .../maven/tojos/TranspiledTojosTest.java | 13 ++++ .../org/eolang/maven/util/FileHashTest.java | 2 + .../org/eolang/maven/util/HmBaseTest.java | 11 ++++ .../java/org/eolang/maven/util/RelTest.java | 2 + 50 files changed, 324 insertions(+), 17 deletions(-) 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 b16cf022c4..61c91203a8 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 @@ -45,6 +45,11 @@ */ final class BinarizeMojoTest { + /** + * Empty message for JUnit Assertions. + */ + private static final String EMPTY_MSG = "EMPTY MESSAGE"; + /** * Sources for the tests. */ @@ -98,12 +103,14 @@ void savesToCache(@TempDir final Path temp) throws IOException { .execute(new FakeMaven.Binarize()) .result(); MatcherAssert.assertThat( + BinarizeMojoTest.EMPTY_MSG, res, Matchers.hasValue( cache.resolve("Lib") ) ); MatcherAssert.assertThat( + BinarizeMojoTest.EMPTY_MSG, res, Matchers.not( Matchers.hasValue( @@ -137,6 +144,7 @@ void boostsSecondCompilation(@TempDir final Path temp) throws IOException { finish = System.currentTimeMillis(); final long second = finish - start; MatcherAssert.assertThat( + BinarizeMojoTest.EMPTY_MSG, second, Matchers.lessThan(first) ); @@ -160,8 +168,13 @@ void doesNotRecompile(@TempDir final Path temp) throws IOException { final long first = executable.lastModified(); maven.execute(new FakeMaven.Binarize()); final long second = executable.lastModified(); - MatcherAssert.assertThat(first, Matchers.not(0L)); MatcherAssert.assertThat( + BinarizeMojoTest.EMPTY_MSG, + first, + Matchers.not(0L) + ); + MatcherAssert.assertThat( + BinarizeMojoTest.EMPTY_MSG, 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 749f81636a..6e2df9ca80 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 @@ -47,6 +47,11 @@ @Execution(ExecutionMode.CONCURRENT) final class BinarizeParseTest { + /** + * Empty message for JUnit Assertions. + */ + private static final String EMPTY_MSG = "EMPTY MESSAGE"; + @Test void parsesSimpleEoProgram(@TempDir final Path temp) throws Exception { final Map res = execParse( @@ -62,9 +67,11 @@ void parsesSimpleEoProgram(@TempDir final Path temp) throws Exception { function ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, res, Matchers.hasKey(rust) ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, new TextOf(res.get(rust)).asString(), Matchers.stringContainsInOrder( "use rand::Rng;", @@ -77,6 +84,7 @@ void parsesSimpleEoProgram(@TempDir final Path temp) throws Exception { ) ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, new TextOf( res.get( String.format( @@ -104,12 +112,15 @@ void binarizesTwiceRustProgram(@TempDir final Path temp) throws Exception { Names.PREFIX ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, res, Matchers.hasKey(one) ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, res, Matchers.hasKey(two) ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, new TextOf(res.get(one)).asString(), Matchers.stringContainsInOrder( "use eo::eo_enum::EO;", @@ -119,6 +130,7 @@ void binarizesTwiceRustProgram(@TempDir final Path temp) throws Exception { ) ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, new TextOf(res.get(two)).asString(), Matchers.stringContainsInOrder( "use eo::eo_enum::EO;", @@ -133,6 +145,7 @@ void binarizesTwiceRustProgram(@TempDir final Path temp) throws Exception { @ClasspathSource(value = "org/eolang/maven/binarize/add_rust/", glob = "**.yaml") void createsDependenciesSection(final String yaml) { MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, new XaxStory(yaml), Matchers.is(true) ); @@ -156,15 +169,19 @@ void createsCorrectRustProject(@TempDir final Path temp) throws Exception { dir ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, res, Matchers.hasKey(cargo) ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, res, Matchers.hasKey(lib) ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, res, Matchers.hasKey(module) ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, new TextOf(res.get(cargo)).asString(), Matchers.stringContainsInOrder( "[lib]", @@ -174,6 +191,7 @@ void createsCorrectRustProject(@TempDir final Path temp) throws Exception { ) ); MatcherAssert.assertThat( + BinarizeParseTest.EMPTY_MSG, new TextOf(res.get(cargo)).asString(), Matchers.stringContainsInOrder( "[dependencies]", 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 48b4ffabc1..6e6986db15 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,6 +54,7 @@ final class CatalogsTest { void readsFromTojosConcurrently(@TempDir final Path tmp) { final Tojos tojos = Catalogs.INSTANCE.make(tmp.resolve("foreign"), "json"); MatcherAssert.assertThat( + "EMPTY 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 ba090dc7d5..68a2622cd0 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,6 +54,7 @@ void cleansSuccessfully(@TempDir final Path temp) throws IOException { .with("targetDir", dir.toFile()) .execute(CleanMojo.class); MatcherAssert.assertThat( + "EMPTY MESSAGE", !file.toFile().exists() && !small.toFile().exists(), Matchers.is(true) ); @@ -75,6 +76,7 @@ void makesFullCompilingLifecycleSuccessfully(@TempDir final Path temp) throws IO .execute(AssembleMojo.class) .execute(CleanMojo.class); MatcherAssert.assertThat( + "EMPTY 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 370ab2ddce..82505f55d8 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,10 +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( + "EMPTY MESSAGE", new HmBase(classes).exists(classes.relativize(out)), Matchers.is(true) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", new TextOf(new HmBase(classes).load(classes.relativize(out))).asString(), Matchers.allOf( Matchers.containsString("+rt foo:"), @@ -88,6 +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( + "EMPTY 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 9a0b3e1cb2..5e0193af0a 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,10 +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( + "EMPTY MESSAGE", new DepDirs(temp), Matchers.contains(String.format("a%sb%1$sc%1$sf", File.separator)) ); MatcherAssert.assertThat( + "EMPTY 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 8d1eca3f4a..dff6286a97 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 @@ -88,8 +88,13 @@ void executesDiscoveryPhaseForCorrectEoPrograms( new MnCsv(maven.foreignPath()).read() ); final Map first = json.removeFirst(); - MatcherAssert.assertThat(dependencies, Matchers.equalTo(json.size())); MatcherAssert.assertThat( + "EMPTY MESSAGE", + dependencies, + Matchers.equalTo(json.size()) + ); + MatcherAssert.assertThat( + "EMPTY 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 c58a6700e5..07f668e766 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,6 +66,7 @@ void convertsXmirtoJavaSuccessfully(@TempDir final Path temp) throws Exception { Paths.get("sum.xmir") ); MatcherAssert.assertThat( + "EMPTY MESSAGE", new TextOf( new InputOf( new JavaFiles( @@ -85,6 +86,7 @@ void convertsXmirtoJavaWithoutJavaClasses(@TempDir final Path temp) throws Excep Paths.get("sum.xmir") ); MatcherAssert.assertThat( + "EMPTY 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 9299154402..4e371955ee 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,6 +46,7 @@ final class LatexMojoTest { @Test void generatesTexFile(@TempDir final Path temp) throws Exception { MatcherAssert.assertThat( + "EMPTY MESSAGE", new FakeMaven(temp) .withHelloWorld() .execute(new FakeMaven.Latex()) @@ -63,6 +64,7 @@ void generatesTexFile(@TempDir final Path temp) throws Exception { @Test void checksLastName() { MatcherAssert.assertThat( + "EMPTY 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 7dc176c019..551aaa18ef 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,6 +78,7 @@ void printsFormattedMessage(final Logs out) { @Test void matchesCorrectly() { MatcherAssert.assertThat( + "EMPTY 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 e4709eae2f..59673d508e 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,6 +52,7 @@ void extendsForeignWithNewObjects(@TempDir final Path temp) throws IOException { final FakeMaven maven = new FakeMaven(temp); maven.execute(MarkMojo.class); MatcherAssert.assertThat( + "EMPTY MESSAGE", maven.foreignTojos() .all() .iterator() @@ -70,10 +71,12 @@ void updatesVersionIfItExists(@TempDir final Path temp) throws IOException { .withVersion("*.*.*"); maven.execute(MarkMojo.class); MatcherAssert.assertThat( + "EMPTY MESSAGE", foreign.all().iterator().next().version(), Matchers.equalTo(MarkMojoTest.VERSION) ); MatcherAssert.assertThat( + "EMPTY 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 87694ccabd..c8cde0932d 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,6 +66,7 @@ void checksPacks(final String pack) throws IOException { ); } MatcherAssert.assertThat( + "EMPTY MESSAGE", check.failures(), Matchers.empty() ); @@ -82,6 +83,7 @@ void skipsAlreadyOptimized(@TempDir final Path temp) throws IOException { final long mtime = path.toFile().lastModified(); maven.execute(OptimizeMojo.class); MatcherAssert.assertThat( + "EMPTY MESSAGE", path.toFile().lastModified(), Matchers.is(mtime) ); @@ -143,6 +145,7 @@ void getsAlreadyOptimizedResultsFromCache(@TempDir final Path temp) throws Excep .allTojosWithHash(() -> hash) .execute(new FakeMaven.Optimize()); MatcherAssert.assertThat( + "EMPTY MESSAGE", new XMLDocument( new HmBase(temp).load( Paths.get( @@ -168,6 +171,7 @@ void savesOptimizedResultsToCache(@TempDir final Path temp) throws IOException { .allTojosWithHash(() -> hash) .execute(new FakeMaven.Optimize()); MatcherAssert.assertThat( + "EMPTY MESSAGE", cache.resolve(OptimizeMojo.OPTIMIZED) .resolve(hash) .resolve("foo/x/main.xmir").toFile(), @@ -184,12 +188,14 @@ void optimizesSuccessfully(@TempDir final Path temp) throws IOException { .execute(new FakeMaven.Optimize()) .result(); MatcherAssert.assertThat( + "EMPTY MESSAGE", res, Matchers.hasKey( String.format("target/%s/foo/x/main/01-not-empty-atoms.xml", OptimizeMojo.STEPS) ) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", res, Matchers.hasKey( String.format("target/%s/foo/x/main.%s", OptimizeMojo.DIR, TranspileMojo.EXT) @@ -215,6 +221,7 @@ void optimizesConcurrentlyWithLotsOfPrograms(@TempDir final Path temp) throws IO .result(); for (int program = 0; program < total; ++program) { MatcherAssert.assertThat( + "EMPTY MESSAGE", res, Matchers.hasKey( String.format( @@ -231,6 +238,7 @@ void optimizesConcurrentlyWithLotsOfPrograms(@TempDir final Path temp) throws IO @Test void doesNotCrashesOnError(@TempDir final Path temp) throws Exception { MatcherAssert.assertThat( + "EMPTY MESSAGE", new FakeMaven(temp) .withProgram( "+package f\n", @@ -250,6 +258,7 @@ void doesNotCrashesOnError(@TempDir final Path temp) throws Exception { @Test void choosesTransformerFactoryOnce() { MatcherAssert.assertThat( + "EMPTY MESSAGE", TransformerFactory.newInstance().getClass(), Matchers.typeCompatibleWith(TransformerFactoryImpl.class) ); @@ -261,6 +270,7 @@ void choosesTransformerFactoryInConcurrentEnvironment() { .mapToObj(i -> TransformerFactory.newInstance().getClass()) .collect(Collectors.toList())) { MatcherAssert.assertThat( + "EMPTY 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 2932d96774..af0b45f794 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,6 +59,7 @@ final class ParseMojoTest { void parsesSuccessfully(@TempDir final Path temp) throws Exception { final FakeMaven maven = new FakeMaven(temp); MatcherAssert.assertThat( + "EMPTY MESSAGE", maven.withHelloWorld() .execute(new FakeMaven.Parse()) .result(), @@ -67,6 +68,7 @@ void parsesSuccessfully(@TempDir final Path temp) throws Exception { ) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", maven.foreign().getById("foo.x.main").exists("xmir"), Matchers.is(true) ); @@ -119,6 +121,7 @@ void parsesWithCache(@TempDir final Path temp) throws Exception { @Test void doesNotCrashesOnError(@TempDir final Path temp) throws Exception { MatcherAssert.assertThat( + "EMPTY MESSAGE", new FakeMaven(temp) .withProgram("something < is wrong here") .execute(new FakeMaven.Parse()) @@ -165,6 +168,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( + "EMPTY MESSAGE", res, Matchers.hasKey( String.format( 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 0fb752c6a7..2c47707a7a 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,6 +49,11 @@ @SuppressWarnings("PMD.TooManyMethods") final class PlaceMojoTest { + /** + * Empty message for JUnit Assertions. + */ + private static final String EMPTY_MSG = "EMPTY MESSAGE"; + /** * The default folder for placed binaries. */ @@ -68,14 +73,17 @@ void placesBinaries(@TempDir final Path temp) throws Exception { .execute(PlaceMojo.class) .result(); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, res, Matchers.hasKey("target/classes/EObar/x.bin") ); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, res, Matchers.hasKey("target/classes/org/eolang/f/x.a.class") ); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, res, Matchers.hasKey("target/classes/org/eolang/t.txt") ); @@ -86,6 +94,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.EMPTY_MSG, new FakeMaven(temp) .execute(PlaceMojo.class) .result(), @@ -112,6 +121,7 @@ void placesOnlyClassesFromPackageThatHaveSources(@TempDir final Path temp) throw PlaceMojoTest.saveBinary(temp, binary); } MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, new FakeMaven(temp) .with("placeBinariesThatHaveSources", true) .execute(PlaceMojo.class) @@ -147,6 +157,7 @@ void skipsAlreadyPlacedBinaries(@TempDir final Path temp) throws IOException { binary ).toFile().lastModified(); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, new FakeMaven(temp) .withPlacedBinary( temp.resolve(PlaceMojoTest.TARGET_CLASSES).resolve(binary) @@ -170,10 +181,12 @@ void rewritesAlreadyPlacedBinaries(@TempDir final Path temp) throws Exception { final FakeMaven maven = new FakeMaven(temp).withPlacedBinary(path); maven.placed().unplaceAll(); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, maven.execute(PlaceMojo.class).result(), Matchers.hasValue(path) ); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, content, Matchers.is(new TextOf(path).asString()) ); @@ -183,6 +196,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.EMPTY_MSG, new FakeMaven(temp) .execute(PlaceMojo.class) .result(), @@ -193,6 +207,7 @@ void placesWithoutBinaries(@TempDir final Path temp) throws IOException { @Test void placesWithoutResolveDirectory(@TempDir final Path temp) throws IOException { MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, new FakeMaven(temp) .execute(PlaceMojo.class) .result(), @@ -211,10 +226,12 @@ void placesMissing(@TempDir final Path temp) throws IOException { .execute(PlaceMojo.class) .result(); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, res, Matchers.hasValue(PlaceMojoTest.pathToPlacedBinary(temp, first)) ); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, res, Matchers.hasValue(PlaceMojoTest.pathToPlacedBinary(temp, second)) ); @@ -233,6 +250,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.EMPTY_MSG, maven.withHelloWorld() .execute(new FakeMaven.Place()) .result() @@ -240,6 +258,7 @@ void placesAllEoRuntimeClasses(@TempDir final Path temp) throws IOException { new ContainsFiles("**/eo-runtime-*.jar") ); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, maven.placed().jars().size(), Matchers.is(1) ); @@ -249,6 +268,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.EMPTY_MSG, maven.withHelloWorld() .with("withRuntimeDependency", false) .execute(new FakeMaven.Place()) @@ -257,6 +277,7 @@ void placesWithoutEoRuntimeClasses(@TempDir final Path temp) throws IOException Matchers.not(new ContainsFiles("**/eo-runtime-*.jar")) ); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, maven.placed().jars().isEmpty(), Matchers.is(true) ); @@ -272,6 +293,7 @@ void doesNotPlacesAgainIfWasNotUnplaced(@TempDir final Path temp) throws Excepti PlaceMojoTest.saveBinary(temp, "new content", binary); maven.execute(PlaceMojo.class).result(); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, new TextOf(PlaceMojoTest.pathToPlacedBinary(temp, binary)).asString(), Matchers.equalTo(old) ); @@ -288,6 +310,7 @@ void placesAgainIfWasUnplaced(@TempDir final Path temp) throws Exception { maven.placed().unplaceAll(); maven.execute(PlaceMojo.class).result(); MatcherAssert.assertThat( + PlaceMojoTest.EMPTY_MSG, 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 806c35e819..8072f674c8 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,6 +39,7 @@ final class PlaceTest { @Test void makesPath() { MatcherAssert.assertThat( + "EMPTY MESSAGE", new Place("hello.foo.bar") .make(Paths.get("/tmp/test"), TranspileMojo.EXT) .toString() @@ -50,6 +51,7 @@ void makesPath() { @Test void makesSimplePath() { MatcherAssert.assertThat( + "EMPTY 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 806a61b256..9380329189 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,6 +80,7 @@ void pullsSuccessfully(@TempDir final Path temp) throws IOException { maven.with("skip", false) .execute(PullMojo.class); MatcherAssert.assertThat( + "EMPTY MESSAGE", PullMojoTest.exists(temp, PullMojoTest.STDOUT), Matchers.is(true) ); @@ -109,6 +110,7 @@ void pullsFromProbes(@TempDir final Path temp) throws IOException { ) .execute(new FakeMaven.Pull()); MatcherAssert.assertThat( + "EMPTY MESSAGE", PullMojoTest.exists(temp, PullMojoTest.STDOUT), Matchers.is(true) ); @@ -131,6 +133,7 @@ void pullsUsingOfflineHashFile(@TempDir final Path temp) throws IOException { ) .execute(PullMojo.class); MatcherAssert.assertThat( + "EMPTY MESSAGE", new LinkedList<>(new MnCsv(maven.foreignPath()).read()).getFirst().get("hash"), Matchers.equalTo("mmmmmmm") ); @@ -154,6 +157,7 @@ void pullsUsingOfflineHash(@TempDir final Path temp) throws IOException { ) .execute(PullMojo.class); MatcherAssert.assertThat( + "EMPTY MESSAGE", new LinkedList<>(new MnCsv(maven.foreignPath()).read()).getFirst().get("hash"), Matchers.equalTo("abcdefg") ); @@ -169,6 +173,7 @@ void skipsPullMojo(@TempDir final Path temp) throws IOException { maven.with("skip", true) .execute(PullMojo.class); MatcherAssert.assertThat( + "EMPTY 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 426f25f3f3..4cbb80c483 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,6 +60,7 @@ void registersOkNames(@TempDir final Path temp) throws IOException { .with(RegisterMojoTest.PARAM, temp.resolve(RegisterMojoTest.SOURCES).toFile()) .execute(new FakeMaven.Register()); MatcherAssert.assertThat( + "EMPTY MESSAGE", maven.foreign().getById("org.eolang.maven.abc-def").exists("id"), Matchers.is(true) ); @@ -80,6 +81,7 @@ void failsWithDotNames(@TempDir final Path temp) throws IOException { } ); MatcherAssert.assertThat( + "EMPTY MESSAGE", exception.getCause().getCause().getMessage(), Matchers.containsString("Incorrect name found: '.abc.eo'") ); @@ -96,6 +98,7 @@ void doesNotFailWhenNoStrictNames(@TempDir final Path temp) throws IOException { .with("strictFileNames", false) .execute(new FakeMaven.Register()); MatcherAssert.assertThat( + "EMPTY 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 c2247e762f..04777d946d 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 @@ -61,8 +61,13 @@ void resolvesWithSingleDependency(@TempDir final Path temp) throws IOException { .resolve("target") .resolve(ResolveMojo.DIR) .resolve("org.eolang/eo-runtime/-/0.7.0"); - MatcherAssert.assertThat(path.toFile(), FileMatchers.anExistingDirectory()); MatcherAssert.assertThat( + "EMPTY MESSAGE", + path.toFile(), + FileMatchers.anExistingDirectory() + ); + MatcherAssert.assertThat( + "EMPTY MESSAGE", path.resolve("eo-runtime-0.7.0.jar").toFile(), FileMatchers.anExistingFile() ); @@ -82,8 +87,13 @@ void resolvesWithoutAnyDependencies(@TempDir final Path temp) throws IOException .resolve("target") .resolve(ResolveMojo.DIR) .resolve("org.eolang/eo-runtime/-/"); - MatcherAssert.assertThat(path.toFile(), FileMatchers.anExistingDirectory()); MatcherAssert.assertThat( + "EMPTY MESSAGE", + path.toFile(), + FileMatchers.anExistingDirectory() + ); + MatcherAssert.assertThat( + "EMPTY MESSAGE", path, new ContainsFiles("**/eo-runtime-*.jar") ); @@ -94,6 +104,7 @@ void resolvesWithEoRuntimeDependency(@TempDir final Path temp) throws IOExceptio final FakeMaven maven = new FakeMaven(temp); maven.withHelloWorld().execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( + "EMPTY MESSAGE", maven.targetPath(), new ContainsFiles("**/eo-runtime-*.jar") ); @@ -106,6 +117,7 @@ void resolvesWithoutEoRuntimeDependency(@TempDir final Path temp) throws IOExcep .with("withRuntimeDependency", false) .execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( + "EMPTY MESSAGE", maven.targetPath(), Matchers.not(new ContainsFiles("**/eo-runtime-*.jar")) ); @@ -118,6 +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( + "EMPTY MESSAGE", maven.targetPath(), new ContainsFiles("**/eo-runtime-0.22.1.jar") ); @@ -132,6 +145,7 @@ void resolvesIfRuntimeDependencyComesFromTojosButParamIsFalse(@TempDir final Pat .with("withRuntimeDependency", false) .execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( + "EMPTY MESSAGE", maven.targetPath(), Matchers.not(new ContainsFiles("**/eo-runtime-*.jar")) ); @@ -150,6 +164,7 @@ void resolvesWithRuntimeDependencyFromPom(@TempDir final Path temp) throws IOExc .with("project", project) .execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( + "EMPTY MESSAGE", maven.targetPath(), new ContainsFiles("**/eo-runtime-0.7.0.jar") ); @@ -166,6 +181,7 @@ void resolvesWithoutTransitiveDependencies(@TempDir final Path temp) throws IOEx ) .execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( + "EMPTY MESSAGE", maven.targetPath(), new ContainsFiles("**/eo-runtime-*.jar") ); @@ -223,6 +239,7 @@ void resolvesWithConflictingDependencies(@TempDir final Path temp) throws IOExce () -> maven.execute(new FakeMaven.Resolve()) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", excpt.getCause().getCause().getMessage(), Matchers.containsString( "1 conflicting dependencies are found: {org.eolang:eo-runtime:jar:=[0.22.0, 0.22.1]}" @@ -249,6 +266,7 @@ void resolvesWithConflictingDependenciesNoFail(@TempDir final Path temp) throws maven.with("ignoreVersionConflicts", true) .execute(new FakeMaven.Resolve()); MatcherAssert.assertThat( + "EMPTY 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 e809c15c76..c86e4d551f 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 @@ -48,6 +48,7 @@ void logsStackTrace(final Logs out, @TempDir final Path temp) { .execute(new FakeMaven.Parse()) ); MatcherAssert.assertThat( + "EMPTY 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 40f6088b17..bf56b96890 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 @@ -71,6 +71,7 @@ void convertsToGraph() throws Exception { } final XML graph = SodgMojoTest.toGraph(program.toString(), "**"); MatcherAssert.assertThat( + "EMPTY MESSAGE", ".foo .foo", new SodgMojoTest.ExistsIn(graph) ); @@ -80,6 +81,7 @@ void convertsToGraph() throws Exception { @ClasspathSource(value = "org/eolang/maven/sodg-packs", glob = "**.yaml") void transformsThroughSheets(final String yaml) { MatcherAssert.assertThat( + "EMPTY MESSAGE", new XaxStory(yaml), Matchers.is(true) ); @@ -109,6 +111,7 @@ void generatesSodgForPacks(final String pack) throws Exception { for (final String loc : (Iterable) map.get("locators")) { assertions.add( () -> MatcherAssert.assertThat( + "EMPTY 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 acea547871..818ba71908 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,6 +76,7 @@ void setUp() throws Exception { @ClasspathSource(value = "org/eolang/maven/pre/", glob = "**.yaml") void createsPreStylesheets(final String yaml) { MatcherAssert.assertThat( + "EMPTY MESSAGE", new XaxStory(yaml), Matchers.is(true) ); @@ -91,11 +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( + "EMPTY MESSAGE", res.get("foo/x/main.eo").toFile().setLastModified(before + 1L), Matchers.is(true) ); maven.execute(TranspileMojo.class); MatcherAssert.assertThat( + "EMPTY MESSAGE", java.toFile().lastModified(), Matchers.greaterThan(before) ); @@ -112,15 +115,39 @@ void recompilesIfExpired(@TempDir final Path temp) throws IOException { final Path xmir = res.get( String.format("target/%s/foo/x/main.xmir", TranspileMojo.DIR) ); - MatcherAssert.assertThat(java.toFile(), FileMatchers.anExistingFile()); - MatcherAssert.assertThat(xmir.toFile(), FileMatchers.anExistingFile()); - MatcherAssert.assertThat(java.toFile().setLastModified(0L), Matchers.is(true)); - MatcherAssert.assertThat(xmir.toFile().setLastModified(0L), Matchers.is(true)); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + java.toFile(), + FileMatchers.anExistingFile() + ); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + xmir.toFile(), + FileMatchers.anExistingFile() + ); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + java.toFile().setLastModified(0L), + Matchers.is(true) + ); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + xmir.toFile().setLastModified(0L), + Matchers.is(true) + ); final long before = java.toFile().lastModified(); maven.execute(TranspileMojo.class); final long after = java.toFile().lastModified(); - MatcherAssert.assertThat(after, Matchers.greaterThan(0L)); - MatcherAssert.assertThat(before, Matchers.not(Matchers.equalTo(after))); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + after, + Matchers.greaterThan(0L) + ); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + before, + Matchers.not(Matchers.equalTo(after)) + ); } @Test @@ -130,10 +157,22 @@ void doesNotRetranspileIfNotModified(@TempDir final Path temp) throws IOExceptio .withProgram(this.program) .execute(new FakeMaven.Transpile()) .result().get(this.compiled); - MatcherAssert.assertThat(java.toFile(), FileMatchers.anExistingFile()); - MatcherAssert.assertThat(java.toFile().setLastModified(0L), Matchers.is(true)); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + java.toFile(), + FileMatchers.anExistingFile() + ); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + java.toFile().setLastModified(0L), + Matchers.is(true) + ); maven.execute(TranspileMojo.class); - MatcherAssert.assertThat(java.toFile().lastModified(), Matchers.is(0L)); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + java.toFile().lastModified(), + Matchers.is(0L) + ); } @Test @@ -145,9 +184,11 @@ void transpilesSimpleEoProgram(@TempDir final Path temp) throws Exception { .result(); final String java = "target/generated/EOorg/EOeolang/EOtuple.java"; MatcherAssert.assertThat( + "EMPTY MESSAGE", res, Matchers.hasKey(java) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", new TextOf(res.get(java)).asString(), Matchers.containsString("class EOtuple") ); @@ -162,6 +203,7 @@ void transpilesSeveralEoProgramsInParallel(@TempDir final Path temp) throws IOEx } maven.execute(new FakeMaven.Transpile()).result(); MatcherAssert.assertThat( + "EMPTY MESSAGE", Files.list(maven.generatedPath() .resolve("EOorg") .resolve("EOeolang") @@ -191,6 +233,7 @@ void transpilesSourcesForDifferentScopesWithoutIntersections( .withProgram(this.program) .execute(new FakeMaven.Transpile()); MatcherAssert.assertThat( + "EMPTY MESSAGE", maven.foreign().size(), Matchers.equalTo(2) ); @@ -216,6 +259,7 @@ void transpilesAndCleansGarbageFromDirtyDependency(@TempDir final Path temp) .withHelloWorld() .execute(new FakeMaven.Transpile()); MatcherAssert.assertThat( + "EMPTY MESSAGE", maven.targetPath().resolve(binary).toFile(), Matchers.not(FileMatchers.anExistingFile()) ); 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 142a145331..adc4f9a295 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,6 +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( + "EMPTY MESSAGE", new FakeMaven(temp) .with("placed", placed.toFile()) .execute(UnplaceMojo.class) @@ -91,10 +92,12 @@ void cleansBinariesWithJar(@TempDir final Path temp) throws IOException { .with("placed", placed.toFile()) .execute(UnplaceMojo.class); MatcherAssert.assertThat( + "EMPTY MESSAGE", tojos.size(), Matchers.equalTo(5) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", tojos.stream().allMatch(PlacedTojo::unplaced), Matchers.is(true) ); @@ -113,10 +116,12 @@ void keepsJarBecauseItIsStillInUse(@TempDir final Path temp) throws IOException .with("placed", placed.toFile()) .execute(UnplaceMojo.class); MatcherAssert.assertThat( + "EMPTY MESSAGE", tojos.size(), Matchers.equalTo(5) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", tojos.stream() .filter(tojo -> tojo.identifier().equals(other)) .allMatch(PlacedTojo::placed), @@ -134,10 +139,12 @@ void unplacesWithKeepAndRemoveBinariesParamTogether(@TempDir final Path temp) th .execute(UnplaceMojo.class) .result(); MatcherAssert.assertThat( + "EMPTY MESSAGE", res.values().stream().noneMatch(UnplaceMojoTest::isClass), Matchers.is(true) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", new TextOf(res.get(placed.getFileName().toString())).asString(), Matchers.allOf( Matchers.not(Matchers.containsString("false")), @@ -155,10 +162,12 @@ void unplacesWithRemoveBinariesParam(@TempDir final Path temp) throws Exception .execute(UnplaceMojo.class) .result(); MatcherAssert.assertThat( + "EMPTY MESSAGE", res.values().stream().noneMatch(UnplaceMojoTest::isClass), Matchers.is(true) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", new TextOf(res.get(placed.getFileName().toString())).asString(), Matchers.allOf( Matchers.not(Matchers.containsString("false")), @@ -176,10 +185,12 @@ void unplacesWithKeepBinariesParam(@TempDir final Path temp) throws Exception { .execute(UnplaceMojo.class) .result(); MatcherAssert.assertThat( + "EMPTY MESSAGE", res.values().stream().anyMatch(UnplaceMojoTest::isClass), Matchers.is(true) ); MatcherAssert.assertThat( + "EMPTY 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 b9da5e975e..88586f2954 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,6 +47,7 @@ void makesName( final String name ) { MatcherAssert.assertThat( + "EMPTY MESSAGE", new Unplace(Paths.get(base)).make( Paths.get(source) ), 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 f694161141..5ec5822300 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 @@ -53,6 +53,7 @@ void readsAllDependenciesFromJsonFile( @TempDir final Path tmp ) throws Exception { MatcherAssert.assertThat( + "EMPTY 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 22339cc5ee..e805b082f3 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 @@ -55,6 +55,7 @@ void failsIfHasTransitiveDependencies() { void keepsDependenciesThatHaveTeStDependenciesAsTransitive() { final DcsFake original = new DcsFake(); MatcherAssert.assertThat( + "EMPTY MESSAGE", new DcsEachWithoutTransitive( original, dep -> Collections.singleton(DcsFake.randDep("test")) @@ -67,6 +68,7 @@ void keepsDependenciesThatHaveTeStDependenciesAsTransitive() { void keepsDependencyThatHasTheSameDependencyAsTransitive() { final DcsFake original = new DcsFake(); MatcherAssert.assertThat( + "EMPTY MESSAGE", new DcsEachWithoutTransitive( original, DcsFake::new @@ -79,6 +81,7 @@ void keepsDependencyThatHasTheSameDependencyAsTransitive() { void keepsDependencyThatHasRuntimeDependencyAsTransitive() { final DcsFake original = new DcsFake(); MatcherAssert.assertThat( + "EMPTY 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 44f7dd0adb..42148d4654 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 @@ -40,6 +40,7 @@ final class DcsWithRuntimeTest { @ExtendWith(WeAreOnline.class) void addsHardcodedVersionOfRuntimeDependency() { MatcherAssert.assertThat( + "EMPTY MESSAGE", new DcsWithRuntime( new DcsFake(5), DcsFake.runtimeDep() @@ -52,6 +53,7 @@ void addsHardcodedVersionOfRuntimeDependency() { @ExtendWith(WeAreOnline.class) void addsRemoteVersionOfRuntimeDependency() { MatcherAssert.assertThat( + "EMPTY 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 c96745fbfc..b8821afd9f 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 @@ -56,6 +56,7 @@ void checksIfVersionIsCacheable( final boolean expected ) { MatcherAssert.assertThat( + "EMPTY MESSAGE", new CacheVersion(version, hash).cacheable(), Matchers.is(expected) ); @@ -81,6 +82,7 @@ void returnsCorrectCachePath( final String expected ) { MatcherAssert.assertThat( + "EMPTY 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 e596934c83..84ecf9deec 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 @@ -38,6 +38,11 @@ */ final class FtCachedTest { + /** + * Empty message for JUnit Assertions. + */ + private static final String EMPTY_MSG = "EMPTY MESSAGE"; + /** * Default content. */ @@ -64,10 +69,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.EMPTY_MSG, cached.load(program, FtCachedTest.EXTENSION), Matchers.equalTo(FtCachedTest.CONTENT.value()) ); MatcherAssert.assertThat( + FtCachedTest.EMPTY_MSG, temp.resolve(FtCachedTest.CACHE).toFile(), FileMatchers.anExistingDirectory() ); @@ -79,10 +86,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.EMPTY_MSG, cached.load(program, FtCachedTest.EXTENSION), Matchers.equalTo(FtCachedTest.CONTENT.value()) ); MatcherAssert.assertThat( + FtCachedTest.EMPTY_MSG, temp.resolve(FtCachedTest.CACHE).toFile(), Matchers.not(FileMatchers.anExistingFileOrDirectory()) ); @@ -93,6 +102,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.EMPTY_MSG, 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 6f738ce0f7..e2004dd51d 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 @@ -53,6 +53,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( + "EMPTY MESSAGE", new FtDefault(target).load(program, FtDefaultTest.XMIR), Matchers.equalTo(FtDefaultTest.CONTENT.value()) ); @@ -67,6 +68,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( + "EMPTY MESSAGE", footprint.list("xmir"), Matchers.containsInAnyOrder( subfolder.resolve("a.xmir"), @@ -74,6 +76,7 @@ void returnsListOfSavedFilesWithoutDirectory(@TempDir final Path temp) throws IO ) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", footprint.list("o"), Matchers.containsInAnyOrder( subfolder.resolve("c.o"), @@ -81,6 +84,7 @@ void returnsListOfSavedFilesWithoutDirectory(@TempDir final Path temp) throws IO ) ); MatcherAssert.assertThat( + "EMPTY 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 68487cd6e3..ad5e735fa9 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 @@ -45,8 +45,16 @@ void cachesHashAndInvokesDelegateOnlyOnce() { } ); for (int idx = 0; idx < 10; ++idx) { - MatcherAssert.assertThat(cached.value(), Matchers.equalTo("dummy")); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + cached.value(), + Matchers.equalTo("dummy") + ); } - MatcherAssert.assertThat(invocations.get(), Matchers.equalTo(1)); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + invocations.get(), + Matchers.equalTo(1) + ); } } 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 1a323466e8..993a956e1e 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 @@ -62,6 +62,10 @@ void returnsCorrectHashByPattern( final String tag, final String expected ) { - MatcherAssert.assertThat(new ChPattern(pattern, tag).value(), Matchers.equalTo(expected)); + MatcherAssert.assertThat( + "EMPTY 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 fbe031dadc..72d4f7e8a4 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 @@ -42,6 +42,7 @@ final class ChRemoteTest { void getsCommitHashTag() { final String hash = new ChRemote("0.26.0").value(); MatcherAssert.assertThat( + "EMPTY MESSAGE", hash, Matchers.equalTo("e0b783692ef749bb184244acb2401f551388a328") ); @@ -51,6 +52,7 @@ void getsCommitHashTag() { void getsCommitHashOldTag() { final String hash = new ChRemote("0.23.19").value(); MatcherAssert.assertThat( + "EMPTY MESSAGE", hash, Matchers.equalTo("4b19944d86058e3c81e558340a3a13bc335a2b48") ); 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 ba4b93e64b..2a4400e8c3 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 @@ -84,12 +84,17 @@ void readsCorrectHashByTagFromFile( final String hash, final String tag ) { - MatcherAssert.assertThat(new ChText(ChTextTest.file, tag).value(), Matchers.equalTo(hash)); + MatcherAssert.assertThat( + "EMPTY MESSAGE", + new ChText(ChTextTest.file, tag).value(), + Matchers.equalTo(hash) + ); } @Test void readsCorrectHashByTagFromSimpleString() { MatcherAssert.assertThat( + "EMPTY MESSAGE", new ChText( () -> "434868a411b9741fdd4f8a38a5c576e8733345c9 gh-pages", "gh-pages" 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 ea36242c0b..b82ad8299e 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 @@ -39,6 +39,11 @@ */ final class ObjectsIndexTest { + /** + * Empty message for JUnit Assertions. + */ + private static final String EMPTY_MSG = "EMPTY MESSAGE"; + @Test void contains() throws Exception { final AtomicInteger calls = new AtomicInteger(0); @@ -52,18 +57,22 @@ void contains() throws Exception { ) ); MatcherAssert.assertThat( + ObjectsIndexTest.EMPTY_MSG, index.contains(object), Matchers.is(true) ); MatcherAssert.assertThat( + ObjectsIndexTest.EMPTY_MSG, index.contains(object), Matchers.is(true) ); MatcherAssert.assertThat( + ObjectsIndexTest.EMPTY_MSG, index.contains("unknown"), Matchers.is(false) ); MatcherAssert.assertThat( + ObjectsIndexTest.EMPTY_MSG, calls.get(), Matchers.is(1) ); @@ -73,6 +82,7 @@ void contains() throws Exception { @ExtendWith(WeAreOnline.class) void downloadsAndChecksFromRealSource() throws Exception { MatcherAssert.assertThat( + ObjectsIndexTest.EMPTY_MSG, 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 e132c2d4d4..181d0354ff 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 @@ -45,6 +45,7 @@ final class OyCachingTest { void putsObjectToLocalCache(@TempDir final Path path) throws Exception { final String content = "[] > main\n"; MatcherAssert.assertThat( + "EMPTY MESSAGE", new TextOf( new OyCaching( "master", @@ -68,6 +69,7 @@ void checksPresenceOfObject(@TempDir final Path path) throws Exception { Paths.get("pulled/master/org/example/main.eo") ); MatcherAssert.assertThat( + "EMPTY MESSAGE", new OyCaching( "master", path, 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 f0dfeb63f4..2661e2743a 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 @@ -37,9 +37,16 @@ * @since 1.0 */ final class OyFallbackSwapTest { + + /** + * Empty message for JUnit Assertions. + */ + private static final String EMPTY_MSG = "EMPTY MESSAGE"; + @Test void getsWithFallbackNoSwapOy() throws Exception { MatcherAssert.assertThat( + OyFallbackSwapTest.EMPTY_MSG, new TextOf( new OyFallbackSwap( new Objectionary.Fake(s -> new InputOf("[] > local\n")), @@ -54,6 +61,7 @@ void getsWithFallbackNoSwapOy() throws Exception { @Test void getsWithFallbackSwapOyFail() throws Exception { MatcherAssert.assertThat( + OyFallbackSwapTest.EMPTY_MSG, new TextOf( new OyFallbackSwap( new Objectionary.Fake(s -> new InputOf("[] > local\n")), @@ -72,6 +80,7 @@ void getsWithFallbackSwapOyFail() throws Exception { @Test void getsWithFallbackSwapOy() throws Exception { MatcherAssert.assertThat( + OyFallbackSwapTest.EMPTY_MSG, new TextOf( new OyFallbackSwap( new Objectionary.Fake(s -> new InputOf("[] > local\n")), @@ -98,6 +107,7 @@ void checksPresenceOfObject(@TempDir final Path path) throws Exception { ) ); MatcherAssert.assertThat( + OyFallbackSwapTest.EMPTY_MSG, new OyFallbackSwap( home, cache, @@ -106,6 +116,7 @@ void checksPresenceOfObject(@TempDir final Path path) throws Exception { Matchers.is(false) ); MatcherAssert.assertThat( + OyFallbackSwapTest.EMPTY_MSG, new TextOf( new OyFallbackSwap( home, @@ -116,6 +127,7 @@ void checksPresenceOfObject(@TempDir final Path path) throws Exception { Matchers.is(Matchers.notNullValue()) ); MatcherAssert.assertThat( + OyFallbackSwapTest.EMPTY_MSG, 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 6a98a6d3d6..ee4dde5977 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 @@ -39,6 +39,11 @@ * @since 1.0 */ final class OyFallbackTest { + + /** + * Empty message for JUnit Assertions. + */ + private static final String EMPTY_MSG = "EMPTY MESSAGE"; /** * Primary objectionary. @@ -63,14 +68,17 @@ void setUp() { @Test void getsObjectWhenPrimaryContains() throws Exception { MatcherAssert.assertThat( + OyFallbackTest.EMPTY_MSG, new TextOf(this.fallback.get("org.example.main")).asString(), Matchers.equalTo(this.primary.source) ); MatcherAssert.assertThat( + OyFallbackTest.EMPTY_MSG, this.primary.invocations.get(), Matchers.equalTo(1) ); MatcherAssert.assertThat( + OyFallbackTest.EMPTY_MSG, this.secondary.invocations.get(), Matchers.equalTo(0) ); @@ -79,14 +87,17 @@ void getsObjectWhenPrimaryContains() throws Exception { @Test void getsObjectWhenPrimaryNotContains() throws Exception { MatcherAssert.assertThat( + OyFallbackTest.EMPTY_MSG, new TextOf(this.fallback.get("org.example.secondary")).asString(), Matchers.equalTo(this.secondary.source) ); MatcherAssert.assertThat( + OyFallbackTest.EMPTY_MSG, this.primary.invocations.get(), Matchers.equalTo(1) ); MatcherAssert.assertThat( + OyFallbackTest.EMPTY_MSG, this.secondary.invocations.get(), Matchers.equalTo(1) ); @@ -95,18 +106,22 @@ void getsObjectWhenPrimaryNotContains() throws Exception { @Test void containsObject() throws IOException { MatcherAssert.assertThat( + OyFallbackTest.EMPTY_MSG, this.fallback.contains("org.example.main"), Matchers.is(true) ); MatcherAssert.assertThat( + OyFallbackTest.EMPTY_MSG, this.fallback.contains("org.example.absent"), Matchers.is(false) ); MatcherAssert.assertThat( + OyFallbackTest.EMPTY_MSG, this.primary.invocations.get(), Matchers.equalTo(2) ); MatcherAssert.assertThat( + OyFallbackTest.EMPTY_MSG, this.secondary.invocations.get(), Matchers.equalTo(1) ); @@ -115,6 +130,7 @@ void containsObject() throws IOException { @Test void convertsToString() { MatcherAssert.assertThat( + OyFallbackTest.EMPTY_MSG, 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 245326567b..cfb6441302 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 @@ -56,6 +56,7 @@ void containsObject(@TempDir final Path home) throws IOException { final String object = "org.eolang.found"; OyFilesystemTest.save(object, home); MatcherAssert.assertThat( + "EMPTY MESSAGE", objectionary.contains(object), Matchers.is(true) ); @@ -67,6 +68,7 @@ void containsObjectWithDefaultHome(@TempDir final Path home) throws IOException final String object = "org.eolang.ram"; OyFilesystemTest.save(object, home); MatcherAssert.assertThat( + "EMPTY MESSAGE", objectionary.contains(object), Matchers.is(true) ); @@ -92,6 +94,7 @@ void getsObjectSuccessfully(@TempDir final Path home) throws IOException { final String object = "org.eolang.get"; OyFilesystemTest.save(object, home); MatcherAssert.assertThat( + "EMPTY 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 9cf0d2281a..1c563ccac2 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 @@ -47,6 +47,7 @@ void resolvesObjectInLocalStorage(@TempDir final Path path) throws Exception { Paths.get("pulled/master/org/example/main.eo") ); MatcherAssert.assertThat( + "EMPTY MESSAGE", new TextOf( new OyHome("master", path) .get("org.example.main") @@ -63,6 +64,7 @@ void checksPresenceOfObjectInLocalStorage(@TempDir final Path path) throws Excep Paths.get("pulled/master/org/example/main.eo") ); MatcherAssert.assertThat( + "EMPTY MESSAGE", new TextOf( new OyHome("master", path) .get("org.example.main") @@ -70,6 +72,7 @@ void checksPresenceOfObjectInLocalStorage(@TempDir final Path path) throws Excep Matchers.is(content) ); MatcherAssert.assertThat( + "EMPTY 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 6aeac12edd..069199818c 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 @@ -47,6 +47,7 @@ final class OyIndexedTest { @Test void getsFromDelegate() throws Exception { MatcherAssert.assertThat( + "EMPTY 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" @@ -58,6 +59,7 @@ void getsFromDelegate() throws Exception { @ExtendWith(WeAreOnline.class) void containsInRealIndex() throws IOException { MatcherAssert.assertThat( + "EMPTY MESSAGE", new OyIndexed(new Objectionary.Fake()).contains(OyIndexedTest.STDOUT_OBJECT), Matchers.is(true) ); @@ -66,6 +68,7 @@ void containsInRealIndex() throws IOException { @Test void containsInFakeIndex() throws IOException { MatcherAssert.assertThat( + "EMPTY MESSAGE", new OyIndexed( new Objectionary.Fake(), new ObjectsIndex(() -> Collections.singleton(OyIndexedTest.STDOUT_OBJECT)) @@ -77,6 +80,7 @@ void containsInFakeIndex() throws IOException { @Test void checksContainsInDelegateIfExceptionHappensInIndex() throws IOException { MatcherAssert.assertThat( + "EMPTY 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 c6b9fbf57a..f70dd3717e 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 @@ -46,6 +46,7 @@ final class OyRemoteTest { @Test void buildsCorrectUrl() throws Exception { MatcherAssert.assertThat( + "EMPTY MESSAGE", new OyRemote.UrlOy( "https://raw/objectionary/home/%s/objects/%s.eo", "abcde" @@ -73,6 +74,7 @@ void checksPresenceOfObject() throws IOException { final CommitHash hash = new ChRemote("master"); final Objectionary objectionary = new OyRemote(hash); MatcherAssert.assertThat( + "EMPTY MESSAGE", objectionary.contains("org.eolang.io.stdout"), Matchers.is(true) ); 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 f200f6193a..fef6bad1f5 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 @@ -45,6 +45,7 @@ void savesCorrectly(@TempDir final Path temp) throws Exception { final Module module = new Module(content, name); module.save(new FtDefault(temp)); MatcherAssert.assertThat( + "EMPTY 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 a9eb075404..c051df9943 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 @@ -46,10 +46,12 @@ void solvesSameHashes(@TempDir final Path temp) { final String one = "AaAaAa"; final String two = "AaAaBB"; MatcherAssert.assertThat( + "EMPTY MESSAGE", one.hashCode(), Matchers.equalTo(two.hashCode()) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", dispatcher.name(one), Matchers.not( dispatcher.name(two) @@ -68,12 +70,14 @@ void recoversNames(@TempDir final Path temp) throws IOException { Collectors.toMap(loc -> loc, before::name) ); MatcherAssert.assertThat( + "EMPTY MESSAGE", locations.size(), Matchers.equalTo(functions.size()) ); before.save(); final Names after = new Names(temp.resolve(names)); MatcherAssert.assertThat( + "EMPTY 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 f1accafd44..fda2ce95ab 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 @@ -45,6 +45,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( + "EMPTY 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 3e3881ec5d..18dbb65e39 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 @@ -44,6 +44,7 @@ void savesCorrectly(@TempDir final Path temp) throws Exception { final String name = "name"; new PrimeModule(method, name).save(new FtDefault(temp)); MatcherAssert.assertThat( + "EMPTY 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 7212379062..f01467d837 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 @@ -68,6 +68,7 @@ void setUp() { void contains(final String name) { this.tojos.add(name); MatcherAssert.assertThat( + "EMPTY MESSAGE", this.tojos.contains(name), Matchers.is(true) ); @@ -82,6 +83,7 @@ void contains(final String name) { void doesNotContain(final String existing, final String considered) { this.tojos.add(existing); MatcherAssert.assertThat( + "EMPTY 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 47b2c5a22d..ec39c90c54 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 @@ -51,6 +51,11 @@ */ final class TranspiledTojosTest { + /** + * Empty message for JUnit Assertions. + */ + private static final String EMPTY_MSG = "EMPTY MESSAGE"; + /** * Transpiled files. */ @@ -94,6 +99,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.EMPTY_MSG, this.original.select(all -> true), Matchers.hasSize(1) ); @@ -107,18 +113,22 @@ void removesExistingTranspiledFiles() { this.tojos.add(this.transpiled.get(1), first); this.tojos.add(this.transpiled.get(2), second); MatcherAssert.assertThat( + TranspiledTojosTest.EMPTY_MSG, this.tojos.remove(first), Matchers.equalTo(1L) ); MatcherAssert.assertThat( + TranspiledTojosTest.EMPTY_MSG, this.tojos.remove(second), Matchers.equalTo(1L) ); MatcherAssert.assertThat( + TranspiledTojosTest.EMPTY_MSG, this.temp.toFile().listFiles(File::isFile), Matchers.arrayWithSize(1) ); MatcherAssert.assertThat( + TranspiledTojosTest.EMPTY_MSG, this.original.select(all -> true), Matchers.hasSize(3) ); @@ -127,14 +137,17 @@ void removesExistingTranspiledFiles() { @Test void removesAbsent() { MatcherAssert.assertThat( + TranspiledTojosTest.EMPTY_MSG, this.tojos.remove(Paths.get("absent.xmir")), Matchers.equalTo(0L) ); MatcherAssert.assertThat( + TranspiledTojosTest.EMPTY_MSG, this.temp.toFile().listFiles(File::isFile), Matchers.arrayWithSize(3) ); MatcherAssert.assertThat( + TranspiledTojosTest.EMPTY_MSG, 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 358ac63c1f..793c6faa9f 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 @@ -42,6 +42,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( + "EMPTY MESSAGE", new FileHash(path).toString(), Matchers.startsWith("[-26, 1, -29, 113, ") ); @@ -51,6 +52,7 @@ void readsFromExistingFile(@TempDir final Path temp) throws IOException { void readsFromAbsentFile(@TempDir final Path temp) { final Path path = temp.resolve("2.txt"); MatcherAssert.assertThat( + "EMPTY 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 d91639b7fa..58dd3942ac 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 @@ -46,6 +46,11 @@ * @since 0.22 */ final class HmBaseTest { + + /** + * Empty message for JUnit Assertions. + */ + private static final String EMPTY_MSG = "EMPTY MESSAGE"; @ValueSource(ints = {0, 100, 1_000, 10_000}) @ParameterizedTest @@ -54,6 +59,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.EMPTY_MSG, new UncheckedText(new TextOf(temp.resolve(resolve))).asString(), Matchers.is(content) ); @@ -64,6 +70,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.EMPTY_MSG, new HmBase(temp).exists(path), Matchers.is(true) ); @@ -75,6 +82,7 @@ void existsInDir(@TempDir final Path temp) throws IOException { target.getParent().toFile().mkdirs(); Files.write(target, "any content".getBytes()); MatcherAssert.assertThat( + HmBaseTest.EMPTY_MSG, new HmBase(temp.resolve("dir")).exists(Paths.get("subdir/file.txt")), Matchers.is(true) ); @@ -88,6 +96,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.EMPTY_MSG, new HmBase(directory).exists(Paths.get(filename)), Matchers.is(true) ); @@ -101,6 +110,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.EMPTY_MSG, new HmBase(directory).exists(Paths.get(filename)), Matchers.is(true) ); @@ -113,6 +123,7 @@ void loadsBytesFromExistingFile(@TempDir final Path temp) throws IOException { final Path subfolder = Paths.get("subfolder", "foo.txt"); home.save(content, subfolder); MatcherAssert.assertThat( + HmBaseTest.EMPTY_MSG, new TextOf(home.load(subfolder)), Matchers.equalTo(new TextOf(content)) ); 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 5167698604..801183f51f 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 @@ -53,6 +53,7 @@ void returnsRelativePathOfCurrentWorkingDirectory( @TempDir final Path temp ) { MatcherAssert.assertThat( + "EMPTY MESSAGE", new Rel(temp, temp.resolve(file)).toString(), Matchers.is(Paths.get(expected).toString()) ); @@ -61,6 +62,7 @@ void returnsRelativePathOfCurrentWorkingDirectory( @Test void returnsAbsolutePathIfBaseAndOtherFromDifferentHierarchies() { MatcherAssert.assertThat( + "EMPTY MESSAGE", new Rel( Paths.get("/a/b/c"), Paths.get("/d/e/f")