From 57fb112f425b159712a985170d501b6545077c76 Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:33:40 +0300 Subject: [PATCH 01/11] #2297 jtcop version up and assertThrows message resolve --- .../java/org/eolang/maven/BinarizeMojoTest.java | 9 ++++++--- .../test/java/org/eolang/maven/ParseMojoTest.java | 3 ++- .../test/java/org/eolang/maven/PhiMojoTest.java | 5 ++++- .../java/org/eolang/maven/ResolveMojoTest.java | 4 +++- .../test/java/org/eolang/maven/SafeMojoTest.java | 3 ++- .../java/org/eolang/maven/TranspileMojoTest.java | 3 ++- .../test/java/org/eolang/maven/VerifyMojoTest.java | 3 ++- .../dependencies/DcsEachWithoutTransitiveTest.java | 3 ++- .../java/org/eolang/maven/hash/ChNarrowTest.java | 3 ++- .../java/org/eolang/maven/hash/ChRemoteTest.java | 3 ++- .../java/org/eolang/maven/hash/ChTextTest.java | 3 ++- .../eolang/maven/objectionary/OyCachingTest.java | 3 ++- .../org/eolang/maven/objectionary/OyEmptyTest.java | 6 ++++-- .../eolang/maven/objectionary/OyRemoteTest.java | 3 ++- .../java/org/eolang/maven/util/HmBaseTest.java | 6 ++++-- .../test/java/org/eolang/parser/EoSyntaxTest.java | 3 ++- pom.xml | 14 +------------- 17 files changed, 44 insertions(+), 33 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 f3d1d12550..15082a4ce6 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 @@ -71,7 +71,8 @@ void binarizesWithoutErrors(@TempDir final Path temp) throws Exception { .withProgram(BinarizeMojoTest.SRC.resolve("twice-rust.eo")); } Assertions.assertDoesNotThrow( - () -> maven.execute(new FakeMaven.Binarize()) + () -> maven.execute(new FakeMaven.Binarize()), + "TO ADD ASSERTION MESSAGE" ); } @@ -85,7 +86,8 @@ void failsWithIncorrectInsert(@TempDir final Path temp) throws IOException { } Assertions.assertThrows( IllegalStateException.class, - () -> maven.execute(new FakeMaven.Binarize()) + () -> maven.execute(new FakeMaven.Binarize()), + "TO ADD ASSERTION MESSAGE" ); } @@ -121,7 +123,8 @@ void savesToCache(@TempDir final Path temp) throws IOException { ) ); Assertions.assertDoesNotThrow( - () -> maven.execute(new FakeMaven.Binarize()) + () -> maven.execute(new FakeMaven.Binarize()), + "TO ADD ASSERTION MESSAGE" ); } 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 3f65c1388f..0dbf434c52 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 @@ -81,7 +81,8 @@ void failsOnTimeout(@TempDir final Path temp) { () -> new FakeMaven(temp) .withHelloWorld() .with("timeout", 0) - .execute(InfiniteMojo.class) + .execute(InfiniteMojo.class), + "TO ADD ASSERTION MESSAGE" ); } 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 8c0b58b844..db407690ce 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 @@ -72,7 +72,10 @@ void convertsXmirsToPhiWithoutErrors(final String xmir, @TempDir final Path temp throws IOException { final FakeMaven maven = new FakeMaven(temp); new HmBase(temp).save(xmir, Paths.get("target/2-optimize/test.xmir")); - Assertions.assertDoesNotThrow(() -> maven.execute(PhiMojo.class)); + Assertions.assertDoesNotThrow( + () -> maven.execute(PhiMojo.class), + "TO ADD ASSERTION MESSAGE" + ); } @ParameterizedTest 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 58772b52de..d5d306ea19 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 @@ -209,7 +209,9 @@ void throwsExceptionWithTransitiveDependency(@TempDir final Path temp) { dependency ) ) - .execute(new FakeMaven.Resolve()) + .execute(new FakeMaven.Resolve()), + "TO ADD ASSERTION MESSAGE" + ); } 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 969113769e..59f7562cb4 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 @@ -45,7 +45,8 @@ void logsStackTrace(final Logs out, @TempDir final Path temp) { Assertions.assertDoesNotThrow( () -> new FakeMaven(temp) .withProgram("something > is definitely wrong here") - .execute(new FakeMaven.Parse()) + .execute(new FakeMaven.Parse()), + "TO ADD ASSERTION MESSAGE" ); MatcherAssert.assertThat( "TO ADD ASSERTION MESSAGE", 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 c9a35a0ade..2f4c034047 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 @@ -276,7 +276,8 @@ void throwsExpectionIfWasNotVerified( .execute(ParseMojo.class) .execute(OptimizeMojo.class) .execute(ShakeMojo.class) - .execute(TranspileMojo.class) + .execute(TranspileMojo.class), + "TO ADD ASSERTION MESSAGE" ); Assertions.assertTrue( out.captured().stream().anyMatch( 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 9ac19577e6..512ab01b3b 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 @@ -194,7 +194,8 @@ void failsOptimizationOnCritical(@TempDir final Path temp) { " TRUE > x", " FALSE > x" ).with("trackOptimizationSteps", true) - .execute(new FakeMaven.Verify()) + .execute(new FakeMaven.Verify()), + "TO ADD ASSERTION MESSAGE" ); } 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 9eb5ba3e39..9e222175c4 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 @@ -47,7 +47,8 @@ void failsIfHasTransitiveDependencies() { () -> new DcsEachWithoutTransitive( new DcsFake(), dep -> new DcsFake(100) - ).iterator().next() + ).iterator().next(), + "TO ADD ASSERTION MESSAGE" ); } 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 1c9eca7ba3..cbd119fae8 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 @@ -61,7 +61,8 @@ void cutsHashCorrectly(final String input, final String output) { void throwsExceptionIfEmpty() { Assertions.assertThrows( IllegalArgumentException.class, - () -> new ChNarrow(new CommitHash.ChConstant("")).value() + () -> new ChNarrow(new CommitHash.ChConstant("")).value(), + "TO ADD ASSERTION MESSAGE" ); } } 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 30d366e13d..b052fa8a70 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 @@ -62,7 +62,8 @@ void getsCommitHashOldTag() { void throwsCommitHashException() { Assertions.assertThrows( ChText.NotFound.class, - () -> new ChRemote("nonsense").value() + () -> new ChRemote("nonsense").value(), + "TO ADD ASSERTION 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 42b78565ea..7f23ef2f03 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 @@ -110,7 +110,8 @@ void readsHashByNonExistedTag() { () -> new ChText( () -> "434868a411b9741fdd4f8a38a5c576e8733345c9 gh-pages", "non-existent-tag" - ).value() + ).value(), + "TO ADD ASSERTION MESSAGE" ); } } 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 6b643a353a..14b0a55d66 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 @@ -58,7 +58,8 @@ void putsObjectToLocalCache(@TempDir final Path path) throws Exception { Assertions.assertTrue( path.resolve("pulled/master/org/example/main.eo") .toFile() - .exists() + .exists(), + "TO ADD ASSERTION MESSAGE" ); } 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 c7bbc4a879..3e9880ed15 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 @@ -38,7 +38,8 @@ final class OyEmptyTest { void resolvesObject() { Assertions.assertThrows( IOException.class, - () -> new OyEmpty().get("org.eolang.io.stdin") + () -> new OyEmpty().get("org.eolang.io.stdin"), + "TO ADD ASSERTION MESSAGE" ); } @@ -46,7 +47,8 @@ void resolvesObject() { void checksPresenceOfObject() { Assertions.assertThrows( IOException.class, - () -> new OyEmpty().contains("org.eolang.io.stdin") + () -> new OyEmpty().contains("org.eolang.io.stdin"), + "TO ADD ASSERTION MESSAGE" ); } } 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 b46c0b1cf1..f8abdb96cd 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 @@ -64,7 +64,8 @@ void throwsExceptionOnInvalidUrl() { () -> new OyRemote.UrlOy( "hts:raw.githubusercontent.com/objectionary/home/%s/objects/%s.eo", "abcde" - ).value("org.eolang.app") + ).value("org.eolang.app"), + "TO ADD ASSERTION MESSAGE" ); } 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 c1a12d3855..eeb3dbf7f0 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 @@ -133,7 +133,8 @@ void loadsBytesFromExistingFile(@TempDir final Path temp) throws IOException { void loadsFromAbsentFile(@TempDir final Path temp) { Assertions.assertThrows( NoSuchFileException.class, - () -> new HmBase(temp).load(Paths.get("nonexistent")) + () -> new HmBase(temp).load(Paths.get("nonexistent")), + "TO ADD ASSERTION MESSAGE" ); } @@ -141,7 +142,8 @@ void loadsFromAbsentFile(@TempDir final Path temp) { void throwsExceptionOnAbsolute(@TempDir final Path temp) { Assertions.assertThrows( IllegalArgumentException.class, - () -> new HmBase(temp).exists(temp.toAbsolutePath()) + () -> new HmBase(temp).exists(temp.toAbsolutePath()), + "TO ADD ASSERTION MESSAGE" ); } } diff --git a/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java b/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java index ed91b3887d..e00e7e10aa 100644 --- a/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java @@ -180,7 +180,8 @@ void parsesSuccessfully(final String code) { new InputOf(code) ); Assertions.assertDoesNotThrow( - syntax::parsed + syntax::parsed, + EoSyntaxTest.EMPTY_MSG ); } diff --git a/pom.xml b/pom.xml index f1a9cd9ee6..1d71e09cac 100644 --- a/pom.xml +++ b/pom.xml @@ -388,21 +388,9 @@ SOFTWARE. com.github.volodya-lombrozo jtcop-maven-plugin - 1.2.0 + 1.2.1 true - - - - JTCOP.RuleAssertionMessage - - From 11c140202cfb390aa4e16d18fd6012735de8a897 Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:20:51 +0300 Subject: [PATCH 02/11] #2297 add stub assertion messages for eo-runtime --- .../org/eolang/maven/ResolveMojoTest.java | 1 - .../test/java/EOorg/EOeolang/CagesTest.java | 16 +++++++--- .../java/EOorg/EOeolang/EOas_phiTest.java | 1 + .../java/EOorg/EOeolang/EOboolEOandTest.java | 1 + .../java/EOorg/EOeolang/EOboolEOnotTest.java | 1 + .../EOorg/EOeolang/EObytesEOconcatTest.java | 1 + .../test/java/EOorg/EOeolang/EOcageTest.java | 17 ++++++++-- .../test/java/EOorg/EOeolang/EOerrorTest.java | 4 ++- .../java/EOorg/EOeolang/EOintEOeqTest.java | 1 + .../java/EOorg/EOeolang/EOintEOltTest.java | 1 + .../java/EOorg/EOeolang/EOintEOminusTest.java | 1 + .../java/EOorg/EOeolang/EOintEOnegTest.java | 1 + .../java/EOorg/EOeolang/EOintEOplusTest.java | 1 + .../test/java/EOorg/EOeolang/EOintTest.java | 3 ++ .../java/EOorg/EOeolang/EOio/EOstdinTest.java | 13 ++++++++ .../EOorg/EOeolang/EOio/EOstdoutTest.java | 4 +++ .../java/EOorg/EOeolang/EOmemoryTest.java | 19 ++++++++++-- .../test/java/EOorg/EOeolang/EOseqTest.java | 2 ++ .../EOorg/EOeolang/EOstringEOasBytesTest.java | 1 + .../EOorg/EOeolang/EOstringEOsliceTest.java | 1 + .../java/EOorg/EOeolang/EOstringTest.java | 2 ++ .../test/java/EOorg/EOeolang/EOtryTest.java | 5 +++ .../java/EOorg/EOeolang/EOtupleEOatTest.java | 8 ++++- .../test/java/EOorg/EOeolang/HeapsTest.java | 31 +++++++++++++------ .../test/java/org/eolang/AtCompositeTest.java | 7 +++-- .../test/java/org/eolang/AtLoggedTest.java | 9 ++++++ .../src/test/java/org/eolang/AtNamedTest.java | 1 + .../src/test/java/org/eolang/BytesOfTest.java | 16 ++++++++-- .../src/test/java/org/eolang/DataTest.java | 7 +++++ .../test/java/org/eolang/DataizedTest.java | 4 +++ .../java/org/eolang/ExInterruptedTest.java | 3 +- .../test/java/org/eolang/JavaPathTest.java | 1 + .../src/test/java/org/eolang/MainTest.java | 11 +++++++ .../src/test/java/org/eolang/PhCopyTest.java | 2 ++ .../src/test/java/org/eolang/PhDataTest.java | 2 ++ .../test/java/org/eolang/PhDefaultTest.java | 27 +++++++++++++--- .../test/java/org/eolang/PhLocatedTest.java | 1 + .../test/java/org/eolang/PhLoggedTest.java | 6 ++++ .../test/java/org/eolang/PhMethodTest.java | 21 +++++++++++-- .../src/test/java/org/eolang/PhNamedTest.java | 2 ++ .../test/java/org/eolang/PhPackageTest.java | 22 ++++++++++--- .../src/test/java/org/eolang/PhWithTest.java | 7 +++++ .../src/test/java/org/eolang/PhiTest.java | 4 +++ .../java/org/eolang/UniverseDefaultTest.java | 14 +++++++-- .../org/eolang/VerboseBytesAsStringTest.java | 1 + .../test/java/org/eolang/VerticesTest.java | 2 ++ pom.xml | 2 +- 47 files changed, 267 insertions(+), 41 deletions(-) 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 d5d306ea19..40d7e3f1e5 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 @@ -211,7 +211,6 @@ void throwsExceptionWithTransitiveDependency(@TempDir final Path temp) { ) .execute(new FakeMaven.Resolve()), "TO ADD ASSERTION MESSAGE" - ); } diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/CagesTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/CagesTest.java index 54a086e2e3..27b31c9afa 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/CagesTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/CagesTest.java @@ -46,7 +46,8 @@ void initializesObjectForTheFirstTime() { final Phi phi = new PhFake(); final int locator = Cages.INSTANCE.init(phi); Assertions.assertDoesNotThrow( - () -> Cages.INSTANCE.get(locator) + () -> Cages.INSTANCE.get(locator), + "TO ADD ASSERTION MESSAGE" ); } @@ -55,7 +56,8 @@ void rencagesTheSameObject() { final Phi phi = new PhFake(); Cages.INSTANCE.init(phi); Assertions.assertDoesNotThrow( - () -> Cages.INSTANCE.init(phi) + () -> Cages.INSTANCE.init(phi), + "TO ADD ASSERTION MESSAGE" ); } @@ -66,6 +68,7 @@ void encagesObjectWithLocator() { final int locator = Cages.INSTANCE.init(first); Cages.INSTANCE.encage(locator, second); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", Cages.INSTANCE.get(locator).hashCode(), Matchers.equalTo(second.hashCode()) ); @@ -76,7 +79,8 @@ void failsToEncageObjectIfIsWasInitialized() { final Phi phi = new PhFake(); Assertions.assertThrows( ExFailure.class, - () -> Cages.INSTANCE.encage(phi.hashCode(), phi) + () -> Cages.INSTANCE.encage(phi.hashCode(), phi), + "TO ADD ASSERTION MESSAGE" ); } @@ -85,7 +89,8 @@ void failsToEncageObjectOfDifferentForma() { final int locator = Cages.INSTANCE.init(new PhFake()); Assertions.assertThrows( ExFailure.class, - () -> Cages.INSTANCE.encage(locator, new Data.ToPhi(5L)) + () -> Cages.INSTANCE.encage(locator, new Data.ToPhi(5L)), + "TO ADD ASSERTION MESSAGE" ); } @@ -93,7 +98,8 @@ void failsToEncageObjectOfDifferentForma() { void failsToGetObjectIfWasNotInitialized() { Assertions.assertThrows( ExFailure.class, - () -> Cages.INSTANCE.get(new PhFake().hashCode()) + () -> Cages.INSTANCE.get(new PhFake().hashCode()), + "TO ADD ASSERTION MESSAGE" ); } } diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOas_phiTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOas_phiTest.java index 3ba0f23d41..6a3d701c07 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOas_phiTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOas_phiTest.java @@ -46,6 +46,7 @@ final class EOas_phiTest { @Test void printsAndReturns() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( new EOas_phi(Phi.Φ), diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOboolEOandTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOboolEOandTest.java index 6b279b1882..54d44b536f 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOboolEOandTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOboolEOandTest.java @@ -49,6 +49,7 @@ void joinsTwoValuesLogically() { final Phi and = left.take("and"); and.put(0, right); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(and).take(Boolean.class), Matchers.equalTo(false) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOboolEOnotTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOboolEOnotTest.java index 0dfb055892..5980832f65 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOboolEOnotTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOboolEOnotTest.java @@ -50,6 +50,7 @@ void inversesValue() { final Phi left = new Data.ToPhi(true); final Phi not = left.take("not"); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(not).take(Boolean.class), Matchers.equalTo(false) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EObytesEOconcatTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EObytesEOconcatTest.java index 869f637478..40ce566c3f 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EObytesEOconcatTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EObytesEOconcatTest.java @@ -57,6 +57,7 @@ void concatenatesBytes() { "as-string" ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(phi).take(String.class), Matchers.equalTo("привет mr. ㄤㄠ!") ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOcageTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOcageTest.java index 32b58d2e8a..3c57510a15 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOcageTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOcageTest.java @@ -62,6 +62,7 @@ final class EOcageTest { void encagesViaApplication() { final Phi cage = EOcageTest.encaged(new Data.ToPhi(1L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(cage).take(Long.class), Matchers.equalTo(1L) ); @@ -72,6 +73,7 @@ void encagesAndFrees() { final Phi cage = EOcageTest.encaged(new Data.ToPhi(1L)); EOcageTest.encageTo(cage, new Data.ToPhi(2L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(cage).take(Long.class), Matchers.equalTo(2L) ); @@ -86,6 +88,7 @@ void overwritesCagedObject() { ) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(new PhMethod(cage, "x")).take(Long.class), Matchers.equalTo(1L) ); @@ -97,6 +100,7 @@ void overwritesCagedObject() { ) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(new PhMethod(cage, "x")).take(Long.class), Matchers.equalTo(2L) ); @@ -108,6 +112,7 @@ void encagesObjectOnCopy() { final Phi second = first.copy(); EOcageTest.encageTo(second, new Data.ToPhi(2L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(first).take(Long.class), Matchers.equalTo(2L) ); @@ -117,11 +122,13 @@ void encagesObjectOnCopy() { void writesAndRewritesPrimitive() { final Phi cage = EOcageTest.encaged(new Data.ToPhi(1L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(cage).take(Long.class), Matchers.equalTo(1L) ); EOcageTest.encageTo(cage, new Data.ToPhi(5L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(cage).take(Long.class), Matchers.equalTo(5L) ); @@ -132,7 +139,8 @@ void doesNotWritePrimitivesFormedDifferently() { final Phi cage = EOcageTest.encaged(new Data.ToPhi(1L)); Assertions.assertThrows( EOerror.ExError.class, - () -> EOcageTest.encageTo(cage, new Data.ToPhi("Hello world")) + () -> EOcageTest.encageTo(cage, new Data.ToPhi("Hello world")), + "TO ADD ASSERTION MESSAGE" ); } @@ -147,7 +155,8 @@ void doesNotWriteBoundedMethod() { final Phi cage = EOcageTest.encaged(five); Assertions.assertThrows( EOerror.ExError.class, - () -> EOcageTest.encageTo(cage, ten) + () -> EOcageTest.encageTo(cage, ten), + "TO ADD ASSERTION MESSAGE" ); } @@ -158,7 +167,8 @@ void writesBoundedCopyOfTheSameBase() { () -> EOcageTest.encageTo( EOcageTest.encaged(dummy), new PhWith(new PhCopy(dummy), "x", new Data.ToPhi("Hello world")) - ) + ), + "TO ADD ASSERTION MESSAGE" ); } @@ -218,6 +228,7 @@ void doesNotThrowIfDataizesConcurrently() { ); final int threads = 500; MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new SumOf( new Threads<>( threads, diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOerrorTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOerrorTest.java index 845a9b2870..0fb84577e9 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOerrorTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOerrorTest.java @@ -62,7 +62,8 @@ void makesToxicObject() { "message", new Data.ToPhi("intentional error") ) - ).take() + ).take(), + "TO ADD ASSERTION MESSAGE" ); } @@ -77,6 +78,7 @@ void getsReadableError(final Object cnst) { } assert error != null; MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", error.toString(), Matchers.containsString( new VerboseBytesAsStringTest.ArgumentsUtils().toString(cnst) diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOeqTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOeqTest.java index c1dc6124de..e6b560cf1e 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOeqTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOeqTest.java @@ -59,6 +59,7 @@ void comparesWithAnotherNumber() { 0, right ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(eql).take(Boolean.class), Matchers.equalTo(false) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOltTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOltTest.java index a520494a6c..c7a4f64956 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOltTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOltTest.java @@ -52,6 +52,7 @@ void comparesWithAnotherNumber() { final Phi less = left.take("lt"); less.put(0, right); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(less).take(Boolean.class), Matchers.equalTo(false) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOminusTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOminusTest.java index bb17e894f6..f70f36df84 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOminusTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOminusTest.java @@ -56,6 +56,7 @@ void subtractsNumber() { 0, right ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(sub).take(Long.class), Matchers.equalTo(29L) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOnegTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOnegTest.java index 0efbf11bde..9eaae846fb 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOnegTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOnegTest.java @@ -51,6 +51,7 @@ void negatesNumber() { final Phi left = new Data.ToPhi(42L); final Phi neg = new PhMethod(left, "neg"); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(neg).take(Long.class), Matchers.equalTo(-42L) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOplusTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOplusTest.java index afea2875d8..5a9e8bb818 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOplusTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOplusTest.java @@ -49,6 +49,7 @@ void addsNumbers() { final Phi add = left.take("plus"); add.put(0, right); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(add).take(Long.class), Matchers.equalTo(55L) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintTest.java index 2158e12494..9b869f0810 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintTest.java @@ -46,6 +46,7 @@ void hasDifferentHashes() { final Phi left = new Data.ToPhi(42L); final Phi right = new Data.ToPhi(42L); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", left.hashCode(), Matchers.not(Matchers.equalTo(right.hashCode())) ); @@ -55,6 +56,7 @@ void hasDifferentHashes() { void hasHashEvenWithoutData() { final Phi phi = new EOint(Phi.Φ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", phi.hashCode(), Matchers.greaterThan(0) ); @@ -65,6 +67,7 @@ void hasDifferentHash() { final Phi raw = new EOint(Phi.Φ); final Phi initialized = new Data.ToPhi(0L); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", raw.hashCode(), Matchers.not(initialized.hashCode()) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdinTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdinTest.java index c9830c87fa..f89d88244f 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdinTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdinTest.java @@ -62,6 +62,7 @@ final class EOstdinTest { @AfterAll static void restoreSystemInput() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", System.in, Matchers.equalTo(EOstdinTest.DEFAULT_STDIN) ); @@ -89,6 +90,7 @@ void dataizesNextLineOneLine(final StdIn stdin) { final Phi phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); final String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.equalTo(expected) ); @@ -101,6 +103,7 @@ void dataizesStdinOneLine(final StdIn stdin) { final Phi phi = new PhCopy(new EOstdin(Phi.Φ)); final String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.equalTo(expected) ); @@ -113,6 +116,7 @@ void dataizesNextLineMultiLine(final StdIn stdin) { final Phi phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); final String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.equalTo(expected) ); @@ -127,6 +131,7 @@ void dataizesNextLineEmpty(final StdIn stdin) { () -> new Dataized(phi).take(String.class) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(error.enclosure()).take(String.class), Matchers.containsString( "There is no line in the standard input stream to consume" @@ -138,6 +143,7 @@ void dataizesNextLineEmpty(final StdIn stdin) { @Test void dataizesEmptyStdin(final StdIn stdin) { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(new EOstdin(Phi.Φ)).take(String.class), Matchers.equalTo(System.lineSeparator()) ); @@ -152,6 +158,7 @@ void dataizesStdinMultiLine(final StdIn stdin) { final Phi phi = new PhCopy(new EOstdin(Phi.Φ)); final String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.equalTo(first + second + third) ); @@ -166,18 +173,21 @@ void dataizesStdinFewOneLine(final StdIn stdin) { Phi phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.equalTo(first) ); phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.equalTo(second) ); phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.equalTo(third) ); @@ -191,18 +201,21 @@ void dataizesStdinEmptyLineBetweenNonEmpty(final StdIn stdin) { Phi phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.equalTo(first) ); phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.equalTo("") ); phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.equalTo(third) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdoutTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdoutTest.java index e90042c91c..8586fbe922 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdoutTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdoutTest.java @@ -66,6 +66,7 @@ public void printsFromTuple() { stdout.put(0, ret); new Dataized(stdout).take(Boolean.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", stream.toString(), Matchers.equalTo("Hello") ); @@ -80,6 +81,7 @@ public void printsString() { format ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(phi).take(Boolean.class), Matchers.equalTo(true) ); @@ -105,6 +107,7 @@ public void doesNotPrintTwiceOnIntComparisonMethods(final String method) { ) ).take(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", stream.toString(), Matchers.equalTo(str) ); @@ -130,6 +133,7 @@ public void doesNotPrintTwiceOnFloatComparisonMethods(final String method) { ) ).take(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", stream.toString(), Matchers.equalTo(str) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOmemoryTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOmemoryTest.java index 9f9265f24b..6f3897a4ed 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOmemoryTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOmemoryTest.java @@ -55,6 +55,7 @@ public final class EOmemoryTest { void behavesAsBytes() { final Phi alloc = EOmemoryTest.allocated(new Data.ToPhi(1L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(alloc.take("as-int")).take(Long.class), Matchers.equalTo(1L) ); @@ -64,6 +65,7 @@ void behavesAsBytes() { void comparesWithInt() { final Phi alloc = EOmemoryTest.allocated(new Data.ToPhi(2L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( new PhMethod( @@ -81,6 +83,7 @@ void comparesWithInt() { void hasTheSameDataAfterCopy() { final Phi alloc = EOmemoryTest.allocated(new Data.ToPhi(2L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(alloc).take(), Matchers.equalTo(new Dataized(alloc.copy()).take()) ); @@ -91,6 +94,7 @@ void writesDataToNewMemorySegment() { final Phi first = EOmemoryTest.allocated(new Data.ToPhi(1L)); final Phi second = EOmemoryTest.allocated(new Data.ToPhi(2L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(first).take(), Matchers.not(Matchers.equalTo(new Dataized(second).take())) ); @@ -101,6 +105,7 @@ void rewritesToTheSameSegment() { final Phi alloc = EOmemoryTest.allocated(new Data.ToPhi(1L)); new Dataized(new PhWith(alloc.take("write").copy(), 0, new Data.ToPhi(10L))).take(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(alloc).take(Long.class), Matchers.equalTo(10L) ); @@ -110,6 +115,7 @@ void rewritesToTheSameSegment() { void takesAsIntAndUpdates() { final Phi alloc = EOmemoryTest.allocated(new Data.ToPhi(1L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( alloc.take("as-int").take("plus").copy(), @@ -124,6 +130,7 @@ void takesAsIntAndUpdates() { void getsWrittenValueRightAfterWriting() { final Phi mem = EOmemoryTest.allocated(new Data.ToPhi(1L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( mem.take(EOmemoryTest.WRITE).copy(), @@ -144,6 +151,7 @@ void comparesForEquality() { ) ).take(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( new PhCopy(new PhMethod(mem, "eq")), @@ -164,6 +172,7 @@ void writesAndRewrites() { ) ).take(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(mem.take("as-int")).take(Long.class), Matchers.equalTo(1L) ); @@ -174,6 +183,7 @@ void writesAndRewrites() { ) ).take(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(mem.take("as-int")).take(Long.class), Matchers.equalTo(5L) ); @@ -193,6 +203,7 @@ void doesNotCompareOnFly() { 0, new Data.ToPhi(10L) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(less).take(Boolean.class), Matchers.equalTo(true) ); @@ -203,6 +214,7 @@ void doesNotCompareOnFly() { ) ).take(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(less).take(Boolean.class), Matchers.not(Matchers.equalTo(false)) ); @@ -222,6 +234,7 @@ void rewritesItself() { ) ).take(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(mem.take("as-int")).take(Long.class), Matchers.equalTo(43L) ); @@ -237,7 +250,8 @@ void doesNotWriteMoreThanAllocated() { mem.take(EOmemoryTest.WRITE), 0, new Data.ToPhi(8L) ) - ).take() + ).take(), + "TO ADD ASSERTION MESSAGE" ); } @@ -249,7 +263,8 @@ void writesLessAndRewritesTheSame() { Assertions.assertDoesNotThrow( () -> new Dataized( new PhWith(write.copy(), 0, new Data.ToPhi(1L)) - ).take() + ).take(), + "TO ADD ASSERTION MESSAGE" ); } diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOseqTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOseqTest.java index 51c173bd58..7f9eae6cad 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOseqTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOseqTest.java @@ -45,6 +45,7 @@ public final class EOseqTest { @Test public void calculatesAndReturns() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( new EOseq(Phi.Φ), @@ -65,6 +66,7 @@ public void calculatesAndReturns() { @Test public void calculatesAndReturnsObject() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( new EOseq(Phi.Φ), diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOasBytesTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOasBytesTest.java index 1d8848c90e..b314cddf4f 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOasBytesTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOasBytesTest.java @@ -48,6 +48,7 @@ void convertsStringToBytes() { final Phi str = new Data.ToPhi("Hello, друг!"); final Phi phi = str.take("as-bytes"); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(phi).take(byte[].class).length, Matchers.equalTo(16) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOsliceTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOsliceTest.java index 7f2443cda4..759529b549 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOsliceTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOsliceTest.java @@ -57,6 +57,7 @@ void slicesString() { new Data.ToPhi(1L) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(phi).take(String.class), Matchers.equalTo("ㄤ") ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringTest.java index 396674dc33..f62451c970 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringTest.java @@ -50,6 +50,7 @@ final class EOstringTest { void comparesTwoEqualStrings() { final String txt = "Hello, друг!"; MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( new PhMethod(new Data.ToPhi(txt), "eq"), @@ -63,6 +64,7 @@ void comparesTwoEqualStrings() { @Test void comparesTwoDifferentStrings() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( new PhMethod(new Data.ToPhi("Hello, друг!"), "eq"), diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOtryTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOtryTest.java index 0a8fc276b5..eb75b2e8e9 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOtryTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOtryTest.java @@ -50,6 +50,7 @@ public final class EOtryTest { @Test public void catchesException() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( new PhWith( @@ -81,6 +82,7 @@ public void usesCatcherOutput() { new Data.ToPhi(true) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(body).take(String.class), Matchers.containsString("it is broken") ); @@ -100,6 +102,7 @@ public void printsCatcherOutput() { new Data.ToPhi(true) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(body).take(String.class), Matchers.containsString("it is broken") ); @@ -108,6 +111,7 @@ public void printsCatcherOutput() { @Test public void worksWithoutException() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( new PhWith( @@ -134,6 +138,7 @@ public void doesNotDataizeBodyTwice() { trier.put(2, new Data.ToPhi(true)); new Dataized(trier).take(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", main.count, Matchers.equalTo(1) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOtupleEOatTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOtupleEOatTest.java index 68bd6d61ff..fc6b6dc771 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOtupleEOatTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOtupleEOatTest.java @@ -63,10 +63,12 @@ void pushesAndGetsBack() { final Phi get = tuple.take("at").copy(); get.put(0, idx); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(get).take(String.class), Matchers.equalTo(txt) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(get).take(String.class), Matchers.equalTo(txt) ); @@ -75,10 +77,12 @@ void pushesAndGetsBack() { @Test void checksNegativeIndex() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(this.get(-1L)).take(String.class), Matchers.equalTo("second") ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(this.get(-2L)).take(String.class), Matchers.equalTo("first") ); @@ -88,7 +92,8 @@ void checksNegativeIndex() { void checksOutOfBounds() { Assertions.assertThrows( EOerror.ExError.class, - () -> new Dataized(this.get(-3L)).take() + () -> new Dataized(this.get(-3L)).take(), + "TO ADD ASSERTION MESSAGE" ); } @@ -104,6 +109,7 @@ void returnsGivenArgument() { "args", copy ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(phi).take(Long.class), Matchers.equalTo(10L) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java index a8362cf92a..0320f27b3a 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java @@ -50,7 +50,8 @@ public final class HeapsTest { void allocatesMemory() { final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 10); Assertions.assertDoesNotThrow( - () -> HeapsTest.HEAPS.read(idx, 0, 10) + () -> HeapsTest.HEAPS.read(idx, 0, 10), + "TO ADD ASSERTION MESSAGE" ); HeapsTest.HEAPS.free(idx); } @@ -61,7 +62,8 @@ void failsOnDoubleAllocation() { final int idx = HeapsTest.HEAPS.malloc(phi, 10); Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.malloc(phi, 10) + () -> HeapsTest.HEAPS.malloc(phi, 10), + "TO ADD ASSERTION MESSAGE" ); HeapsTest.HEAPS.free(idx); } @@ -70,6 +72,7 @@ void failsOnDoubleAllocation() { void allocatesAndReadsEmptyBytes() { final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", HeapsTest.HEAPS.read(idx, 0, 5), Matchers.equalTo(new byte[] {0, 0, 0, 0, 0}) ); @@ -82,6 +85,7 @@ void writesAndReads() { final byte[] bytes = new byte[] {1, 2, 3, 4, 5}; HeapsTest.HEAPS.write(idx, 0, bytes); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", HeapsTest.HEAPS.read(idx, 0, bytes.length), Matchers.equalTo(bytes) ); @@ -92,7 +96,8 @@ void writesAndReads() { void failsOnWriteToEmptyBlock() { Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.write(new PhFake().hashCode(), 0, new byte[] {0x01}) + () -> HeapsTest.HEAPS.write(new PhFake().hashCode(), 0, new byte[] {0x01}), + "TO ADD ASSERTION MESSAGE" ); } @@ -100,7 +105,8 @@ void failsOnWriteToEmptyBlock() { void failsOnReadFromEmptyBlock() { Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.read(new PhFake().hashCode(), 0, 1) + () -> HeapsTest.HEAPS.read(new PhFake().hashCode(), 0, 1), + "TO ADD ASSERTION MESSAGE" ); } @@ -109,7 +115,8 @@ void failsOnReadIfOutOfBounds() { final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 2); Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.read(idx, 1, 3) + () -> HeapsTest.HEAPS.read(idx, 1, 3), + "TO ADD ASSERTION MESSAGE" ); } @@ -118,6 +125,7 @@ void readsByOffsetAndLength() { final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); HeapsTest.HEAPS.write(idx, 0, new byte[] {1, 2, 3, 4, 5}); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", HeapsTest.HEAPS.read(idx, 1, 3), Matchers.equalTo(new byte[] {2, 3, 4}) ); @@ -129,7 +137,8 @@ void failsOnWriteMoreThanAllocated() { final byte[] bytes = new byte[] {1, 2, 3, 4, 5}; Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.write(idx, 0, bytes) + () -> HeapsTest.HEAPS.write(idx, 0, bytes), + "TO ADD ASSERTION MESSAGE" ); HeapsTest.HEAPS.free(idx); } @@ -140,7 +149,8 @@ void failsToWriteMoreThanAllocatedWithOffset() { final byte[] bytes = new byte[] {1, 2, 3}; Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.write(idx, 1, bytes) + () -> HeapsTest.HEAPS.write(idx, 1, bytes), + "TO ADD ASSERTION MESSAGE" ); HeapsTest.HEAPS.free(idx); } @@ -151,6 +161,7 @@ void concatsOnWriteLessThanAllocated() { HeapsTest.HEAPS.write(idx, 0, new byte[] {1, 1, 3, 4, 5}); HeapsTest.HEAPS.write(idx, 2, new byte[] {2, 2}); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", HeapsTest.HEAPS.read(idx, 0, 5), Matchers.equalTo(new byte[] {1, 1, 2, 2, 5}) ); @@ -163,7 +174,8 @@ void freesSuccessfully() { HeapsTest.HEAPS.free(idx); Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.read(idx, 0, 5) + () -> HeapsTest.HEAPS.read(idx, 0, 5), + "TO ADD ASSERTION MESSAGE" ); } @@ -171,7 +183,8 @@ void freesSuccessfully() { void failsOnClearingEmptyBlock() { Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.free(new PhFake().hashCode()) + () -> HeapsTest.HEAPS.free(new PhFake().hashCode()), + "TO ADD ASSERTION MESSAGE" ); } } diff --git a/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java b/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java index 01a8915dfd..cb7101d4d9 100644 --- a/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java +++ b/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java @@ -45,7 +45,8 @@ void decoratesCheckedException() { self -> { throw new InstantiationException("intended checked"); } - ).get() + ).get(), + "TO ADD ASSERTION MESSAGE" ); } @@ -58,7 +59,8 @@ void decoratesUncheckedException() { self -> { throw new IllegalStateException("intended unchecked"); } - ).get() + ).get(), + "TO ADD ASSERTION MESSAGE" ); } @@ -67,6 +69,7 @@ void goesThroughJustOnce() { final Phi rnd = new Rnd(); final Phi phi = new PhMethod(rnd, Attr.LAMBDA); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(phi).take(Double.class), Matchers.equalTo( new Dataized(phi).take(Double.class) diff --git a/eo-runtime/src/test/java/org/eolang/AtLoggedTest.java b/eo-runtime/src/test/java/org/eolang/AtLoggedTest.java index 7397b0e46b..fe45795332 100644 --- a/eo-runtime/src/test/java/org/eolang/AtLoggedTest.java +++ b/eo-runtime/src/test/java/org/eolang/AtLoggedTest.java @@ -87,6 +87,7 @@ void setUp() { @Test void convertsToStringAsOrigin() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", this.logged.toString(), Matchers.equalTo(this.origin.toString()) ); @@ -95,6 +96,7 @@ void convertsToStringAsOrigin() { @Test void convertsToPhiTermAsOrigin() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", this.logged.φTerm(), Matchers.equalTo(this.origin.φTerm()) ); @@ -104,10 +106,12 @@ void convertsToPhiTermAsOrigin() { void copiesWithLogging() { this.logged.copy(Phi.Φ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", this.log(), Matchers.containsString(String.format(" %s.copy()...", this.label)) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", this.log(), Matchers.containsString(String.format(" %s.copy()!", this.label)) ); @@ -116,14 +120,17 @@ void copiesWithLogging() { @Test void getsWithLogging() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", this.logged.get(), Matchers.equalTo(this.origin.get()) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", this.log(), Matchers.containsString(String.format(" %s.get()...", this.label)) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", this.log(), Matchers.containsString(String.format(" %s.get()!", this.label)) ); @@ -133,10 +140,12 @@ void getsWithLogging() { void putsWithLogging() { this.put.put(Phi.Φ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", this.log(), Matchers.containsString(String.format(" %s.put()...", this.label)) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", this.log(), Matchers.containsString(String.format(" %s.put()!", this.label)) ); diff --git a/eo-runtime/src/test/java/org/eolang/AtNamedTest.java b/eo-runtime/src/test/java/org/eolang/AtNamedTest.java index ee12dda7dd..2b991b6218 100644 --- a/eo-runtime/src/test/java/org/eolang/AtNamedTest.java +++ b/eo-runtime/src/test/java/org/eolang/AtNamedTest.java @@ -44,6 +44,7 @@ void rethrowsCorrectly() { () -> phi.take("x").take("anything") ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(error.enclosure()).take(String.class), Matchers.allOf( Matchers.containsString( diff --git a/eo-runtime/src/test/java/org/eolang/BytesOfTest.java b/eo-runtime/src/test/java/org/eolang/BytesOfTest.java index 696d7016f7..ff85c166aa 100644 --- a/eo-runtime/src/test/java/org/eolang/BytesOfTest.java +++ b/eo-runtime/src/test/java/org/eolang/BytesOfTest.java @@ -42,6 +42,7 @@ void negatesSeveralTimes() { final String text = "abc"; final Bytes bytes = new BytesOf(text); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", bytes.not().not(), Matchers.equalTo(new BytesOf(text)) ); @@ -51,6 +52,7 @@ void negatesSeveralTimes() { void negatesOnce() { final Bytes bytes = new BytesOf(-128L); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", bytes.not(), Matchers.equalTo(new BytesOf(127L)) ); @@ -60,6 +62,7 @@ void negatesOnce() { void checksAnd() { final Bytes bytes = new BytesOf(127L); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", bytes.and(bytes.not()), Matchers.equalTo(new BytesOf(0L)) ); @@ -69,6 +72,7 @@ void checksAnd() { void checksOr() { final Bytes bytes = new BytesOf(127L); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", bytes.or(bytes.not()), Matchers.equalTo(new BytesOf(-1L)) ); @@ -77,6 +81,7 @@ void checksOr() { @Test void checksPositiveInfinity() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new BytesOf(1.0d / 0.0d).asNumber(Double.class), Matchers.equalTo(Double.POSITIVE_INFINITY) ); @@ -85,6 +90,7 @@ void checksPositiveInfinity() { @Test void checksNegativeInfinity() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new BytesOf(-1.0d / 0.0d).asNumber(Double.class), Matchers.equalTo(Double.NEGATIVE_INFINITY) ); @@ -94,6 +100,7 @@ void checksNegativeInfinity() { void checksXor() { final Bytes bytes = new BytesOf(512L); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", bytes.xor(new BytesOf(-512L)), Matchers.equalTo(new BytesOf(-1024L)) ); @@ -103,6 +110,7 @@ void checksXor() { void checksAsNumberLong() { final Bytes bytes = new BytesOf(512L); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", bytes.asNumber(Long.class), Matchers.equalTo(512L) ); @@ -113,7 +121,8 @@ void checksUnderflowForLong() { final Bytes bytes = new BytesOf("A"); Assertions.assertThrows( UnsupportedOperationException.class, - () -> bytes.asNumber(Long.class) + () -> bytes.asNumber(Long.class), + "TO ADD ASSERTION MESSAGE" ); } @@ -130,6 +139,7 @@ void checksUnderflowForLong() { void checksShift(final long num, final int bits, final long expected) { final Bytes bytes = new BytesOf(num); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", bytes.shift(bits).asNumber(Long.class), Matchers.equalTo(expected) ); @@ -151,6 +161,7 @@ void checksShifts(final long num, final int bits, final long expected) { final Bytes bytes = new BytesOf((int) num); final int actual = bytes.sshift(bits).asNumber(Integer.class); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.equalTo((int) expected) ); @@ -161,7 +172,8 @@ void doesNotSupportRightShift() { final Bytes bytes = new BytesOf(Integer.MAX_VALUE); Assertions.assertThrows( UnsupportedOperationException.class, - () -> bytes.sshift(-1) + () -> bytes.sshift(-1), + "TO ADD ASSERTION MESSAGE" ); } } diff --git a/eo-runtime/src/test/java/org/eolang/DataTest.java b/eo-runtime/src/test/java/org/eolang/DataTest.java index 35cc72b485..28bdc3be3a 100644 --- a/eo-runtime/src/test/java/org/eolang/DataTest.java +++ b/eo-runtime/src/test/java/org/eolang/DataTest.java @@ -38,6 +38,7 @@ final class DataTest { @Test void printsByteArray() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Data.ToPhi(new byte[] {(byte) 0x01, (byte) 0xf2}).toString(), Matchers.containsString("01-F2") ); @@ -46,6 +47,7 @@ void printsByteArray() { @Test void printsEmptyByteArray() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Data.ToPhi(new byte[0]).toString(), Matchers.containsString("--") ); @@ -76,6 +78,7 @@ void printsString() { @Test void comparesVertex() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Data.ToPhi(42L).hashCode(), Matchers.not( Matchers.equalTo( @@ -88,18 +91,22 @@ void comparesVertex() { @Test void comparesTwoDatas() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Data.ToPhi(1L), Matchers.not(Matchers.equalTo(new Data.ToPhi(1L))) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Data.ToPhi("Welcome"), Matchers.not(Matchers.equalTo(new Data.ToPhi("Welcome"))) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Data.ToPhi(2.18d), Matchers.not(Matchers.equalTo(new Data.ToPhi(2.18d))) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Data.ToPhi(new byte[] {(byte) 0x00, (byte) 0x1f}), Matchers.not(Matchers.equalTo(new Data.ToPhi(new byte[] {(byte) 0x00, (byte) 0x1f}))) ); diff --git a/eo-runtime/src/test/java/org/eolang/DataizedTest.java b/eo-runtime/src/test/java/org/eolang/DataizedTest.java index d706551cfe..3b415a37ae 100644 --- a/eo-runtime/src/test/java/org/eolang/DataizedTest.java +++ b/eo-runtime/src/test/java/org/eolang/DataizedTest.java @@ -58,6 +58,7 @@ void logsCorrectly() { log.setLevel(before); log.removeHandler(hnd); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", logs.get(0).getMessage(), Matchers.allOf( Matchers.containsString("intν"), @@ -86,6 +87,7 @@ void logsWhenException() { log.setLevel(before); log.removeHandler(hnd); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", logs.get(0).getMessage(), Matchers.allOf( Matchers.containsString("intν"), @@ -119,6 +121,7 @@ void printsShortLogs() throws InterruptedException { log.setLevel(before); log.removeHandler(hnd); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", logs.size(), Matchers.equalTo(1) ); @@ -149,6 +152,7 @@ void printsLongLogs() throws InterruptedException { log.setLevel(before); log.removeHandler(hnd); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", logs.size(), Matchers.greaterThan(1) ); diff --git a/eo-runtime/src/test/java/org/eolang/ExInterruptedTest.java b/eo-runtime/src/test/java/org/eolang/ExInterruptedTest.java index b2ce567022..874536ca20 100644 --- a/eo-runtime/src/test/java/org/eolang/ExInterruptedTest.java +++ b/eo-runtime/src/test/java/org/eolang/ExInterruptedTest.java @@ -38,7 +38,8 @@ void throwsRightException() { final EOthrow phi = new EOthrow(new Data.ToPhi(true)); Assertions.assertThrows( ExInterrupted.class, - () -> new Dataized(phi.take(Attr.PHI)).take() + () -> new Dataized(phi.take(Attr.PHI)).take(), + "TO ADD ASSERTION MESSAGE" ); } diff --git a/eo-runtime/src/test/java/org/eolang/JavaPathTest.java b/eo-runtime/src/test/java/org/eolang/JavaPathTest.java index 74db2970b9..b925ca61b7 100644 --- a/eo-runtime/src/test/java/org/eolang/JavaPathTest.java +++ b/eo-runtime/src/test/java/org/eolang/JavaPathTest.java @@ -47,6 +47,7 @@ class JavaPathTest { }) void convertsToString(final String name, final String expected) { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new JavaPath(name).toString(), Matchers.equalTo(expected) ); diff --git a/eo-runtime/src/test/java/org/eolang/MainTest.java b/eo-runtime/src/test/java/org/eolang/MainTest.java index 17ff0d7910..633a21766a 100644 --- a/eo-runtime/src/test/java/org/eolang/MainTest.java +++ b/eo-runtime/src/test/java/org/eolang/MainTest.java @@ -49,6 +49,7 @@ final class MainTest { @Test void printsVersion() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", MainTest.exec("--version"), Matchers.allOf( Matchers.containsString("."), @@ -60,6 +61,7 @@ void printsVersion() { @Test void printsHelp() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", MainTest.exec("--help"), Matchers.containsString("Usage: ") ); @@ -69,6 +71,7 @@ void printsHelp() { @Disabled void deliversCleanOutput() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", MainTest.exec("org.eolang.io.tupled-stdout", "Hello!"), Matchers.stringContainsInOrder( String.format("Hello!%n---%n"), @@ -82,6 +85,7 @@ void deliversCleanOutput() { @Disabled void executesJvmFullRun() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", MainTest.exec("--verbose", "org.eolang.io.tupled-stdout", "Hello, dude!"), Matchers.allOf( Matchers.containsString("EOLANG"), @@ -95,6 +99,7 @@ void executesJvmFullRun() { @Test void executesJvmFullRunWithDashedObject() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", MainTest.exec("--verbose", "as-bytes"), Matchers.allOf( Matchers.containsString("Loading class EOas_bytes"), @@ -106,6 +111,7 @@ void executesJvmFullRunWithDashedObject() { @Test void executesJvmFullRinWithAttributeCall() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", MainTest.exec("--verbose", "string$as-bytes"), Matchers.allOf( Matchers.containsString("Loading class EOstring$EOas_bytes"), @@ -117,6 +123,7 @@ void executesJvmFullRinWithAttributeCall() { @Test void executesJvmFullRunWithError() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", MainTest.exec("--verbose", "org.eolang.io.stdout"), Matchers.containsString("Error at \"EOorg.EOeolang.EOio.EOstdout#text\" attribute") ); @@ -125,6 +132,7 @@ void executesJvmFullRunWithError() { @Test void executesWithObjectNotFoundException() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", MainTest.exec("unavailable-name"), Matchers.containsString("Can not find 'unavailable-name' object") ); @@ -145,6 +153,7 @@ void readsStreamCorrectly() throws IOException { ) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", reader.readLine().length(), Matchers.greaterThan(0) ); @@ -165,6 +174,7 @@ void readsSimpleStreamCorrectly() throws IOException { ) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", reader.readLine().length(), Matchers.greaterThan(1) ); @@ -173,6 +183,7 @@ void readsSimpleStreamCorrectly() throws IOException { @Test void readsBytesCorrectly() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new ByteArrayInputStream( "··\uD835\uDD38➜Φ".getBytes( StandardCharsets.UTF_8 diff --git a/eo-runtime/src/test/java/org/eolang/PhCopyTest.java b/eo-runtime/src/test/java/org/eolang/PhCopyTest.java index 5b0031b74c..792c6b9ab8 100644 --- a/eo-runtime/src/test/java/org/eolang/PhCopyTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhCopyTest.java @@ -37,6 +37,7 @@ final class PhCopyTest { @Test void makesObjectCopy() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhCopy(new Data.ToPhi(1L)) ).take(Long.class), @@ -48,6 +49,7 @@ void makesObjectCopy() { void hasTheSameFormaAsCopied() { final Phi phi = new Data.ToPhi(1L); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", phi.forma(), Matchers.equalTo( phi.copy().forma() diff --git a/eo-runtime/src/test/java/org/eolang/PhDataTest.java b/eo-runtime/src/test/java/org/eolang/PhDataTest.java index 54ae39b696..816a478947 100644 --- a/eo-runtime/src/test/java/org/eolang/PhDataTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhDataTest.java @@ -36,6 +36,7 @@ public class PhDataTest { @Test void addsApplicationWithDelta() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhData(Phi.Φ, new byte[] {1, 2, 3}).φTerm(), Matchers.containsString("(Δ ↦ 01-02-03)") ); @@ -45,6 +46,7 @@ void addsApplicationWithDelta() { void returnsData() { final byte[] data = new byte[] {0x2A, 0x3B}; MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhData(new Dummy(), data).delta(), Matchers.equalTo(data) ); diff --git a/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java b/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java index 2dc937be14..bd7da3ddb5 100644 --- a/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java @@ -250,6 +250,7 @@ void doesNotCopySetVoidAttributeWithRho() { final Phi phi = new PhDefaultTest.Int(); phi.put("void", new Data.ToPhi(10L)); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", phi.take("void"), Matchers.equalTo(phi.take("void")) ); @@ -259,6 +260,7 @@ void doesNotCopySetVoidAttributeWithRho() { void doesNotCopyContextAttributeWithRho() { final Phi phi = new PhDefaultTest.Int(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", phi.take("context"), Matchers.equalTo(phi.take("context")) ); @@ -269,11 +271,13 @@ void hasAccessToDependentOnContextAttribute() { final Phi phi = new PhDefaultTest.Int().copy(); Assertions.assertThrows( EOerror.ExError.class, - () -> phi.take(Attr.PHI) + () -> phi.take(Attr.PHI), + "TO ADD ASSERTION MESSAGE" ); phi.put("void", new Data.ToPhi(10L)); Assertions.assertDoesNotThrow( - () -> phi.take(Attr.PHI) + () -> phi.take(Attr.PHI), + "TO ADD ASSERTION MESSAGE" ); } @@ -293,6 +297,7 @@ void hasContextedChildWithSetRhoWhenFormed() { void makesObjectIdentity() { final Phi phi = new PhDefaultTest.Int(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", phi.hashCode(), Matchers.greaterThan(0) ); @@ -309,6 +314,7 @@ void createsDifferentPhiInParallel() { ).limit(threads).collect(Collectors.toList()) ).forEach(objects::add); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", objects, Matchers.hasSize(threads) ); @@ -318,7 +324,8 @@ void createsDifferentPhiInParallel() { void failsGracefullyOnMissingAttribute() { Assertions.assertThrows( EOerror.ExError.class, - () -> new Data.ToPhi("Hey").take("missing-attr") + () -> new Data.ToPhi("Hey").take("missing-attr"), + "TO ADD ASSERTION MESSAGE" ); } @@ -329,6 +336,7 @@ void copiesWithSetData() { phi.put(0, new Data.ToPhi(data)); final Phi copy = phi.copy(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(copy).take(String.class), Matchers.equalTo(data) ); @@ -341,7 +349,8 @@ void setsVoidAttributeOnlyOnce() { phi.put(0, num); Assertions.assertThrows( ExReadOnly.class, - () -> phi.put(0, num) + () -> phi.put(0, num), + "TO ADD ASSERTION MESSAGE" ); } @@ -350,6 +359,7 @@ void printsEndlessRecursionObject() { final Phi phi = new PhDefaultTest.EndlessRecursion(Phi.Φ); PhDefaultTest.EndlessRecursion.count = 2; MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(phi).take(Long.class), Matchers.equalTo(0L) ); @@ -360,6 +370,7 @@ void cachesPhiRecursively() { final Phi phi = new PhDefaultTest.RecursivePhi(Phi.Φ); PhDefaultTest.RecursivePhi.count = 3; MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(phi).take(Long.class), Matchers.equalTo(0L) ); @@ -370,6 +381,7 @@ void cachesPhiViaNewRecursively() { final Phi phi = new PhDefaultTest.RecursivePhiViaNew(Phi.Φ); PhDefaultTest.RecursivePhiViaNew.count = 3; MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(phi).take(Long.class), Matchers.equalTo(0L) ); @@ -383,6 +395,7 @@ void refersToOriginalObjectAndDoesNotResetCache() { copy.take("plus"); phi.take("plus"); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", PhDefaultTest.Dummy.count, Matchers.equalTo(1) ); @@ -396,6 +409,7 @@ void doesNotReadMultipleTimes() { new Dataized(phi).take(); } MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(new PhMethod(phi, "count")).take(Long.class), Matchers.equalTo(1L) ); @@ -404,6 +418,7 @@ void doesNotReadMultipleTimes() { @Test void hasTheSameFormaWithBoundedData() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Data.ToPhi(5L).forma(), Matchers.equalTo(new Data.ToPhi(6L).forma()) ); @@ -413,6 +428,7 @@ void hasTheSameFormaWithBoundedData() { void hasDifferentFormaWithBoundedMethod() { final Phi five = new Data.ToPhi(5L); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", five.forma(), Matchers.not( Matchers.equalTo( @@ -429,6 +445,7 @@ void hasDifferentFormaWithBoundedMethod() { @Test void hasTheSameFormaWithDifferentInstances() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhWith( new Data.ToPhi(5L).take("plus").copy(), "x", @@ -459,6 +476,7 @@ void doesNotCalculateRandomTwice() { 0, new Data.ToPhi(1.2) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(rnd).take(Double.class), Matchers.equalTo(new Dataized(rnd).take(Double.class)) ); @@ -467,6 +485,7 @@ void doesNotCalculateRandomTwice() { @Test void injectsDeltaIntoTerm() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Data.ToPhi(new byte[] {0x01, 0x02, 0x03}).φTerm(), Matchers.containsString("Δ ↦ 01-02-03") ); diff --git a/eo-runtime/src/test/java/org/eolang/PhLocatedTest.java b/eo-runtime/src/test/java/org/eolang/PhLocatedTest.java index 71b02d6d68..11955e44ff 100644 --- a/eo-runtime/src/test/java/org/eolang/PhLocatedTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhLocatedTest.java @@ -38,6 +38,7 @@ class PhLocatedTest { void savesLocationAfterCopying() { final Phi located = new PhLocated(new Data.ToPhi(0L), 123, 124, "qwerty"); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", located.copy().locator(), Matchers.equalTo(located.locator()) ); diff --git a/eo-runtime/src/test/java/org/eolang/PhLoggedTest.java b/eo-runtime/src/test/java/org/eolang/PhLoggedTest.java index 8083ae8a70..53af79a3cd 100644 --- a/eo-runtime/src/test/java/org/eolang/PhLoggedTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhLoggedTest.java @@ -38,6 +38,7 @@ class PhLoggedTest { @Test void convertsToOriginTerm() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhLogged(Phi.Φ).φTerm(), Matchers.is(Phi.Φ.φTerm()) ); @@ -46,6 +47,7 @@ void convertsToOriginTerm() { @Test void copiesOrigin() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhLogged(Phi.Φ).copy(), Matchers.equalTo(Phi.Φ) ); @@ -54,6 +56,7 @@ void copiesOrigin() { @Test void returnsOriginHashCode() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhLogged(Phi.Φ).hashCode(), Matchers.equalTo(Phi.Φ.hashCode()) ); @@ -62,6 +65,7 @@ void returnsOriginHashCode() { @Test void equalsToOrigin() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhLogged(Phi.Φ), Matchers.equalTo(Phi.Φ) ); @@ -71,6 +75,7 @@ void equalsToOrigin() { void getsOriginLocator() { final Phi phi = Phi.Φ; MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhLogged(phi).locator(), Matchers.equalTo(phi.locator()) ); @@ -80,6 +85,7 @@ void getsOriginLocator() { void convertsToString() { final Phi phi = Phi.Φ; MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhLogged(phi).toString(), Matchers.equalTo(phi.toString()) ); diff --git a/eo-runtime/src/test/java/org/eolang/PhMethodTest.java b/eo-runtime/src/test/java/org/eolang/PhMethodTest.java index edb30873c1..03d9bbf412 100644 --- a/eo-runtime/src/test/java/org/eolang/PhMethodTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhMethodTest.java @@ -38,6 +38,7 @@ final class PhMethodTest { void comparesTwoObjects() { final Phi num = new Data.ToPhi(1L); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", num.take("plus"), Matchers.not(Matchers.equalTo(num.take("plus"))) ); @@ -46,6 +47,7 @@ void comparesTwoObjects() { @Test void convertsSafeToString() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhMethod(Phi.Φ, "hello").toString(), Matchers.endsWith(".hello") ); @@ -59,7 +61,11 @@ void calculatesPhiJustOnce() { for (int idx = 0; idx < total; ++idx) { new Dataized(phi).take(); } - MatcherAssert.assertThat(dummy.count, Matchers.equalTo(1)); + MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", + dummy.count, + Matchers.equalTo(1) + ); } @Test @@ -70,7 +76,11 @@ void calculatesLocalJustOnce() { for (int idx = 0; idx < total; ++idx) { new Dataized(phi).take(); } - MatcherAssert.assertThat(dummy.count, Matchers.equalTo(1)); + MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", + dummy.count, + Matchers.equalTo(1) + ); } @Test @@ -78,13 +88,18 @@ void calculatesPhiOnce() { final Dummy dummy = new Dummy(Phi.Φ); final Phi phi = new PhMethod(dummy, "neg"); new Dataized(phi).take(); - MatcherAssert.assertThat(dummy.count, Matchers.equalTo(1)); + MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", + dummy.count, + Matchers.equalTo(1) + ); } @Test void hasDifferentFormasWithOwnMethod() { final Phi dummy = new Dummy(); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", dummy.forma(), Matchers.not( Matchers.equalTo( diff --git a/eo-runtime/src/test/java/org/eolang/PhNamedTest.java b/eo-runtime/src/test/java/org/eolang/PhNamedTest.java index 8032b05135..ad13f9d6a6 100644 --- a/eo-runtime/src/test/java/org/eolang/PhNamedTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhNamedTest.java @@ -37,10 +37,12 @@ final class PhNamedTest { @Test void comparesTwoObjects() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhNamed(new Data.ToPhi(1L), ""), Matchers.not(Matchers.equalTo(new PhNamed(new Data.ToPhi(1L), ""))) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhNamed(new Data.ToPhi(1L), ""), Matchers.not(Matchers.equalTo(new PhNamed(new Data.ToPhi(42L), ""))) ); diff --git a/eo-runtime/src/test/java/org/eolang/PhPackageTest.java b/eo-runtime/src/test/java/org/eolang/PhPackageTest.java index d19a12905b..43912ab066 100644 --- a/eo-runtime/src/test/java/org/eolang/PhPackageTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhPackageTest.java @@ -58,6 +58,7 @@ final class PhPackageTest { @Test void copiesObject() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", Phi.Φ.take("org").take("eolang").take("seq"), Matchers.not( Matchers.equalTo( @@ -72,6 +73,7 @@ void setsRhoToObject() { final Phi eolang = Phi.Φ.take("org").take("eolang"); final Phi seq = eolang.take("seq"); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", seq.take(Attr.RHO), Matchers.equalTo(eolang) ); @@ -80,6 +82,7 @@ void setsRhoToObject() { @Test void findsLongClass() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", Phi.Φ.take("org") .take("eolang") .take("bytes$eq").copy(), @@ -93,6 +96,7 @@ void retrievesAttribute(final String attribute, final Class expected) { final Phi parent = new PhPackage(PhPackageTest.DEFAULT_PACKAGE); final Phi actual = parent.take(attribute); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, Matchers.instanceOf(expected) ); @@ -102,7 +106,8 @@ void retrievesAttribute(final String attribute, final Class expected) { void throwsExceptionIfCantInstantiateObject() { Assertions.assertThrows( ExFailure.class, - () -> new PhPackage(PhPackageTest.DEFAULT_PACKAGE).take("failed") + () -> new PhPackage(PhPackageTest.DEFAULT_PACKAGE).take("failed"), + "TO ADD ASSERTION MESSAGE" ); } @@ -110,7 +115,8 @@ void throwsExceptionIfCantInstantiateObject() { void doesNotCopies() { Assertions.assertThrows( ExFailure.class, - () -> new PhPackage(PhPackageTest.DEFAULT_PACKAGE).copy() + () -> new PhPackage(PhPackageTest.DEFAULT_PACKAGE).copy(), + "TO ADD ASSERTION MESSAGE" ); } @@ -118,13 +124,15 @@ void doesNotCopies() { void doesNotGetForma() { Assertions.assertThrows( ExFailure.class, - () -> new PhPackage(PhPackageTest.DEFAULT_PACKAGE).forma() + () -> new PhPackage(PhPackageTest.DEFAULT_PACKAGE).forma(), + "TO ADD ASSERTION MESSAGE" ); } @Test void convertsToPhiTerm() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhPackage(PhPackageTest.DEFAULT_PACKAGE).φTerm(), Matchers.equalTo("Φ.org.eolang") ); @@ -133,6 +141,7 @@ void convertsToPhiTerm() { @Test void returnsLocator() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhPackage(PhPackageTest.DEFAULT_PACKAGE).locator(), Matchers.equalTo("?:?") ); @@ -141,6 +150,7 @@ void returnsLocator() { @Test void convertsToString() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhPackage(PhPackageTest.DEFAULT_PACKAGE).toString(), Matchers.equalTo("Φ.org.eolang") ); @@ -170,7 +180,11 @@ void findsAttributesConcurrently() throws InterruptedException { latch.countDown(); service.shutdown(); if (service.awaitTermination(1, TimeUnit.SECONDS)) { - MatcherAssert.assertThat(basket.size(), Matchers.equalTo(threads)); + MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", + basket.size(), + Matchers.equalTo(threads) + ); } else { throw new IllegalStateException( String.format( diff --git a/eo-runtime/src/test/java/org/eolang/PhWithTest.java b/eo-runtime/src/test/java/org/eolang/PhWithTest.java index 3030bf943b..af849b347e 100644 --- a/eo-runtime/src/test/java/org/eolang/PhWithTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhWithTest.java @@ -45,6 +45,7 @@ void comparesTwoObjects() { 0, new Data.ToPhi(1L) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", dummy, Matchers.equalTo(dummy) ); } @@ -52,6 +53,7 @@ void comparesTwoObjects() { @Test void takesMethod() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new Data.ToPhi("Hello, world!") ).take(String.class), @@ -63,6 +65,7 @@ void takesMethod() { void passesToSubObject() { final Phi dummy = new PhWithTest.Dummy(Phi.Φ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhWith( new PhCopy(new PhMethod(dummy, "plus")), @@ -77,6 +80,7 @@ void passesToSubObject() { void printsToString() { final Phi dummy = new PhWithTest.Dummy(Phi.Φ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhWith( new PhCopy(new PhMethod(dummy, "plus")), 0, new Data.ToPhi(1L) @@ -92,12 +96,14 @@ void runsInThreads(final String data) { final Phi ref = new PhWith(new DummyWithAtFree(attr, Phi.Φ), 0, new Data.ToPhi(data)); final Func actual = phi -> { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(phi.take(attr)).take(String.class), Matchers.is(data) ); return true; }; MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", actual, new RunsInThreads<>( ref, @@ -110,6 +116,7 @@ void runsInThreads(final String data) { void hasTheSameFormaWithBoundAttribute() { final Phi dummy = new DummyWithAtFree("x", Phi.Φ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", dummy.forma(), Matchers.equalTo( new PhWith(dummy, "x", new Data.ToPhi(5L)).forma() diff --git a/eo-runtime/src/test/java/org/eolang/PhiTest.java b/eo-runtime/src/test/java/org/eolang/PhiTest.java index f0cfbbc30a..fde23ef2f7 100644 --- a/eo-runtime/src/test/java/org/eolang/PhiTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhiTest.java @@ -37,6 +37,7 @@ final class PhiTest { @Test void takesPackage() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhCopy( new PhMethod( @@ -67,6 +68,7 @@ void takesPackage() { @Test void takesStandardPackage() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( new PhCopy( new PhMethod( @@ -85,6 +87,7 @@ void takesStandardPackage() { @Test void takesDirectly() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized( Phi.Φ.take("org").take("eolang").take("nan").take("gt") ).take(Boolean.class), @@ -95,6 +98,7 @@ void takesDirectly() { @Test void getsLocation() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new PhLocated( Phi.Φ, 123, diff --git a/eo-runtime/src/test/java/org/eolang/UniverseDefaultTest.java b/eo-runtime/src/test/java/org/eolang/UniverseDefaultTest.java index 06211c463a..8ceb9e1e15 100644 --- a/eo-runtime/src/test/java/org/eolang/UniverseDefaultTest.java +++ b/eo-runtime/src/test/java/org/eolang/UniverseDefaultTest.java @@ -59,6 +59,7 @@ void findsSimpleAtt() { final Phi phi = new DummyWithAt(Phi.Φ); final UniverseDefault universe = new UniverseDefault(phi); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", universe.find( String.format("%s.%s.%s", "$", UniverseDefaultTest.ABSTRACT_ATT, Attr.RHO) ), @@ -73,6 +74,7 @@ void findsLongAtt() { final Phi phi = new DummyWithStructure(Phi.Φ); final UniverseDefault universe = new UniverseDefault(phi); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", universe.find( String.format( "$.%s.%s.%s.%s", @@ -94,6 +96,7 @@ void findsByAbsoluteLoc() { final UniverseDefault universe = new UniverseDefault(Phi.Φ, indexed); final int vertex = universe.find("Q.org.eolang.seq"); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", indexed.get(vertex).getClass(), Matchers.equalTo(EOseq.class) ); @@ -105,7 +108,8 @@ void throwsIfWrongFind() { ExAbstract.class, () -> new UniverseDefault( new DummyWithStructure(Phi.Φ) - ).find("$.wrong-name") + ).find("$.wrong-name"), + "TO ADD ASSERTION MESSAGE" ); } @@ -118,6 +122,7 @@ void dataizesIndexed() { "$.".concat(UniverseDefaultTest.VALUE_ATT) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", universe.dataize(vertex), Matchers.equalTo(new BytesOf(1L).take()) ); @@ -129,7 +134,8 @@ void throwsIfWrongDataize() { ExAbstract.class, () -> new UniverseDefault( new DummyWithStructure(Phi.Φ) - ).dataize(-1) + ).dataize(-1), + "TO ADD ASSERTION MESSAGE" ); } @@ -141,10 +147,12 @@ void copies() { final int origin = universe.find("$"); final int copy = universe.copy(origin); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", copy, Matchers.not(origin) ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", universe.dataize(copy), Matchers.equalTo( universe.dataize(origin) @@ -160,6 +168,7 @@ void putsToCopy() { final int copy = universe.copy(eobytes); universe.put(copy, UniverseDefaultTest.DATA); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(indexed.get(copy)).take(), Matchers.equalTo( UniverseDefaultTest.DATA @@ -179,6 +188,7 @@ void bindsCopyToAbstract() { dummy.hashCode(), copy, UniverseDefaultTest.ABSTRACT_ATT ); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Dataized(dummy.take(UniverseDefaultTest.ABSTRACT_ATT)).take(), Matchers.equalTo( UniverseDefaultTest.DATA diff --git a/eo-runtime/src/test/java/org/eolang/VerboseBytesAsStringTest.java b/eo-runtime/src/test/java/org/eolang/VerboseBytesAsStringTest.java index 5a4f789107..f47a5263de 100644 --- a/eo-runtime/src/test/java/org/eolang/VerboseBytesAsStringTest.java +++ b/eo-runtime/src/test/java/org/eolang/VerboseBytesAsStringTest.java @@ -41,6 +41,7 @@ public final class VerboseBytesAsStringTest { @MethodSource("getTestSources") void representsString(final Object object) { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new VerboseBytesAsString(VerboseBytesAsStringTest.toBytes(object)).get(), Matchers.containsString( new VerboseBytesAsStringTest.ArgumentsUtils().toString(object) diff --git a/eo-runtime/src/test/java/org/eolang/VerticesTest.java b/eo-runtime/src/test/java/org/eolang/VerticesTest.java index cbc060cb5c..3e39e623ce 100644 --- a/eo-runtime/src/test/java/org/eolang/VerticesTest.java +++ b/eo-runtime/src/test/java/org/eolang/VerticesTest.java @@ -45,6 +45,7 @@ final class VerticesTest { @Test void makesNext() { MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", new Vertices().next(), Matchers.greaterThan(0) ); @@ -67,6 +68,7 @@ void performsVtxOperationsConcurrently() { ); new Threads<>(threads, tasks).forEach(hashes::add); MatcherAssert.assertThat( + "TO ADD ASSERTION MESSAGE", hashes.size(), Matchers.equalTo(threads) ); diff --git a/pom.xml b/pom.xml index 1d71e09cac..aacdd746f2 100644 --- a/pom.xml +++ b/pom.xml @@ -388,7 +388,7 @@ SOFTWARE. com.github.volodya-lombrozo jtcop-maven-plugin - 1.2.1 + 1.2.2 true From 71539993c6b6ac58c8a94c392f3c3a58e99c31db Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Fri, 19 Apr 2024 13:43:03 +0300 Subject: [PATCH 03/11] #2297 jtcop version up --- eo-runtime/src/test/java/org/eolang/DataizedTest.java | 3 ++- pom.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eo-runtime/src/test/java/org/eolang/DataizedTest.java b/eo-runtime/src/test/java/org/eolang/DataizedTest.java index 3b415a37ae..760c573fc9 100644 --- a/eo-runtime/src/test/java/org/eolang/DataizedTest.java +++ b/eo-runtime/src/test/java/org/eolang/DataizedTest.java @@ -80,7 +80,8 @@ void logsWhenException() { IntStream.range(0, 5).forEach( i -> Assertions.assertThrows( IllegalStateException.class, - () -> new Dataized(wrong).take() + () -> new Dataized(wrong).take(), + "TO ADD ASSERTION MESSAGE" ) ); new Dataized(new Data.ToPhi(1L), log).take(); diff --git a/pom.xml b/pom.xml index aacdd746f2..e4eb28ac5c 100644 --- a/pom.xml +++ b/pom.xml @@ -388,7 +388,7 @@ SOFTWARE. com.github.volodya-lombrozo jtcop-maven-plugin - 1.2.2 + 1.2.4 true From 5b6335398851e5852dda854c3d2e92695b4be9b0 Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Fri, 19 Apr 2024 14:15:03 +0300 Subject: [PATCH 04/11] rerun CI From 21be3cace9d6225a23f665fba2e5f37a54b7306c Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Fri, 19 Apr 2024 15:24:46 +0300 Subject: [PATCH 05/11] #2297 rename empty message fields --- .../org/eolang/maven/BinarizeMojoTest.java | 12 +++--- .../org/eolang/maven/BinarizeParseTest.java | 28 +++++++------- .../java/org/eolang/maven/PlaceMojoTest.java | 38 +++++++++---------- .../eolang/maven/footprint/FtCachedTest.java | 12 +++--- .../maven/objectionary/ObjectsIndexTest.java | 12 +++--- .../objectionary/OyFallbackSwapTest.java | 14 +++---- .../maven/objectionary/OyFallbackTest.java | 24 ++++++------ .../maven/tojos/TranspiledTojosTest.java | 18 ++++----- .../org/eolang/maven/util/HmBaseTest.java | 14 +++---- .../org/eolang/parser/EoIndentLexerTest.java | 12 +++--- .../java/org/eolang/parser/EoSyntaxTest.java | 24 ++++++------ .../java/org/eolang/parser/StUnhexTest.java | 16 ++++---- 12 files changed, 112 insertions(+), 112 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 15082a4ce6..0bc2626e3a 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 @@ -53,7 +53,7 @@ final class BinarizeMojoTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; /** * BinarizeMojo can binarize without errors. @@ -105,14 +105,14 @@ void savesToCache(@TempDir final Path temp) throws IOException { .execute(new FakeMaven.Binarize()) .result(); MatcherAssert.assertThat( - BinarizeMojoTest.EMPTY_MSG, + BinarizeMojoTest.TO_ADD_MESSAGE, res, Matchers.hasValue( cache.resolve("Lib") ) ); MatcherAssert.assertThat( - BinarizeMojoTest.EMPTY_MSG, + BinarizeMojoTest.TO_ADD_MESSAGE, res, Matchers.not( Matchers.hasValue( @@ -147,7 +147,7 @@ void boostsSecondCompilation(@TempDir final Path temp) throws IOException { finish = System.currentTimeMillis(); final long second = finish - start; MatcherAssert.assertThat( - BinarizeMojoTest.EMPTY_MSG, + BinarizeMojoTest.TO_ADD_MESSAGE, second, Matchers.lessThan(first) ); @@ -172,12 +172,12 @@ void doesNotRecompile(@TempDir final Path temp) throws IOException { maven.execute(new FakeMaven.Binarize()); final long second = executable.lastModified(); MatcherAssert.assertThat( - BinarizeMojoTest.EMPTY_MSG, + BinarizeMojoTest.TO_ADD_MESSAGE, first, Matchers.not(0L) ); MatcherAssert.assertThat( - BinarizeMojoTest.EMPTY_MSG, + BinarizeMojoTest.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 15f67ce1b7..58f35d0081 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 @@ -50,7 +50,7 @@ final class BinarizeParseTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @Test void parsesSimpleEoProgram(@TempDir final Path temp) throws Exception { @@ -67,11 +67,11 @@ void parsesSimpleEoProgram(@TempDir final Path temp) throws Exception { function ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey(rust) ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(res.get(rust)).asString(), Matchers.stringContainsInOrder( "use rand::Rng;", @@ -84,7 +84,7 @@ void parsesSimpleEoProgram(@TempDir final Path temp) throws Exception { ) ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf( res.get( String.format( @@ -112,15 +112,15 @@ void binarizesTwiceRustProgram(@TempDir final Path temp) throws Exception { Names.PREFIX ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey(one) ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey(two) ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(res.get(one)).asString(), Matchers.stringContainsInOrder( "use eo::eo_enum::EO;", @@ -130,7 +130,7 @@ void binarizesTwiceRustProgram(@TempDir final Path temp) throws Exception { ) ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(res.get(two)).asString(), Matchers.stringContainsInOrder( "use eo::eo_enum::EO;", @@ -145,7 +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, + BinarizeParseTest.TO_ADD_MESSAGE, new XaxStory(yaml), Matchers.is(true) ); @@ -169,19 +169,19 @@ void createsCorrectRustProject(@TempDir final Path temp) throws Exception { dir ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey(cargo) ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey(lib) ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, res, Matchers.hasKey(module) ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(res.get(cargo)).asString(), Matchers.stringContainsInOrder( "[lib]", @@ -191,7 +191,7 @@ void createsCorrectRustProject(@TempDir final Path temp) throws Exception { ) ); MatcherAssert.assertThat( - BinarizeParseTest.EMPTY_MSG, + BinarizeParseTest.TO_ADD_MESSAGE, new TextOf(res.get(cargo)).asString(), Matchers.stringContainsInOrder( "[dependencies]", 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 42446640e0..49a60902cd 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 @@ -52,7 +52,7 @@ final class PlaceMojoTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; /** * The default folder for placed binaries. @@ -73,17 +73,17 @@ void placesBinaries(@TempDir final Path temp) throws Exception { .execute(PlaceMojo.class) .result(); MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.TO_ADD_MESSAGE, res, Matchers.hasKey("target/classes/EObar/x.bin") ); MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.TO_ADD_MESSAGE, res, Matchers.hasKey("target/classes/org/eolang/f/x.a.class") ); MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.TO_ADD_MESSAGE, res, Matchers.hasKey("target/classes/org/eolang/t.txt") ); @@ -94,7 +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, + PlaceMojoTest.TO_ADD_MESSAGE, new FakeMaven(temp) .execute(PlaceMojo.class) .result(), @@ -121,7 +121,7 @@ void placesOnlyClassesFromPackageThatHaveSources(@TempDir final Path temp) throw PlaceMojoTest.saveBinary(temp, binary); } MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.TO_ADD_MESSAGE, new FakeMaven(temp) .with("placeBinariesThatHaveSources", true) .execute(PlaceMojo.class) @@ -157,7 +157,7 @@ void skipsAlreadyPlacedBinaries(@TempDir final Path temp) throws IOException { binary ).toFile().lastModified(); MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.TO_ADD_MESSAGE, new FakeMaven(temp) .withPlacedBinary( temp.resolve(PlaceMojoTest.TARGET_CLASSES).resolve(binary) @@ -181,12 +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, + PlaceMojoTest.TO_ADD_MESSAGE, maven.execute(PlaceMojo.class).result(), Matchers.hasValue(path) ); MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.TO_ADD_MESSAGE, content, Matchers.is(new TextOf(path).asString()) ); @@ -196,7 +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, + PlaceMojoTest.TO_ADD_MESSAGE, new FakeMaven(temp) .execute(PlaceMojo.class) .result(), @@ -207,7 +207,7 @@ void placesWithoutBinaries(@TempDir final Path temp) throws IOException { @Test void placesWithoutResolveDirectory(@TempDir final Path temp) throws IOException { MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.TO_ADD_MESSAGE, new FakeMaven(temp) .execute(PlaceMojo.class) .result(), @@ -226,12 +226,12 @@ void placesMissing(@TempDir final Path temp) throws IOException { .execute(PlaceMojo.class) .result(); MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.TO_ADD_MESSAGE, res, Matchers.hasValue(PlaceMojoTest.pathToPlacedBinary(temp, first)) ); MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.TO_ADD_MESSAGE, res, Matchers.hasValue(PlaceMojoTest.pathToPlacedBinary(temp, second)) ); @@ -250,7 +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, + PlaceMojoTest.TO_ADD_MESSAGE, maven.withHelloWorld() .execute(new FakeMaven.Place()) .result() @@ -258,7 +258,7 @@ void placesAllEoRuntimeClasses(@TempDir final Path temp) throws IOException { new ContainsFiles("**/eo-runtime-*.jar") ); MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.TO_ADD_MESSAGE, maven.placed().jars().size(), Matchers.is(1) ); @@ -268,7 +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, + PlaceMojoTest.TO_ADD_MESSAGE, maven.withHelloWorld() .with("withRuntimeDependency", false) .execute(new FakeMaven.Place()) @@ -277,7 +277,7 @@ void placesWithoutEoRuntimeClasses(@TempDir final Path temp) throws IOException Matchers.not(new ContainsFiles("**/eo-runtime-*.jar")) ); MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.TO_ADD_MESSAGE, maven.placed().jars().isEmpty(), Matchers.is(true) ); @@ -293,7 +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, + PlaceMojoTest.TO_ADD_MESSAGE, new TextOf(PlaceMojoTest.pathToPlacedBinary(temp, binary)).asString(), Matchers.equalTo(old) ); @@ -310,7 +310,7 @@ void placesAgainIfWasUnplaced(@TempDir final Path temp) throws Exception { maven.placed().unplaceAll(); maven.execute(PlaceMojo.class).result(); MatcherAssert.assertThat( - PlaceMojoTest.EMPTY_MSG, + PlaceMojoTest.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/footprint/FtCachedTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/footprint/FtCachedTest.java index a6b7c84f63..5989737993 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 @@ -41,7 +41,7 @@ final class FtCachedTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; /** * Default content. @@ -69,12 +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, + FtCachedTest.TO_ADD_MESSAGE, cached.load(program, FtCachedTest.EXTENSION), Matchers.equalTo(FtCachedTest.CONTENT.value()) ); MatcherAssert.assertThat( - FtCachedTest.EMPTY_MSG, + FtCachedTest.TO_ADD_MESSAGE, temp.resolve(FtCachedTest.CACHE).toFile(), FileMatchers.anExistingDirectory() ); @@ -86,12 +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, + FtCachedTest.TO_ADD_MESSAGE, cached.load(program, FtCachedTest.EXTENSION), Matchers.equalTo(FtCachedTest.CONTENT.value()) ); MatcherAssert.assertThat( - FtCachedTest.EMPTY_MSG, + FtCachedTest.TO_ADD_MESSAGE, temp.resolve(FtCachedTest.CACHE).toFile(), Matchers.not(FileMatchers.anExistingFileOrDirectory()) ); @@ -102,7 +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, + FtCachedTest.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/objectionary/ObjectsIndexTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/ObjectsIndexTest.java index 4f110398cb..0cab421497 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 @@ -42,7 +42,7 @@ final class ObjectsIndexTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @Test void contains() throws Exception { @@ -57,22 +57,22 @@ void contains() throws Exception { ) ); MatcherAssert.assertThat( - ObjectsIndexTest.EMPTY_MSG, + ObjectsIndexTest.TO_ADD_MESSAGE, index.contains(object), Matchers.is(true) ); MatcherAssert.assertThat( - ObjectsIndexTest.EMPTY_MSG, + ObjectsIndexTest.TO_ADD_MESSAGE, index.contains(object), Matchers.is(true) ); MatcherAssert.assertThat( - ObjectsIndexTest.EMPTY_MSG, + ObjectsIndexTest.TO_ADD_MESSAGE, index.contains("unknown"), Matchers.is(false) ); MatcherAssert.assertThat( - ObjectsIndexTest.EMPTY_MSG, + ObjectsIndexTest.TO_ADD_MESSAGE, calls.get(), Matchers.is(1) ); @@ -82,7 +82,7 @@ void contains() throws Exception { @ExtendWith(WeAreOnline.class) void downloadsAndChecksFromRealSource() throws Exception { MatcherAssert.assertThat( - ObjectsIndexTest.EMPTY_MSG, + ObjectsIndexTest.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/OyFallbackSwapTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/objectionary/OyFallbackSwapTest.java index f043523bb8..225b853caf 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 @@ -41,12 +41,12 @@ final class OyFallbackSwapTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @Test void getsWithFallbackNoSwapOy() throws Exception { MatcherAssert.assertThat( - OyFallbackSwapTest.EMPTY_MSG, + OyFallbackSwapTest.TO_ADD_MESSAGE, new TextOf( new OyFallbackSwap( new Objectionary.Fake(s -> new InputOf("[] > local\n")), @@ -61,7 +61,7 @@ void getsWithFallbackNoSwapOy() throws Exception { @Test void getsWithFallbackSwapOyFail() throws Exception { MatcherAssert.assertThat( - OyFallbackSwapTest.EMPTY_MSG, + OyFallbackSwapTest.TO_ADD_MESSAGE, new TextOf( new OyFallbackSwap( new Objectionary.Fake(s -> new InputOf("[] > local\n")), @@ -80,7 +80,7 @@ void getsWithFallbackSwapOyFail() throws Exception { @Test void getsWithFallbackSwapOy() throws Exception { MatcherAssert.assertThat( - OyFallbackSwapTest.EMPTY_MSG, + OyFallbackSwapTest.TO_ADD_MESSAGE, new TextOf( new OyFallbackSwap( new Objectionary.Fake(s -> new InputOf("[] > local\n")), @@ -107,7 +107,7 @@ void checksPresenceOfObject(@TempDir final Path path) throws Exception { ) ); MatcherAssert.assertThat( - OyFallbackSwapTest.EMPTY_MSG, + OyFallbackSwapTest.TO_ADD_MESSAGE, new OyFallbackSwap( home, cache, @@ -116,7 +116,7 @@ void checksPresenceOfObject(@TempDir final Path path) throws Exception { Matchers.is(false) ); MatcherAssert.assertThat( - OyFallbackSwapTest.EMPTY_MSG, + OyFallbackSwapTest.TO_ADD_MESSAGE, new TextOf( new OyFallbackSwap( home, @@ -127,7 +127,7 @@ void checksPresenceOfObject(@TempDir final Path path) throws Exception { Matchers.is(Matchers.notNullValue()) ); MatcherAssert.assertThat( - OyFallbackSwapTest.EMPTY_MSG, + OyFallbackSwapTest.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 f26b7ff86b..f8864c4d18 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 @@ -43,7 +43,7 @@ final class OyFallbackTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; /** * Primary objectionary. @@ -68,17 +68,17 @@ void setUp() { @Test void getsObjectWhenPrimaryContains() throws Exception { MatcherAssert.assertThat( - OyFallbackTest.EMPTY_MSG, + OyFallbackTest.TO_ADD_MESSAGE, new TextOf(this.fallback.get("org.example.main")).asString(), Matchers.equalTo(this.primary.source) ); MatcherAssert.assertThat( - OyFallbackTest.EMPTY_MSG, + OyFallbackTest.TO_ADD_MESSAGE, this.primary.invocations.get(), Matchers.equalTo(1) ); MatcherAssert.assertThat( - OyFallbackTest.EMPTY_MSG, + OyFallbackTest.TO_ADD_MESSAGE, this.secondary.invocations.get(), Matchers.equalTo(0) ); @@ -87,17 +87,17 @@ void getsObjectWhenPrimaryContains() throws Exception { @Test void getsObjectWhenPrimaryNotContains() throws Exception { MatcherAssert.assertThat( - OyFallbackTest.EMPTY_MSG, + OyFallbackTest.TO_ADD_MESSAGE, new TextOf(this.fallback.get("org.example.secondary")).asString(), Matchers.equalTo(this.secondary.source) ); MatcherAssert.assertThat( - OyFallbackTest.EMPTY_MSG, + OyFallbackTest.TO_ADD_MESSAGE, this.primary.invocations.get(), Matchers.equalTo(1) ); MatcherAssert.assertThat( - OyFallbackTest.EMPTY_MSG, + OyFallbackTest.TO_ADD_MESSAGE, this.secondary.invocations.get(), Matchers.equalTo(1) ); @@ -106,22 +106,22 @@ void getsObjectWhenPrimaryNotContains() throws Exception { @Test void containsObject() throws IOException { MatcherAssert.assertThat( - OyFallbackTest.EMPTY_MSG, + OyFallbackTest.TO_ADD_MESSAGE, this.fallback.contains("org.example.main"), Matchers.is(true) ); MatcherAssert.assertThat( - OyFallbackTest.EMPTY_MSG, + OyFallbackTest.TO_ADD_MESSAGE, this.fallback.contains("org.example.absent"), Matchers.is(false) ); MatcherAssert.assertThat( - OyFallbackTest.EMPTY_MSG, + OyFallbackTest.TO_ADD_MESSAGE, this.primary.invocations.get(), Matchers.equalTo(2) ); MatcherAssert.assertThat( - OyFallbackTest.EMPTY_MSG, + OyFallbackTest.TO_ADD_MESSAGE, this.secondary.invocations.get(), Matchers.equalTo(1) ); @@ -130,7 +130,7 @@ void containsObject() throws IOException { @Test void convertsToString() { MatcherAssert.assertThat( - OyFallbackTest.EMPTY_MSG, + OyFallbackTest.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/tojos/TranspiledTojosTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/tojos/TranspiledTojosTest.java index d7ca70d4b3..caad88866d 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 @@ -54,7 +54,7 @@ final class TranspiledTojosTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; /** * Transpiled files. @@ -99,7 +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, + TranspiledTojosTest.TO_ADD_MESSAGE, this.original.select(all -> true), Matchers.hasSize(1) ); @@ -113,22 +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, + TranspiledTojosTest.TO_ADD_MESSAGE, this.tojos.remove(first), Matchers.equalTo(1L) ); MatcherAssert.assertThat( - TranspiledTojosTest.EMPTY_MSG, + TranspiledTojosTest.TO_ADD_MESSAGE, this.tojos.remove(second), Matchers.equalTo(1L) ); MatcherAssert.assertThat( - TranspiledTojosTest.EMPTY_MSG, + TranspiledTojosTest.TO_ADD_MESSAGE, this.temp.toFile().listFiles(File::isFile), Matchers.arrayWithSize(1) ); MatcherAssert.assertThat( - TranspiledTojosTest.EMPTY_MSG, + TranspiledTojosTest.TO_ADD_MESSAGE, this.original.select(all -> true), Matchers.hasSize(3) ); @@ -137,17 +137,17 @@ void removesExistingTranspiledFiles() { @Test void removesAbsent() { MatcherAssert.assertThat( - TranspiledTojosTest.EMPTY_MSG, + TranspiledTojosTest.TO_ADD_MESSAGE, this.tojos.remove(Paths.get("absent.xmir")), Matchers.equalTo(0L) ); MatcherAssert.assertThat( - TranspiledTojosTest.EMPTY_MSG, + TranspiledTojosTest.TO_ADD_MESSAGE, this.temp.toFile().listFiles(File::isFile), Matchers.arrayWithSize(3) ); MatcherAssert.assertThat( - TranspiledTojosTest.EMPTY_MSG, + TranspiledTojosTest.TO_ADD_MESSAGE, this.original.select(all -> true), Matchers.hasSize(0) ); 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 eeb3dbf7f0..64d1ef5398 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 @@ -50,7 +50,7 @@ final class HmBaseTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @ValueSource(ints = {0, 100, 1_000, 10_000}) @ParameterizedTest @@ -59,7 +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, + HmBaseTest.TO_ADD_MESSAGE, new UncheckedText(new TextOf(temp.resolve(resolve))).asString(), Matchers.is(content) ); @@ -70,7 +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, + HmBaseTest.TO_ADD_MESSAGE, new HmBase(temp).exists(path), Matchers.is(true) ); @@ -82,7 +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, + HmBaseTest.TO_ADD_MESSAGE, new HmBase(temp.resolve("dir")).exists(Paths.get("subdir/file.txt")), Matchers.is(true) ); @@ -96,7 +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, + HmBaseTest.TO_ADD_MESSAGE, new HmBase(directory).exists(Paths.get(filename)), Matchers.is(true) ); @@ -110,7 +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, + HmBaseTest.TO_ADD_MESSAGE, new HmBase(directory).exists(Paths.get(filename)), Matchers.is(true) ); @@ -123,7 +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, + HmBaseTest.TO_ADD_MESSAGE, new TextOf(home.load(subfolder)), Matchers.equalTo(new TextOf(content)) ); diff --git a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java index 63ac929da5..33af185e43 100644 --- a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java @@ -38,7 +38,7 @@ final class EoIndentLexerTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @Test void emitsTab() throws IOException { @@ -47,7 +47,7 @@ void emitsTab() throws IOException { ); lexer.nextToken(); MatcherAssert.assertThat( - EoIndentLexerTest.EMPTY_MSG, + EoIndentLexerTest.TO_ADD_MESSAGE, lexer.nextToken().getType(), Matchers.is( EoParser.TAB @@ -61,7 +61,7 @@ void ensuresGrammarFile() throws IOException { new TextOf("") ); MatcherAssert.assertThat( - EoIndentLexerTest.EMPTY_MSG, + EoIndentLexerTest.TO_ADD_MESSAGE, lexer.getGrammarFileName(), Matchers.is( "Eo.g4" @@ -76,7 +76,7 @@ void emitsTabWhenEmptyLine() throws IOException { ); lexer.nextToken(); MatcherAssert.assertThat( - EoIndentLexerTest.EMPTY_MSG, + EoIndentLexerTest.TO_ADD_MESSAGE, lexer.nextToken().getType(), Matchers.is( EoParser.TAB @@ -93,7 +93,7 @@ void emitsUntab() throws IOException { lexer.nextToken(); lexer.nextToken(); MatcherAssert.assertThat( - EoIndentLexerTest.EMPTY_MSG, + EoIndentLexerTest.TO_ADD_MESSAGE, lexer.nextToken().getType(), Matchers.is( EoParser.UNTAB @@ -107,7 +107,7 @@ void readsEmptyString() throws IOException { new TextOf("") ); MatcherAssert.assertThat( - EoIndentLexerTest.EMPTY_MSG, + EoIndentLexerTest.TO_ADD_MESSAGE, lexer.nextToken().getType(), Matchers.is( EoParser.EOF diff --git a/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java b/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java index 72f270f4e2..d24fa0eb84 100644 --- a/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java @@ -53,12 +53,12 @@ final class EoSyntaxTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @Test void parsesSimpleCode() throws Exception { MatcherAssert.assertThat( - EoSyntaxTest.EMPTY_MSG, + EoSyntaxTest.TO_ADD_MESSAGE, XhtmlMatchers.xhtml( new String( new EoSyntax( @@ -92,7 +92,7 @@ void containsCommentCheckErrors( final String message ) throws IOException { MatcherAssert.assertThat( - EoSyntaxTest.EMPTY_MSG, + EoSyntaxTest.TO_ADD_MESSAGE, XhtmlMatchers.xhtml( new String( new EoSyntax( @@ -125,7 +125,7 @@ void printsProperListingEvenWhenSyntaxIsBroken() throws Exception { "[] > x-н, 1\n" ); MatcherAssert.assertThat( - EoSyntaxTest.EMPTY_MSG, + EoSyntaxTest.TO_ADD_MESSAGE, XhtmlMatchers.xhtml( new String( new EoSyntax( @@ -157,7 +157,7 @@ void copiesListingCorrectly() throws Exception { ) ); MatcherAssert.assertThat( - EoSyntaxTest.EMPTY_MSG, + EoSyntaxTest.TO_ADD_MESSAGE, xml.xpath("/program/listing/text()"), Matchers.contains(src) ); @@ -181,14 +181,14 @@ void parsesSuccessfully(final String code) { ); Assertions.assertDoesNotThrow( syntax::parsed, - EoSyntaxTest.EMPTY_MSG + EoSyntaxTest.TO_ADD_MESSAGE ); } @Test void parsesArrow() throws IOException { MatcherAssert.assertThat( - EoSyntaxTest.EMPTY_MSG, + EoSyntaxTest.TO_ADD_MESSAGE, new EoSyntax( "test-it-3", new InputOf("1 > x") @@ -212,7 +212,7 @@ void prasesNested() throws IOException { " v\n" ); MatcherAssert.assertThat( - EoSyntaxTest.EMPTY_MSG, + EoSyntaxTest.TO_ADD_MESSAGE, new EoSyntax( "test-it-4", new InputOf(src) @@ -227,7 +227,7 @@ void prasesNested() throws IOException { @Test void parsesDefinition() throws IOException { MatcherAssert.assertThat( - EoSyntaxTest.EMPTY_MSG, + EoSyntaxTest.TO_ADD_MESSAGE, new EoSyntax( "test-it-5", new InputOf( @@ -249,7 +249,7 @@ void parsesDefinition() throws IOException { @Test void parsesMethodCalls() throws IOException { MatcherAssert.assertThat( - EoSyntaxTest.EMPTY_MSG, + EoSyntaxTest.TO_ADD_MESSAGE, new EoSyntax( "test-it-1", new InputOf("add.\n 0\n true") @@ -279,7 +279,7 @@ void storesAsBytes(final String code) throws IOException { ) ); MatcherAssert.assertThat( - EoSyntaxTest.EMPTY_MSG, + EoSyntaxTest.TO_ADD_MESSAGE, xml, XhtmlMatchers.hasXPaths( "/program/objects[count(o)=1]", @@ -299,7 +299,7 @@ void checksTypoPacks(final String yml) throws IOException { new InputOf(String.format("%s\n", map.get("eo"))) ).parsed(); MatcherAssert.assertThat( - EoSyntaxTest.EMPTY_MSG, + EoSyntaxTest.TO_ADD_MESSAGE, XhtmlMatchers.xhtml(xml.toString()), XhtmlMatchers.hasXPaths("/program/errors/error/@line") ); diff --git a/eo-parser/src/test/java/org/eolang/parser/StUnhexTest.java b/eo-parser/src/test/java/org/eolang/parser/StUnhexTest.java index 9312a90462..f72e06dc1a 100644 --- a/eo-parser/src/test/java/org/eolang/parser/StUnhexTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/StUnhexTest.java @@ -38,12 +38,12 @@ final class StUnhexTest { /** * Empty message for JUnit Assertions. */ - private static final String EMPTY_MSG = "TO ADD ASSERTION MESSAGE"; + private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @Test void convertsIntFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.EMPTY_MSG, + StUnhexTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( "

01 02 E4 F3 04 67 32 E1

" @@ -56,7 +56,7 @@ void convertsIntFromHexToEo() { @Test void convertsMaxIntFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.EMPTY_MSG, + StUnhexTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( "

FF FF FF FF FF FF FF FF

" @@ -69,7 +69,7 @@ void convertsMaxIntFromHexToEo() { @Test void convertsStringFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.EMPTY_MSG, + StUnhexTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( String.join( @@ -89,7 +89,7 @@ void convertsStringFromHexToEo() { @Test void convertsEmptyStringFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.EMPTY_MSG, + StUnhexTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( "

" @@ -104,7 +104,7 @@ void convertsEmptyStringFromHexToEo() { @Test void convertsFloatFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.EMPTY_MSG, + StUnhexTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( "

41 42 43 67 AE CD 3E FD

" @@ -119,7 +119,7 @@ void convertsFloatFromHexToEo() { @Test void convertsTrueFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.EMPTY_MSG, + StUnhexTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( String.join( @@ -139,7 +139,7 @@ void convertsTrueFromHexToEo() { @Test void convertsFalseFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.EMPTY_MSG, + StUnhexTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( "

00

" From 5228a9771d18075bd5d2f9973f800940a819e8fd Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Fri, 19 Apr 2024 15:57:59 +0300 Subject: [PATCH 06/11] #2997 add todo for replacing empty messages --- .../java/org/eolang/maven/objectionary/OyFallbackSwapTest.java | 3 +++ 1 file changed, 3 insertions(+) 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 225b853caf..2cbf2ed1f5 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 @@ -35,6 +35,9 @@ /** * 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 { From 7e465e130a0ce32a95ee1950ba0a2004a896e841 Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:48:42 +0300 Subject: [PATCH 07/11] #2297 resolved empty message duplication for eo-maven-plugin --- .../org/eolang/maven/BinarizeMojoTest.java | 21 ++++------ .../org/eolang/maven/BinarizeParseTest.java | 12 ++++-- .../java/org/eolang/maven/CatalogsTest.java | 2 +- .../java/org/eolang/maven/CleanMojoTest.java | 4 +- .../java/org/eolang/maven/CopyMojoTest.java | 6 +-- .../java/org/eolang/maven/DepDirsTest.java | 4 +- .../org/eolang/maven/DiscoverMojoTest.java | 4 +- .../java/org/eolang/maven/JavaFilesTest.java | 4 +- .../java/org/eolang/maven/LatexMojoTest.java | 4 +- .../java/org/eolang/maven/LogFormatTest.java | 2 +- .../java/org/eolang/maven/MarkMojoTest.java | 6 +-- .../org/eolang/maven/OptimizeMojoTest.java | 20 ++++----- .../java/org/eolang/maven/ParseMojoTest.java | 10 ++--- .../java/org/eolang/maven/PhiMojoTest.java | 2 +- .../java/org/eolang/maven/PlaceMojoTest.java | 41 ++++++++----------- .../test/java/org/eolang/maven/PlaceTest.java | 4 +- .../java/org/eolang/maven/PullMojoTest.java | 10 ++--- .../org/eolang/maven/RegisterMojoTest.java | 6 +-- .../org/eolang/maven/ResolveMojoTest.java | 26 ++++++------ .../java/org/eolang/maven/SafeMojoTest.java | 4 +- .../java/org/eolang/maven/SodgMojoTest.java | 6 +-- .../org/eolang/maven/TranspileMojoTest.java | 36 ++++++++-------- .../org/eolang/maven/UnplaceMojoTest.java | 22 +++++----- .../java/org/eolang/maven/UnplaceTest.java | 2 +- .../java/org/eolang/maven/VerifyMojoTest.java | 2 +- .../maven/dependencies/DcsDepgraphTest.java | 3 +- .../DcsEachWithoutTransitiveTest.java | 9 ++-- .../dependencies/DcsWithRuntimeTest.java | 5 ++- .../maven/footprint/CacheVersionTest.java | 5 ++- .../eolang/maven/footprint/FtCachedTest.java | 16 +++----- .../eolang/maven/footprint/FtDefaultTest.java | 9 ++-- .../org/eolang/maven/hash/ChCachedTest.java | 5 ++- .../org/eolang/maven/hash/ChNarrowTest.java | 3 +- .../org/eolang/maven/hash/ChPatternTest.java | 3 +- .../org/eolang/maven/hash/ChRemoteTest.java | 7 ++-- .../org/eolang/maven/hash/ChTextTest.java | 7 ++-- .../maven/objectionary/ObjectsIndexTest.java | 16 +++----- .../maven/objectionary/OyCachingTest.java | 7 ++-- .../maven/objectionary/OyEmptyTest.java | 5 ++- .../objectionary/OyFallbackSwapTest.java | 21 ++++------ .../maven/objectionary/OyFallbackTest.java | 28 ++++++------- .../maven/objectionary/OyFilesystemTest.java | 7 ++-- .../eolang/maven/objectionary/OyHomeTest.java | 7 ++-- .../maven/objectionary/OyIndexedTest.java | 9 ++-- .../maven/objectionary/OyRemoteTest.java | 3 +- .../org/eolang/maven/rust/ModuleTest.java | 3 +- .../java/org/eolang/maven/rust/NamesTest.java | 9 ++-- .../org/eolang/maven/rust/NativeTest.java | 3 +- .../eolang/maven/rust/PrimeModuleTest.java | 3 +- .../eolang/maven/tojos/ForeignTojosTest.java | 5 ++- .../maven/tojos/TranspiledTojosTest.java | 22 ++++------ .../org/eolang/maven/util/FileHashTest.java | 5 ++- .../org/eolang/maven/util/HmBaseTest.java | 22 ++++------ .../java/org/eolang/maven/util/RelTest.java | 5 ++- 54 files changed, 252 insertions(+), 260 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 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") From e89c483f66f2e7300142d633affb327fdc99fd8f Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:57:45 +0300 Subject: [PATCH 08/11] #2297 resolve empty message duplication for eo-runtime --- .../org/eolang/maven/BinarizeParseTest.java | 2 +- .../test/java/EOorg/EOeolang/CagesTest.java | 13 ++++--- .../java/EOorg/EOeolang/EOas_phiTest.java | 3 +- .../EOorg/EOeolang/EObytesEOconcatTest.java | 3 +- .../test/java/EOorg/EOeolang/EOcageTest.java | 23 +++++------ .../test/java/EOorg/EOeolang/EOerrorTest.java | 5 ++- .../java/EOorg/EOeolang/EOintEOeqTest.java | 3 +- .../java/EOorg/EOeolang/EOintEOltTest.java | 3 +- .../java/EOorg/EOeolang/EOintEOminusTest.java | 3 +- .../java/EOorg/EOeolang/EOintEOnegTest.java | 3 +- .../java/EOorg/EOeolang/EOintEOplusTest.java | 3 +- .../test/java/EOorg/EOeolang/EOintTest.java | 7 ++-- .../java/EOorg/EOeolang/EOio/EOstdinTest.java | 27 ++++++------- .../EOorg/EOeolang/EOio/EOstdoutTest.java | 9 +++-- .../java/EOorg/EOeolang/EOmemoryTest.java | 31 +++++++-------- .../test/java/EOorg/EOeolang/EOseqTest.java | 5 ++- .../EOorg/EOeolang/EOstringEOasBytesTest.java | 3 +- .../EOorg/EOeolang/EOstringEOsliceTest.java | 3 +- .../java/EOorg/EOeolang/EOstringTest.java | 5 ++- .../test/java/EOorg/EOeolang/EOtryTest.java | 11 +++--- .../java/EOorg/EOeolang/EOtupleEOatTest.java | 13 ++++--- .../test/java/EOorg/EOeolang/HeapsTest.java | 27 ++++++------- .../test/java/org/eolang/AtCompositeTest.java | 19 ++++++++-- .../test/java/org/eolang/AtLoggedTest.java | 18 ++++----- .../src/test/java/org/eolang/AtNamedTest.java | 2 +- .../src/test/java/org/eolang/BytesOfTest.java | 24 ++++++------ .../src/test/java/org/eolang/DataTest.java | 14 +++---- .../test/java/org/eolang/DataizedTest.java | 10 ++--- .../java/org/eolang/ExInterruptedTest.java | 2 +- .../test/java/org/eolang/JavaPathTest.java | 2 +- .../src/test/java/org/eolang/MainTest.java | 22 +++++------ .../src/test/java/org/eolang/PhCopyTest.java | 4 +- .../src/test/java/org/eolang/PhDataTest.java | 4 +- .../test/java/org/eolang/PhDefaultTest.java | 38 +++++++++---------- .../test/java/org/eolang/PhLocatedTest.java | 2 +- .../test/java/org/eolang/PhLoggedTest.java | 12 +++--- .../test/java/org/eolang/PhMethodTest.java | 12 +++--- .../src/test/java/org/eolang/PhNamedTest.java | 4 +- .../test/java/org/eolang/PhPackageTest.java | 22 +++++------ .../src/test/java/org/eolang/PhWithTest.java | 14 +++---- .../src/test/java/org/eolang/PhiTest.java | 8 ++-- .../java/org/eolang/UniverseDefaultTest.java | 20 +++++----- .../org/eolang/VerboseBytesAsStringTest.java | 2 +- .../test/java/org/eolang/VerticesTest.java | 4 +- 44 files changed, 248 insertions(+), 216 deletions(-) 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 ff38088529..64bcd49190 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 @@ -45,7 +45,7 @@ * @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 + * eo-maven-plugin 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. */ diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/CagesTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/CagesTest.java index 27b31c9afa..17a2523a1d 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/CagesTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/CagesTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.ExFailure; import org.eolang.PhFake; @@ -47,7 +48,7 @@ void initializesObjectForTheFirstTime() { final int locator = Cages.INSTANCE.init(phi); Assertions.assertDoesNotThrow( () -> Cages.INSTANCE.get(locator), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -57,7 +58,7 @@ void rencagesTheSameObject() { Cages.INSTANCE.init(phi); Assertions.assertDoesNotThrow( () -> Cages.INSTANCE.init(phi), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -68,7 +69,7 @@ void encagesObjectWithLocator() { final int locator = Cages.INSTANCE.init(first); Cages.INSTANCE.encage(locator, second); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, Cages.INSTANCE.get(locator).hashCode(), Matchers.equalTo(second.hashCode()) ); @@ -80,7 +81,7 @@ void failsToEncageObjectIfIsWasInitialized() { Assertions.assertThrows( ExFailure.class, () -> Cages.INSTANCE.encage(phi.hashCode(), phi), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -90,7 +91,7 @@ void failsToEncageObjectOfDifferentForma() { Assertions.assertThrows( ExFailure.class, () -> Cages.INSTANCE.encage(locator, new Data.ToPhi(5L)), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -99,7 +100,7 @@ void failsToGetObjectIfWasNotInitialized() { Assertions.assertThrows( ExFailure.class, () -> Cages.INSTANCE.get(new PhFake().hashCode()), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } } diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOas_phiTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOas_phiTest.java index 6a3d701c07..0159ae1be2 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOas_phiTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOas_phiTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.PhWith; @@ -46,7 +47,7 @@ final class EOas_phiTest { @Test void printsAndReturns() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( new EOas_phi(Phi.Φ), diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EObytesEOconcatTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EObytesEOconcatTest.java index 40ce566c3f..60db92d821 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EObytesEOconcatTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EObytesEOconcatTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.PhMethod; @@ -57,7 +58,7 @@ void concatenatesBytes() { "as-string" ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(phi).take(String.class), Matchers.equalTo("привет mr. ㄤㄠ!") ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOcageTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOcageTest.java index edb09a5458..72db6b68ec 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOcageTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOcageTest.java @@ -32,6 +32,7 @@ import org.cactoos.Scalar; import org.cactoos.experimental.Threads; import org.cactoos.number.SumOf; +import org.eolang.AtCompositeTest; import org.eolang.AtVoid; import org.eolang.Atom; import org.eolang.Data; @@ -62,7 +63,7 @@ final class EOcageTest { void encagesViaApplication() { final Phi cage = EOcageTest.encaged(new Data.ToPhi(1L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(cage).take(Long.class), Matchers.equalTo(1L) ); @@ -73,7 +74,7 @@ void encagesAndFrees() { final Phi cage = EOcageTest.encaged(new Data.ToPhi(1L)); EOcageTest.encageTo(cage, new Data.ToPhi(2L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(cage).take(Long.class), Matchers.equalTo(2L) ); @@ -88,7 +89,7 @@ void overwritesCagedObject() { ) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(new PhMethod(cage, "x")).take(Long.class), Matchers.equalTo(1L) ); @@ -100,7 +101,7 @@ void overwritesCagedObject() { ) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(new PhMethod(cage, "x")).take(Long.class), Matchers.equalTo(2L) ); @@ -112,7 +113,7 @@ void encagesObjectOnCopy() { final Phi second = first.copy(); EOcageTest.encageTo(second, new Data.ToPhi(2L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(first).take(Long.class), Matchers.equalTo(2L) ); @@ -122,13 +123,13 @@ void encagesObjectOnCopy() { void writesAndRewritesPrimitive() { final Phi cage = EOcageTest.encaged(new Data.ToPhi(1L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(cage).take(Long.class), Matchers.equalTo(1L) ); EOcageTest.encageTo(cage, new Data.ToPhi(5L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(cage).take(Long.class), Matchers.equalTo(5L) ); @@ -140,7 +141,7 @@ void doesNotWritePrimitivesFormedDifferently() { Assertions.assertThrows( EOerror.ExError.class, () -> EOcageTest.encageTo(cage, new Data.ToPhi("Hello world")), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -156,7 +157,7 @@ void doesNotWriteBoundedMethod() { Assertions.assertThrows( EOerror.ExError.class, () -> EOcageTest.encageTo(cage, ten), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -168,7 +169,7 @@ void writesBoundedCopyOfTheSameBase() { EOcageTest.encaged(dummy), new PhWith(new PhCopy(dummy), "x", new Data.ToPhi("Hello world")) ), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -228,7 +229,7 @@ void doesNotThrowIfDataizesConcurrently() { ); final int threads = 500; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new SumOf( new Threads<>( threads, diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOerrorTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOerrorTest.java index 0fb84577e9..307fcf6b77 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOerrorTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOerrorTest.java @@ -29,6 +29,7 @@ import java.util.stream.Stream; import org.eolang.AtComposite; +import org.eolang.AtCompositeTest; import org.eolang.AtOnce; import org.eolang.Data; import org.eolang.Dataized; @@ -63,7 +64,7 @@ void makesToxicObject() { new Data.ToPhi("intentional error") ) ).take(), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -78,7 +79,7 @@ void getsReadableError(final Object cnst) { } assert error != null; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, error.toString(), Matchers.containsString( new VerboseBytesAsStringTest.ArgumentsUtils().toString(cnst) diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOeqTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOeqTest.java index e6b560cf1e..ebfe187059 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOeqTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOeqTest.java @@ -31,6 +31,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.PhWith; @@ -59,7 +60,7 @@ void comparesWithAnotherNumber() { 0, right ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(eql).take(Boolean.class), Matchers.equalTo(false) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOltTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOltTest.java index c7a4f64956..557492bbeb 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOltTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOltTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.Phi; @@ -52,7 +53,7 @@ void comparesWithAnotherNumber() { final Phi less = left.take("lt"); less.put(0, right); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(less).take(Boolean.class), Matchers.equalTo(false) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOminusTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOminusTest.java index f70f36df84..43a5e83808 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOminusTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOminusTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.PhMethod; @@ -56,7 +57,7 @@ void subtractsNumber() { 0, right ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(sub).take(Long.class), Matchers.equalTo(29L) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOnegTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOnegTest.java index 9eaae846fb..6016cf1297 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOnegTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOnegTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.PhMethod; @@ -51,7 +52,7 @@ void negatesNumber() { final Phi left = new Data.ToPhi(42L); final Phi neg = new PhMethod(left, "neg"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(neg).take(Long.class), Matchers.equalTo(-42L) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOplusTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOplusTest.java index 5a9e8bb818..a13a9fe216 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOplusTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintEOplusTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.Phi; @@ -49,7 +50,7 @@ void addsNumbers() { final Phi add = left.take("plus"); add.put(0, right); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(add).take(Long.class), Matchers.equalTo(55L) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOintTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOintTest.java index 9b869f0810..62ce9f9625 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOintTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOintTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Phi; import org.hamcrest.MatcherAssert; @@ -46,7 +47,7 @@ void hasDifferentHashes() { final Phi left = new Data.ToPhi(42L); final Phi right = new Data.ToPhi(42L); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, left.hashCode(), Matchers.not(Matchers.equalTo(right.hashCode())) ); @@ -56,7 +57,7 @@ void hasDifferentHashes() { void hasHashEvenWithoutData() { final Phi phi = new EOint(Phi.Φ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, phi.hashCode(), Matchers.greaterThan(0) ); @@ -67,7 +68,7 @@ void hasDifferentHash() { final Phi raw = new EOint(Phi.Φ); final Phi initialized = new Data.ToPhi(0L); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, raw.hashCode(), Matchers.not(initialized.hashCode()) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdinTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdinTest.java index f89d88244f..872a869f74 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdinTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdinTest.java @@ -30,6 +30,7 @@ import EOorg.EOeolang.EOerror; import java.io.InputStream; import java.lang.reflect.Field; +import org.eolang.AtCompositeTest; import org.eolang.Dataized; import org.eolang.PhCopy; import org.eolang.PhMethod; @@ -62,7 +63,7 @@ final class EOstdinTest { @AfterAll static void restoreSystemInput() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, System.in, Matchers.equalTo(EOstdinTest.DEFAULT_STDIN) ); @@ -90,7 +91,7 @@ void dataizesNextLineOneLine(final StdIn stdin) { final Phi phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); final String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.equalTo(expected) ); @@ -103,7 +104,7 @@ void dataizesStdinOneLine(final StdIn stdin) { final Phi phi = new PhCopy(new EOstdin(Phi.Φ)); final String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.equalTo(expected) ); @@ -116,7 +117,7 @@ void dataizesNextLineMultiLine(final StdIn stdin) { final Phi phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); final String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.equalTo(expected) ); @@ -131,7 +132,7 @@ void dataizesNextLineEmpty(final StdIn stdin) { () -> new Dataized(phi).take(String.class) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(error.enclosure()).take(String.class), Matchers.containsString( "There is no line in the standard input stream to consume" @@ -143,7 +144,7 @@ void dataizesNextLineEmpty(final StdIn stdin) { @Test void dataizesEmptyStdin(final StdIn stdin) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(new EOstdin(Phi.Φ)).take(String.class), Matchers.equalTo(System.lineSeparator()) ); @@ -158,7 +159,7 @@ void dataizesStdinMultiLine(final StdIn stdin) { final Phi phi = new PhCopy(new EOstdin(Phi.Φ)); final String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.equalTo(first + second + third) ); @@ -173,21 +174,21 @@ void dataizesStdinFewOneLine(final StdIn stdin) { Phi phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.equalTo(first) ); phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.equalTo(second) ); phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.equalTo(third) ); @@ -201,21 +202,21 @@ void dataizesStdinEmptyLineBetweenNonEmpty(final StdIn stdin) { Phi phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); String actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.equalTo(first) ); phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.equalTo("") ); phi = new PhMethod(new PhCopy(new EOstdin(Phi.Φ)), "next-line"); actual = new Dataized(phi).take(String.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.equalTo(third) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdoutTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdoutTest.java index 8586fbe922..994c9f34d4 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdoutTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOstdoutTest.java @@ -33,6 +33,7 @@ import java.io.ByteArrayOutputStream; import java.io.PrintStream; import org.eolang.AtComposite; +import org.eolang.AtCompositeTest; import org.eolang.AtOnce; import org.eolang.Data; import org.eolang.Dataized; @@ -66,7 +67,7 @@ public void printsFromTuple() { stdout.put(0, ret); new Dataized(stdout).take(Boolean.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, stream.toString(), Matchers.equalTo("Hello") ); @@ -81,7 +82,7 @@ public void printsString() { format ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(phi).take(Boolean.class), Matchers.equalTo(true) ); @@ -107,7 +108,7 @@ public void doesNotPrintTwiceOnIntComparisonMethods(final String method) { ) ).take(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, stream.toString(), Matchers.equalTo(str) ); @@ -133,7 +134,7 @@ public void doesNotPrintTwiceOnFloatComparisonMethods(final String method) { ) ).take(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, stream.toString(), Matchers.equalTo(str) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOmemoryTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOmemoryTest.java index 6f3897a4ed..bbc24af509 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOmemoryTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOmemoryTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.PhCopy; @@ -55,7 +56,7 @@ public final class EOmemoryTest { void behavesAsBytes() { final Phi alloc = EOmemoryTest.allocated(new Data.ToPhi(1L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(alloc.take("as-int")).take(Long.class), Matchers.equalTo(1L) ); @@ -65,7 +66,7 @@ void behavesAsBytes() { void comparesWithInt() { final Phi alloc = EOmemoryTest.allocated(new Data.ToPhi(2L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( new PhMethod( @@ -83,7 +84,7 @@ void comparesWithInt() { void hasTheSameDataAfterCopy() { final Phi alloc = EOmemoryTest.allocated(new Data.ToPhi(2L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(alloc).take(), Matchers.equalTo(new Dataized(alloc.copy()).take()) ); @@ -94,7 +95,7 @@ void writesDataToNewMemorySegment() { final Phi first = EOmemoryTest.allocated(new Data.ToPhi(1L)); final Phi second = EOmemoryTest.allocated(new Data.ToPhi(2L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(first).take(), Matchers.not(Matchers.equalTo(new Dataized(second).take())) ); @@ -105,7 +106,7 @@ void rewritesToTheSameSegment() { final Phi alloc = EOmemoryTest.allocated(new Data.ToPhi(1L)); new Dataized(new PhWith(alloc.take("write").copy(), 0, new Data.ToPhi(10L))).take(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(alloc).take(Long.class), Matchers.equalTo(10L) ); @@ -115,7 +116,7 @@ void rewritesToTheSameSegment() { void takesAsIntAndUpdates() { final Phi alloc = EOmemoryTest.allocated(new Data.ToPhi(1L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( alloc.take("as-int").take("plus").copy(), @@ -130,7 +131,7 @@ void takesAsIntAndUpdates() { void getsWrittenValueRightAfterWriting() { final Phi mem = EOmemoryTest.allocated(new Data.ToPhi(1L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( mem.take(EOmemoryTest.WRITE).copy(), @@ -151,7 +152,7 @@ void comparesForEquality() { ) ).take(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( new PhCopy(new PhMethod(mem, "eq")), @@ -172,7 +173,7 @@ void writesAndRewrites() { ) ).take(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(mem.take("as-int")).take(Long.class), Matchers.equalTo(1L) ); @@ -183,7 +184,7 @@ void writesAndRewrites() { ) ).take(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(mem.take("as-int")).take(Long.class), Matchers.equalTo(5L) ); @@ -203,7 +204,7 @@ void doesNotCompareOnFly() { 0, new Data.ToPhi(10L) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(less).take(Boolean.class), Matchers.equalTo(true) ); @@ -214,7 +215,7 @@ void doesNotCompareOnFly() { ) ).take(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(less).take(Boolean.class), Matchers.not(Matchers.equalTo(false)) ); @@ -234,7 +235,7 @@ void rewritesItself() { ) ).take(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(mem.take("as-int")).take(Long.class), Matchers.equalTo(43L) ); @@ -251,7 +252,7 @@ void doesNotWriteMoreThanAllocated() { 0, new Data.ToPhi(8L) ) ).take(), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -264,7 +265,7 @@ void writesLessAndRewritesTheSame() { () -> new Dataized( new PhWith(write.copy(), 0, new Data.ToPhi(1L)) ).take(), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOseqTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOseqTest.java index 7f9eae6cad..f3f10941cf 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOseqTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOseqTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.PhWith; @@ -45,7 +46,7 @@ public final class EOseqTest { @Test public void calculatesAndReturns() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( new EOseq(Phi.Φ), @@ -66,7 +67,7 @@ public void calculatesAndReturns() { @Test public void calculatesAndReturnsObject() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( new EOseq(Phi.Φ), diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOasBytesTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOasBytesTest.java index b314cddf4f..6f11d5114b 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOasBytesTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOasBytesTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.Phi; @@ -48,7 +49,7 @@ void convertsStringToBytes() { final Phi str = new Data.ToPhi("Hello, друг!"); final Phi phi = str.take("as-bytes"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(phi).take(byte[].class).length, Matchers.equalTo(16) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOsliceTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOsliceTest.java index 759529b549..156dfd9d9d 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOsliceTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringEOsliceTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.PhWith; @@ -57,7 +58,7 @@ void slicesString() { new Data.ToPhi(1L) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(phi).take(String.class), Matchers.equalTo("ㄤ") ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringTest.java index f62451c970..85f0b9bf96 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOstringTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOstringTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.Data; import org.eolang.Dataized; import org.eolang.PhMethod; @@ -50,7 +51,7 @@ final class EOstringTest { void comparesTwoEqualStrings() { final String txt = "Hello, друг!"; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( new PhMethod(new Data.ToPhi(txt), "eq"), @@ -64,7 +65,7 @@ void comparesTwoEqualStrings() { @Test void comparesTwoDifferentStrings() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( new PhMethod(new Data.ToPhi("Hello, друг!"), "eq"), diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOtryTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOtryTest.java index eb75b2e8e9..0134635dea 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOtryTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOtryTest.java @@ -28,6 +28,7 @@ package EOorg.EOeolang; import org.eolang.AtComposite; +import org.eolang.AtCompositeTest; import org.eolang.AtVoid; import org.eolang.Attr; import org.eolang.Data; @@ -50,7 +51,7 @@ public final class EOtryTest { @Test public void catchesException() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( new PhWith( @@ -82,7 +83,7 @@ public void usesCatcherOutput() { new Data.ToPhi(true) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(body).take(String.class), Matchers.containsString("it is broken") ); @@ -102,7 +103,7 @@ public void printsCatcherOutput() { new Data.ToPhi(true) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(body).take(String.class), Matchers.containsString("it is broken") ); @@ -111,7 +112,7 @@ public void printsCatcherOutput() { @Test public void worksWithoutException() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( new PhWith( @@ -138,7 +139,7 @@ public void doesNotDataizeBodyTwice() { trier.put(2, new Data.ToPhi(true)); new Dataized(trier).take(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, main.count, Matchers.equalTo(1) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOtupleEOatTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOtupleEOatTest.java index fc6b6dc771..dc1c9d5646 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOtupleEOatTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOtupleEOatTest.java @@ -28,6 +28,7 @@ package EOorg.EOeolang; import org.eolang.AtComposite; +import org.eolang.AtCompositeTest; import org.eolang.AtOnce; import org.eolang.AtSimple; import org.eolang.AtVoid; @@ -63,12 +64,12 @@ void pushesAndGetsBack() { final Phi get = tuple.take("at").copy(); get.put(0, idx); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(get).take(String.class), Matchers.equalTo(txt) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(get).take(String.class), Matchers.equalTo(txt) ); @@ -77,12 +78,12 @@ void pushesAndGetsBack() { @Test void checksNegativeIndex() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(this.get(-1L)).take(String.class), Matchers.equalTo("second") ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(this.get(-2L)).take(String.class), Matchers.equalTo("first") ); @@ -93,7 +94,7 @@ void checksOutOfBounds() { Assertions.assertThrows( EOerror.ExError.class, () -> new Dataized(this.get(-3L)).take(), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -109,7 +110,7 @@ void returnsGivenArgument() { "args", copy ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(phi).take(Long.class), Matchers.equalTo(10L) ); diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java index 0320f27b3a..0172480a2a 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java @@ -27,6 +27,7 @@ */ package EOorg.EOeolang; +import org.eolang.AtCompositeTest; import org.eolang.ExFailure; import org.eolang.PhFake; import org.eolang.Phi; @@ -51,7 +52,7 @@ void allocatesMemory() { final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 10); Assertions.assertDoesNotThrow( () -> HeapsTest.HEAPS.read(idx, 0, 10), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); HeapsTest.HEAPS.free(idx); } @@ -63,7 +64,7 @@ void failsOnDoubleAllocation() { Assertions.assertThrows( ExFailure.class, () -> HeapsTest.HEAPS.malloc(phi, 10), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); HeapsTest.HEAPS.free(idx); } @@ -72,7 +73,7 @@ void failsOnDoubleAllocation() { void allocatesAndReadsEmptyBytes() { final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, HeapsTest.HEAPS.read(idx, 0, 5), Matchers.equalTo(new byte[] {0, 0, 0, 0, 0}) ); @@ -85,7 +86,7 @@ void writesAndReads() { final byte[] bytes = new byte[] {1, 2, 3, 4, 5}; HeapsTest.HEAPS.write(idx, 0, bytes); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, HeapsTest.HEAPS.read(idx, 0, bytes.length), Matchers.equalTo(bytes) ); @@ -97,7 +98,7 @@ void failsOnWriteToEmptyBlock() { Assertions.assertThrows( ExFailure.class, () -> HeapsTest.HEAPS.write(new PhFake().hashCode(), 0, new byte[] {0x01}), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -106,7 +107,7 @@ void failsOnReadFromEmptyBlock() { Assertions.assertThrows( ExFailure.class, () -> HeapsTest.HEAPS.read(new PhFake().hashCode(), 0, 1), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -116,7 +117,7 @@ void failsOnReadIfOutOfBounds() { Assertions.assertThrows( ExFailure.class, () -> HeapsTest.HEAPS.read(idx, 1, 3), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -125,7 +126,7 @@ void readsByOffsetAndLength() { final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); HeapsTest.HEAPS.write(idx, 0, new byte[] {1, 2, 3, 4, 5}); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, HeapsTest.HEAPS.read(idx, 1, 3), Matchers.equalTo(new byte[] {2, 3, 4}) ); @@ -138,7 +139,7 @@ void failsOnWriteMoreThanAllocated() { Assertions.assertThrows( ExFailure.class, () -> HeapsTest.HEAPS.write(idx, 0, bytes), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); HeapsTest.HEAPS.free(idx); } @@ -150,7 +151,7 @@ void failsToWriteMoreThanAllocatedWithOffset() { Assertions.assertThrows( ExFailure.class, () -> HeapsTest.HEAPS.write(idx, 1, bytes), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); HeapsTest.HEAPS.free(idx); } @@ -161,7 +162,7 @@ void concatsOnWriteLessThanAllocated() { HeapsTest.HEAPS.write(idx, 0, new byte[] {1, 1, 3, 4, 5}); HeapsTest.HEAPS.write(idx, 2, new byte[] {2, 2}); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, HeapsTest.HEAPS.read(idx, 0, 5), Matchers.equalTo(new byte[] {1, 1, 2, 2, 5}) ); @@ -175,7 +176,7 @@ void freesSuccessfully() { Assertions.assertThrows( ExFailure.class, () -> HeapsTest.HEAPS.read(idx, 0, 5), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -184,7 +185,7 @@ void failsOnClearingEmptyBlock() { Assertions.assertThrows( ExFailure.class, () -> HeapsTest.HEAPS.free(new PhFake().hashCode()), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } } diff --git a/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java b/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java index cb7101d4d9..7c2ffafcb3 100644 --- a/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java +++ b/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java @@ -33,8 +33,19 @@ * Test case for {@link AtComposite}. * * @since 0.16 + * + * + * @todo #2297:60m Replace all appearances of {@link AtCompositeTest#TO_ADD_MESSAGE} field in + * eo-runtime with meaningful assert messages. Don't forget to remove + * {@link AtCompositeTest#TO_ADD_MESSAGE} field and remove public modifier from this class if no + * longer need. */ -final class AtCompositeTest { +public final class AtCompositeTest { + + /** + * Empty message for JUnit Assertions. To be removed. + */ + public static final String TO_ADD_MESSAGE = AtCompositeTest.TO_ADD_MESSAGE; @Test void decoratesCheckedException() { @@ -46,7 +57,7 @@ void decoratesCheckedException() { throw new InstantiationException("intended checked"); } ).get(), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -60,7 +71,7 @@ void decoratesUncheckedException() { throw new IllegalStateException("intended unchecked"); } ).get(), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -69,7 +80,7 @@ void goesThroughJustOnce() { final Phi rnd = new Rnd(); final Phi phi = new PhMethod(rnd, Attr.LAMBDA); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(phi).take(Double.class), Matchers.equalTo( new Dataized(phi).take(Double.class) diff --git a/eo-runtime/src/test/java/org/eolang/AtLoggedTest.java b/eo-runtime/src/test/java/org/eolang/AtLoggedTest.java index fe45795332..396b72cb9a 100644 --- a/eo-runtime/src/test/java/org/eolang/AtLoggedTest.java +++ b/eo-runtime/src/test/java/org/eolang/AtLoggedTest.java @@ -87,7 +87,7 @@ void setUp() { @Test void convertsToStringAsOrigin() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, this.logged.toString(), Matchers.equalTo(this.origin.toString()) ); @@ -96,7 +96,7 @@ void convertsToStringAsOrigin() { @Test void convertsToPhiTermAsOrigin() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, this.logged.φTerm(), Matchers.equalTo(this.origin.φTerm()) ); @@ -106,12 +106,12 @@ void convertsToPhiTermAsOrigin() { void copiesWithLogging() { this.logged.copy(Phi.Φ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, this.log(), Matchers.containsString(String.format(" %s.copy()...", this.label)) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, this.log(), Matchers.containsString(String.format(" %s.copy()!", this.label)) ); @@ -120,17 +120,17 @@ void copiesWithLogging() { @Test void getsWithLogging() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, this.logged.get(), Matchers.equalTo(this.origin.get()) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, this.log(), Matchers.containsString(String.format(" %s.get()...", this.label)) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, this.log(), Matchers.containsString(String.format(" %s.get()!", this.label)) ); @@ -140,12 +140,12 @@ void getsWithLogging() { void putsWithLogging() { this.put.put(Phi.Φ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, this.log(), Matchers.containsString(String.format(" %s.put()...", this.label)) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, this.log(), Matchers.containsString(String.format(" %s.put()!", this.label)) ); diff --git a/eo-runtime/src/test/java/org/eolang/AtNamedTest.java b/eo-runtime/src/test/java/org/eolang/AtNamedTest.java index 2b991b6218..2c25d1c743 100644 --- a/eo-runtime/src/test/java/org/eolang/AtNamedTest.java +++ b/eo-runtime/src/test/java/org/eolang/AtNamedTest.java @@ -44,7 +44,7 @@ void rethrowsCorrectly() { () -> phi.take("x").take("anything") ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(error.enclosure()).take(String.class), Matchers.allOf( Matchers.containsString( diff --git a/eo-runtime/src/test/java/org/eolang/BytesOfTest.java b/eo-runtime/src/test/java/org/eolang/BytesOfTest.java index ff85c166aa..42a36e24d7 100644 --- a/eo-runtime/src/test/java/org/eolang/BytesOfTest.java +++ b/eo-runtime/src/test/java/org/eolang/BytesOfTest.java @@ -42,7 +42,7 @@ void negatesSeveralTimes() { final String text = "abc"; final Bytes bytes = new BytesOf(text); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, bytes.not().not(), Matchers.equalTo(new BytesOf(text)) ); @@ -52,7 +52,7 @@ void negatesSeveralTimes() { void negatesOnce() { final Bytes bytes = new BytesOf(-128L); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, bytes.not(), Matchers.equalTo(new BytesOf(127L)) ); @@ -62,7 +62,7 @@ void negatesOnce() { void checksAnd() { final Bytes bytes = new BytesOf(127L); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, bytes.and(bytes.not()), Matchers.equalTo(new BytesOf(0L)) ); @@ -72,7 +72,7 @@ void checksAnd() { void checksOr() { final Bytes bytes = new BytesOf(127L); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, bytes.or(bytes.not()), Matchers.equalTo(new BytesOf(-1L)) ); @@ -81,7 +81,7 @@ void checksOr() { @Test void checksPositiveInfinity() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new BytesOf(1.0d / 0.0d).asNumber(Double.class), Matchers.equalTo(Double.POSITIVE_INFINITY) ); @@ -90,7 +90,7 @@ void checksPositiveInfinity() { @Test void checksNegativeInfinity() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new BytesOf(-1.0d / 0.0d).asNumber(Double.class), Matchers.equalTo(Double.NEGATIVE_INFINITY) ); @@ -100,7 +100,7 @@ void checksNegativeInfinity() { void checksXor() { final Bytes bytes = new BytesOf(512L); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, bytes.xor(new BytesOf(-512L)), Matchers.equalTo(new BytesOf(-1024L)) ); @@ -110,7 +110,7 @@ void checksXor() { void checksAsNumberLong() { final Bytes bytes = new BytesOf(512L); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, bytes.asNumber(Long.class), Matchers.equalTo(512L) ); @@ -122,7 +122,7 @@ void checksUnderflowForLong() { Assertions.assertThrows( UnsupportedOperationException.class, () -> bytes.asNumber(Long.class), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -139,7 +139,7 @@ void checksUnderflowForLong() { void checksShift(final long num, final int bits, final long expected) { final Bytes bytes = new BytesOf(num); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, bytes.shift(bits).asNumber(Long.class), Matchers.equalTo(expected) ); @@ -161,7 +161,7 @@ void checksShifts(final long num, final int bits, final long expected) { final Bytes bytes = new BytesOf((int) num); final int actual = bytes.sshift(bits).asNumber(Integer.class); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.equalTo((int) expected) ); @@ -173,7 +173,7 @@ void doesNotSupportRightShift() { Assertions.assertThrows( UnsupportedOperationException.class, () -> bytes.sshift(-1), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } } diff --git a/eo-runtime/src/test/java/org/eolang/DataTest.java b/eo-runtime/src/test/java/org/eolang/DataTest.java index 28bdc3be3a..c9d5ffa10f 100644 --- a/eo-runtime/src/test/java/org/eolang/DataTest.java +++ b/eo-runtime/src/test/java/org/eolang/DataTest.java @@ -38,7 +38,7 @@ final class DataTest { @Test void printsByteArray() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Data.ToPhi(new byte[] {(byte) 0x01, (byte) 0xf2}).toString(), Matchers.containsString("01-F2") ); @@ -47,7 +47,7 @@ void printsByteArray() { @Test void printsEmptyByteArray() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Data.ToPhi(new byte[0]).toString(), Matchers.containsString("--") ); @@ -78,7 +78,7 @@ void printsString() { @Test void comparesVertex() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Data.ToPhi(42L).hashCode(), Matchers.not( Matchers.equalTo( @@ -91,22 +91,22 @@ void comparesVertex() { @Test void comparesTwoDatas() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Data.ToPhi(1L), Matchers.not(Matchers.equalTo(new Data.ToPhi(1L))) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Data.ToPhi("Welcome"), Matchers.not(Matchers.equalTo(new Data.ToPhi("Welcome"))) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Data.ToPhi(2.18d), Matchers.not(Matchers.equalTo(new Data.ToPhi(2.18d))) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Data.ToPhi(new byte[] {(byte) 0x00, (byte) 0x1f}), Matchers.not(Matchers.equalTo(new Data.ToPhi(new byte[] {(byte) 0x00, (byte) 0x1f}))) ); diff --git a/eo-runtime/src/test/java/org/eolang/DataizedTest.java b/eo-runtime/src/test/java/org/eolang/DataizedTest.java index 760c573fc9..b2f856968f 100644 --- a/eo-runtime/src/test/java/org/eolang/DataizedTest.java +++ b/eo-runtime/src/test/java/org/eolang/DataizedTest.java @@ -58,7 +58,7 @@ void logsCorrectly() { log.setLevel(before); log.removeHandler(hnd); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, logs.get(0).getMessage(), Matchers.allOf( Matchers.containsString("intν"), @@ -81,14 +81,14 @@ void logsWhenException() { i -> Assertions.assertThrows( IllegalStateException.class, () -> new Dataized(wrong).take(), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ) ); new Dataized(new Data.ToPhi(1L), log).take(); log.setLevel(before); log.removeHandler(hnd); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, logs.get(0).getMessage(), Matchers.allOf( Matchers.containsString("intν"), @@ -122,7 +122,7 @@ void printsShortLogs() throws InterruptedException { log.setLevel(before); log.removeHandler(hnd); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, logs.size(), Matchers.equalTo(1) ); @@ -153,7 +153,7 @@ void printsLongLogs() throws InterruptedException { log.setLevel(before); log.removeHandler(hnd); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, logs.size(), Matchers.greaterThan(1) ); diff --git a/eo-runtime/src/test/java/org/eolang/ExInterruptedTest.java b/eo-runtime/src/test/java/org/eolang/ExInterruptedTest.java index 874536ca20..fd348efbf4 100644 --- a/eo-runtime/src/test/java/org/eolang/ExInterruptedTest.java +++ b/eo-runtime/src/test/java/org/eolang/ExInterruptedTest.java @@ -39,7 +39,7 @@ void throwsRightException() { Assertions.assertThrows( ExInterrupted.class, () -> new Dataized(phi.take(Attr.PHI)).take(), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } diff --git a/eo-runtime/src/test/java/org/eolang/JavaPathTest.java b/eo-runtime/src/test/java/org/eolang/JavaPathTest.java index b925ca61b7..7f29fd1171 100644 --- a/eo-runtime/src/test/java/org/eolang/JavaPathTest.java +++ b/eo-runtime/src/test/java/org/eolang/JavaPathTest.java @@ -47,7 +47,7 @@ class JavaPathTest { }) void convertsToString(final String name, final String expected) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new JavaPath(name).toString(), Matchers.equalTo(expected) ); diff --git a/eo-runtime/src/test/java/org/eolang/MainTest.java b/eo-runtime/src/test/java/org/eolang/MainTest.java index 633a21766a..a8fdd226a3 100644 --- a/eo-runtime/src/test/java/org/eolang/MainTest.java +++ b/eo-runtime/src/test/java/org/eolang/MainTest.java @@ -49,7 +49,7 @@ final class MainTest { @Test void printsVersion() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, MainTest.exec("--version"), Matchers.allOf( Matchers.containsString("."), @@ -61,7 +61,7 @@ void printsVersion() { @Test void printsHelp() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, MainTest.exec("--help"), Matchers.containsString("Usage: ") ); @@ -71,7 +71,7 @@ void printsHelp() { @Disabled void deliversCleanOutput() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, MainTest.exec("org.eolang.io.tupled-stdout", "Hello!"), Matchers.stringContainsInOrder( String.format("Hello!%n---%n"), @@ -85,7 +85,7 @@ void deliversCleanOutput() { @Disabled void executesJvmFullRun() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, MainTest.exec("--verbose", "org.eolang.io.tupled-stdout", "Hello, dude!"), Matchers.allOf( Matchers.containsString("EOLANG"), @@ -99,7 +99,7 @@ void executesJvmFullRun() { @Test void executesJvmFullRunWithDashedObject() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, MainTest.exec("--verbose", "as-bytes"), Matchers.allOf( Matchers.containsString("Loading class EOas_bytes"), @@ -111,7 +111,7 @@ void executesJvmFullRunWithDashedObject() { @Test void executesJvmFullRinWithAttributeCall() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, MainTest.exec("--verbose", "string$as-bytes"), Matchers.allOf( Matchers.containsString("Loading class EOstring$EOas_bytes"), @@ -123,7 +123,7 @@ void executesJvmFullRinWithAttributeCall() { @Test void executesJvmFullRunWithError() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, MainTest.exec("--verbose", "org.eolang.io.stdout"), Matchers.containsString("Error at \"EOorg.EOeolang.EOio.EOstdout#text\" attribute") ); @@ -132,7 +132,7 @@ void executesJvmFullRunWithError() { @Test void executesWithObjectNotFoundException() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, MainTest.exec("unavailable-name"), Matchers.containsString("Can not find 'unavailable-name' object") ); @@ -153,7 +153,7 @@ void readsStreamCorrectly() throws IOException { ) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, reader.readLine().length(), Matchers.greaterThan(0) ); @@ -174,7 +174,7 @@ void readsSimpleStreamCorrectly() throws IOException { ) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, reader.readLine().length(), Matchers.greaterThan(1) ); @@ -183,7 +183,7 @@ void readsSimpleStreamCorrectly() throws IOException { @Test void readsBytesCorrectly() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new ByteArrayInputStream( "··\uD835\uDD38➜Φ".getBytes( StandardCharsets.UTF_8 diff --git a/eo-runtime/src/test/java/org/eolang/PhCopyTest.java b/eo-runtime/src/test/java/org/eolang/PhCopyTest.java index 792c6b9ab8..a2d4f31c84 100644 --- a/eo-runtime/src/test/java/org/eolang/PhCopyTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhCopyTest.java @@ -37,7 +37,7 @@ final class PhCopyTest { @Test void makesObjectCopy() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhCopy(new Data.ToPhi(1L)) ).take(Long.class), @@ -49,7 +49,7 @@ void makesObjectCopy() { void hasTheSameFormaAsCopied() { final Phi phi = new Data.ToPhi(1L); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, phi.forma(), Matchers.equalTo( phi.copy().forma() diff --git a/eo-runtime/src/test/java/org/eolang/PhDataTest.java b/eo-runtime/src/test/java/org/eolang/PhDataTest.java index 816a478947..87553128ee 100644 --- a/eo-runtime/src/test/java/org/eolang/PhDataTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhDataTest.java @@ -36,7 +36,7 @@ public class PhDataTest { @Test void addsApplicationWithDelta() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhData(Phi.Φ, new byte[] {1, 2, 3}).φTerm(), Matchers.containsString("(Δ ↦ 01-02-03)") ); @@ -46,7 +46,7 @@ void addsApplicationWithDelta() { void returnsData() { final byte[] data = new byte[] {0x2A, 0x3B}; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhData(new Dummy(), data).delta(), Matchers.equalTo(data) ); diff --git a/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java b/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java index bd7da3ddb5..2eb315b5a8 100644 --- a/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java @@ -250,7 +250,7 @@ void doesNotCopySetVoidAttributeWithRho() { final Phi phi = new PhDefaultTest.Int(); phi.put("void", new Data.ToPhi(10L)); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, phi.take("void"), Matchers.equalTo(phi.take("void")) ); @@ -260,7 +260,7 @@ void doesNotCopySetVoidAttributeWithRho() { void doesNotCopyContextAttributeWithRho() { final Phi phi = new PhDefaultTest.Int(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, phi.take("context"), Matchers.equalTo(phi.take("context")) ); @@ -272,12 +272,12 @@ void hasAccessToDependentOnContextAttribute() { Assertions.assertThrows( EOerror.ExError.class, () -> phi.take(Attr.PHI), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); phi.put("void", new Data.ToPhi(10L)); Assertions.assertDoesNotThrow( () -> phi.take(Attr.PHI), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -297,7 +297,7 @@ void hasContextedChildWithSetRhoWhenFormed() { void makesObjectIdentity() { final Phi phi = new PhDefaultTest.Int(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, phi.hashCode(), Matchers.greaterThan(0) ); @@ -314,7 +314,7 @@ void createsDifferentPhiInParallel() { ).limit(threads).collect(Collectors.toList()) ).forEach(objects::add); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, objects, Matchers.hasSize(threads) ); @@ -325,7 +325,7 @@ void failsGracefullyOnMissingAttribute() { Assertions.assertThrows( EOerror.ExError.class, () -> new Data.ToPhi("Hey").take("missing-attr"), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -336,7 +336,7 @@ void copiesWithSetData() { phi.put(0, new Data.ToPhi(data)); final Phi copy = phi.copy(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(copy).take(String.class), Matchers.equalTo(data) ); @@ -350,7 +350,7 @@ void setsVoidAttributeOnlyOnce() { Assertions.assertThrows( ExReadOnly.class, () -> phi.put(0, num), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -359,7 +359,7 @@ void printsEndlessRecursionObject() { final Phi phi = new PhDefaultTest.EndlessRecursion(Phi.Φ); PhDefaultTest.EndlessRecursion.count = 2; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(phi).take(Long.class), Matchers.equalTo(0L) ); @@ -370,7 +370,7 @@ void cachesPhiRecursively() { final Phi phi = new PhDefaultTest.RecursivePhi(Phi.Φ); PhDefaultTest.RecursivePhi.count = 3; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(phi).take(Long.class), Matchers.equalTo(0L) ); @@ -381,7 +381,7 @@ void cachesPhiViaNewRecursively() { final Phi phi = new PhDefaultTest.RecursivePhiViaNew(Phi.Φ); PhDefaultTest.RecursivePhiViaNew.count = 3; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(phi).take(Long.class), Matchers.equalTo(0L) ); @@ -395,7 +395,7 @@ void refersToOriginalObjectAndDoesNotResetCache() { copy.take("plus"); phi.take("plus"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, PhDefaultTest.Dummy.count, Matchers.equalTo(1) ); @@ -409,7 +409,7 @@ void doesNotReadMultipleTimes() { new Dataized(phi).take(); } MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(new PhMethod(phi, "count")).take(Long.class), Matchers.equalTo(1L) ); @@ -418,7 +418,7 @@ void doesNotReadMultipleTimes() { @Test void hasTheSameFormaWithBoundedData() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Data.ToPhi(5L).forma(), Matchers.equalTo(new Data.ToPhi(6L).forma()) ); @@ -428,7 +428,7 @@ void hasTheSameFormaWithBoundedData() { void hasDifferentFormaWithBoundedMethod() { final Phi five = new Data.ToPhi(5L); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, five.forma(), Matchers.not( Matchers.equalTo( @@ -445,7 +445,7 @@ void hasDifferentFormaWithBoundedMethod() { @Test void hasTheSameFormaWithDifferentInstances() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhWith( new Data.ToPhi(5L).take("plus").copy(), "x", @@ -476,7 +476,7 @@ void doesNotCalculateRandomTwice() { 0, new Data.ToPhi(1.2) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(rnd).take(Double.class), Matchers.equalTo(new Dataized(rnd).take(Double.class)) ); @@ -485,7 +485,7 @@ void doesNotCalculateRandomTwice() { @Test void injectsDeltaIntoTerm() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Data.ToPhi(new byte[] {0x01, 0x02, 0x03}).φTerm(), Matchers.containsString("Δ ↦ 01-02-03") ); diff --git a/eo-runtime/src/test/java/org/eolang/PhLocatedTest.java b/eo-runtime/src/test/java/org/eolang/PhLocatedTest.java index 11955e44ff..66678764b9 100644 --- a/eo-runtime/src/test/java/org/eolang/PhLocatedTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhLocatedTest.java @@ -38,7 +38,7 @@ class PhLocatedTest { void savesLocationAfterCopying() { final Phi located = new PhLocated(new Data.ToPhi(0L), 123, 124, "qwerty"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, located.copy().locator(), Matchers.equalTo(located.locator()) ); diff --git a/eo-runtime/src/test/java/org/eolang/PhLoggedTest.java b/eo-runtime/src/test/java/org/eolang/PhLoggedTest.java index 53af79a3cd..47b3d04c39 100644 --- a/eo-runtime/src/test/java/org/eolang/PhLoggedTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhLoggedTest.java @@ -38,7 +38,7 @@ class PhLoggedTest { @Test void convertsToOriginTerm() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhLogged(Phi.Φ).φTerm(), Matchers.is(Phi.Φ.φTerm()) ); @@ -47,7 +47,7 @@ void convertsToOriginTerm() { @Test void copiesOrigin() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhLogged(Phi.Φ).copy(), Matchers.equalTo(Phi.Φ) ); @@ -56,7 +56,7 @@ void copiesOrigin() { @Test void returnsOriginHashCode() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhLogged(Phi.Φ).hashCode(), Matchers.equalTo(Phi.Φ.hashCode()) ); @@ -65,7 +65,7 @@ void returnsOriginHashCode() { @Test void equalsToOrigin() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhLogged(Phi.Φ), Matchers.equalTo(Phi.Φ) ); @@ -75,7 +75,7 @@ void equalsToOrigin() { void getsOriginLocator() { final Phi phi = Phi.Φ; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhLogged(phi).locator(), Matchers.equalTo(phi.locator()) ); @@ -85,7 +85,7 @@ void getsOriginLocator() { void convertsToString() { final Phi phi = Phi.Φ; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhLogged(phi).toString(), Matchers.equalTo(phi.toString()) ); diff --git a/eo-runtime/src/test/java/org/eolang/PhMethodTest.java b/eo-runtime/src/test/java/org/eolang/PhMethodTest.java index 03d9bbf412..80f0baf8b7 100644 --- a/eo-runtime/src/test/java/org/eolang/PhMethodTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhMethodTest.java @@ -38,7 +38,7 @@ final class PhMethodTest { void comparesTwoObjects() { final Phi num = new Data.ToPhi(1L); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, num.take("plus"), Matchers.not(Matchers.equalTo(num.take("plus"))) ); @@ -47,7 +47,7 @@ void comparesTwoObjects() { @Test void convertsSafeToString() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhMethod(Phi.Φ, "hello").toString(), Matchers.endsWith(".hello") ); @@ -62,7 +62,7 @@ void calculatesPhiJustOnce() { new Dataized(phi).take(); } MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, dummy.count, Matchers.equalTo(1) ); @@ -77,7 +77,7 @@ void calculatesLocalJustOnce() { new Dataized(phi).take(); } MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, dummy.count, Matchers.equalTo(1) ); @@ -89,7 +89,7 @@ void calculatesPhiOnce() { final Phi phi = new PhMethod(dummy, "neg"); new Dataized(phi).take(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, dummy.count, Matchers.equalTo(1) ); @@ -99,7 +99,7 @@ void calculatesPhiOnce() { void hasDifferentFormasWithOwnMethod() { final Phi dummy = new Dummy(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, dummy.forma(), Matchers.not( Matchers.equalTo( diff --git a/eo-runtime/src/test/java/org/eolang/PhNamedTest.java b/eo-runtime/src/test/java/org/eolang/PhNamedTest.java index ad13f9d6a6..26122576d1 100644 --- a/eo-runtime/src/test/java/org/eolang/PhNamedTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhNamedTest.java @@ -37,12 +37,12 @@ final class PhNamedTest { @Test void comparesTwoObjects() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhNamed(new Data.ToPhi(1L), ""), Matchers.not(Matchers.equalTo(new PhNamed(new Data.ToPhi(1L), ""))) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhNamed(new Data.ToPhi(1L), ""), Matchers.not(Matchers.equalTo(new PhNamed(new Data.ToPhi(42L), ""))) ); diff --git a/eo-runtime/src/test/java/org/eolang/PhPackageTest.java b/eo-runtime/src/test/java/org/eolang/PhPackageTest.java index 8cb596da76..f77f6b7423 100644 --- a/eo-runtime/src/test/java/org/eolang/PhPackageTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhPackageTest.java @@ -57,7 +57,7 @@ final class PhPackageTest { @Test void copiesObject() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, Phi.Φ.take("org").take("eolang").take("seq"), Matchers.not( Matchers.equalTo( @@ -72,7 +72,7 @@ void setsRhoToObject() { final Phi eolang = Phi.Φ.take("org").take("eolang"); final Phi seq = eolang.take("seq"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, seq.take(Attr.RHO), Matchers.equalTo(eolang) ); @@ -81,7 +81,7 @@ void setsRhoToObject() { @Test void findsLongClass() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, Phi.Φ.take("org") .take("eolang") .take("bytes$eq").copy(), @@ -95,7 +95,7 @@ void retrievesAttribute(final String attribute, final Class expected) { final Phi parent = new PhPackage(PhPackageTest.DEFAULT_PACKAGE); final Phi actual = parent.take(attribute); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, Matchers.instanceOf(expected) ); @@ -106,7 +106,7 @@ void throwsExceptionIfCantInstantiateObject() { Assertions.assertThrows( ExFailure.class, () -> new PhPackage(PhPackageTest.DEFAULT_PACKAGE).take("failed"), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -115,7 +115,7 @@ void doesNotCopies() { Assertions.assertThrows( ExFailure.class, () -> new PhPackage(PhPackageTest.DEFAULT_PACKAGE).copy(), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -124,14 +124,14 @@ void doesNotGetForma() { Assertions.assertThrows( ExFailure.class, () -> new PhPackage(PhPackageTest.DEFAULT_PACKAGE).forma(), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @Test void convertsToPhiTerm() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhPackage(PhPackageTest.DEFAULT_PACKAGE).φTerm(), Matchers.equalTo("Φ.org.eolang") ); @@ -140,7 +140,7 @@ void convertsToPhiTerm() { @Test void returnsLocator() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhPackage(PhPackageTest.DEFAULT_PACKAGE).locator(), Matchers.equalTo("?:?") ); @@ -149,7 +149,7 @@ void returnsLocator() { @Test void convertsToString() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhPackage(PhPackageTest.DEFAULT_PACKAGE).toString(), Matchers.equalTo("Φ.org.eolang") ); @@ -180,7 +180,7 @@ void findsAttributesConcurrently() throws InterruptedException { service.shutdown(); if (service.awaitTermination(1, TimeUnit.SECONDS)) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, basket.size(), Matchers.equalTo(threads) ); diff --git a/eo-runtime/src/test/java/org/eolang/PhWithTest.java b/eo-runtime/src/test/java/org/eolang/PhWithTest.java index af849b347e..9cf283fb94 100644 --- a/eo-runtime/src/test/java/org/eolang/PhWithTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhWithTest.java @@ -45,7 +45,7 @@ void comparesTwoObjects() { 0, new Data.ToPhi(1L) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, dummy, Matchers.equalTo(dummy) ); } @@ -53,7 +53,7 @@ void comparesTwoObjects() { @Test void takesMethod() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new Data.ToPhi("Hello, world!") ).take(String.class), @@ -65,7 +65,7 @@ void takesMethod() { void passesToSubObject() { final Phi dummy = new PhWithTest.Dummy(Phi.Φ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhWith( new PhCopy(new PhMethod(dummy, "plus")), @@ -80,7 +80,7 @@ void passesToSubObject() { void printsToString() { final Phi dummy = new PhWithTest.Dummy(Phi.Φ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhWith( new PhCopy(new PhMethod(dummy, "plus")), 0, new Data.ToPhi(1L) @@ -96,14 +96,14 @@ void runsInThreads(final String data) { final Phi ref = new PhWith(new DummyWithAtFree(attr, Phi.Φ), 0, new Data.ToPhi(data)); final Func actual = phi -> { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(phi.take(attr)).take(String.class), Matchers.is(data) ); return true; }; MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, actual, new RunsInThreads<>( ref, @@ -116,7 +116,7 @@ void runsInThreads(final String data) { void hasTheSameFormaWithBoundAttribute() { final Phi dummy = new DummyWithAtFree("x", Phi.Φ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, dummy.forma(), Matchers.equalTo( new PhWith(dummy, "x", new Data.ToPhi(5L)).forma() diff --git a/eo-runtime/src/test/java/org/eolang/PhiTest.java b/eo-runtime/src/test/java/org/eolang/PhiTest.java index fde23ef2f7..d03f886517 100644 --- a/eo-runtime/src/test/java/org/eolang/PhiTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhiTest.java @@ -37,7 +37,7 @@ final class PhiTest { @Test void takesPackage() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhCopy( new PhMethod( @@ -68,7 +68,7 @@ void takesPackage() { @Test void takesStandardPackage() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( new PhCopy( new PhMethod( @@ -87,7 +87,7 @@ void takesStandardPackage() { @Test void takesDirectly() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized( Phi.Φ.take("org").take("eolang").take("nan").take("gt") ).take(Boolean.class), @@ -98,7 +98,7 @@ void takesDirectly() { @Test void getsLocation() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new PhLocated( Phi.Φ, 123, diff --git a/eo-runtime/src/test/java/org/eolang/UniverseDefaultTest.java b/eo-runtime/src/test/java/org/eolang/UniverseDefaultTest.java index 8ceb9e1e15..b99a30353d 100644 --- a/eo-runtime/src/test/java/org/eolang/UniverseDefaultTest.java +++ b/eo-runtime/src/test/java/org/eolang/UniverseDefaultTest.java @@ -59,7 +59,7 @@ void findsSimpleAtt() { final Phi phi = new DummyWithAt(Phi.Φ); final UniverseDefault universe = new UniverseDefault(phi); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, universe.find( String.format("%s.%s.%s", "$", UniverseDefaultTest.ABSTRACT_ATT, Attr.RHO) ), @@ -74,7 +74,7 @@ void findsLongAtt() { final Phi phi = new DummyWithStructure(Phi.Φ); final UniverseDefault universe = new UniverseDefault(phi); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, universe.find( String.format( "$.%s.%s.%s.%s", @@ -96,7 +96,7 @@ void findsByAbsoluteLoc() { final UniverseDefault universe = new UniverseDefault(Phi.Φ, indexed); final int vertex = universe.find("Q.org.eolang.seq"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, indexed.get(vertex).getClass(), Matchers.equalTo(EOseq.class) ); @@ -109,7 +109,7 @@ void throwsIfWrongFind() { () -> new UniverseDefault( new DummyWithStructure(Phi.Φ) ).find("$.wrong-name"), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -122,7 +122,7 @@ void dataizesIndexed() { "$.".concat(UniverseDefaultTest.VALUE_ATT) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, universe.dataize(vertex), Matchers.equalTo(new BytesOf(1L).take()) ); @@ -135,7 +135,7 @@ void throwsIfWrongDataize() { () -> new UniverseDefault( new DummyWithStructure(Phi.Φ) ).dataize(-1), - "TO ADD ASSERTION MESSAGE" + AtCompositeTest.TO_ADD_MESSAGE ); } @@ -147,12 +147,12 @@ void copies() { final int origin = universe.find("$"); final int copy = universe.copy(origin); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, copy, Matchers.not(origin) ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, universe.dataize(copy), Matchers.equalTo( universe.dataize(origin) @@ -168,7 +168,7 @@ void putsToCopy() { final int copy = universe.copy(eobytes); universe.put(copy, UniverseDefaultTest.DATA); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(indexed.get(copy)).take(), Matchers.equalTo( UniverseDefaultTest.DATA @@ -188,7 +188,7 @@ void bindsCopyToAbstract() { dummy.hashCode(), copy, UniverseDefaultTest.ABSTRACT_ATT ); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Dataized(dummy.take(UniverseDefaultTest.ABSTRACT_ATT)).take(), Matchers.equalTo( UniverseDefaultTest.DATA diff --git a/eo-runtime/src/test/java/org/eolang/VerboseBytesAsStringTest.java b/eo-runtime/src/test/java/org/eolang/VerboseBytesAsStringTest.java index f47a5263de..825931e6d1 100644 --- a/eo-runtime/src/test/java/org/eolang/VerboseBytesAsStringTest.java +++ b/eo-runtime/src/test/java/org/eolang/VerboseBytesAsStringTest.java @@ -41,7 +41,7 @@ public final class VerboseBytesAsStringTest { @MethodSource("getTestSources") void representsString(final Object object) { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new VerboseBytesAsString(VerboseBytesAsStringTest.toBytes(object)).get(), Matchers.containsString( new VerboseBytesAsStringTest.ArgumentsUtils().toString(object) diff --git a/eo-runtime/src/test/java/org/eolang/VerticesTest.java b/eo-runtime/src/test/java/org/eolang/VerticesTest.java index 3e39e623ce..53db979a4c 100644 --- a/eo-runtime/src/test/java/org/eolang/VerticesTest.java +++ b/eo-runtime/src/test/java/org/eolang/VerticesTest.java @@ -45,7 +45,7 @@ final class VerticesTest { @Test void makesNext() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, new Vertices().next(), Matchers.greaterThan(0) ); @@ -68,7 +68,7 @@ void performsVtxOperationsConcurrently() { ); new Threads<>(threads, tasks).forEach(hashes::add); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + AtCompositeTest.TO_ADD_MESSAGE, hashes.size(), Matchers.equalTo(threads) ); From 4c24b95c740c2fa71eb1d5af3876d65709f270e4 Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:09:33 +0300 Subject: [PATCH 09/11] #2297 resolve empty message duplication for eo-parser --- .../org/eolang/maven/BinarizeParseTest.java | 2 +- .../org/eolang/parser/EoIndentLexerTest.java | 10 +++++-- .../java/org/eolang/parser/EoSyntaxTest.java | 26 ++++++++----------- .../java/org/eolang/parser/ObjectsTest.java | 6 ++--- .../java/org/eolang/parser/StUnhexTest.java | 18 +++++-------- .../java/org/eolang/parser/StXPathTest.java | 2 +- .../test/java/org/eolang/AtCompositeTest.java | 3 +-- 7 files changed, 32 insertions(+), 35 deletions(-) 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 64bcd49190..b5911b15fd 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 @@ -54,7 +54,7 @@ public final class BinarizeParseTest { /** - * Empty message for JUnit Assertions. To be removed. + * Empty message for JUnit Assertions. */ public static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; diff --git a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java index 33af185e43..8fad3b83ab 100644 --- a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java @@ -33,12 +33,18 @@ * Test for {@link EoIndentLexer}. * * @since 1.0 + * + * @todo #2297:60m Replace all appearances of {@link EoIndentLexerTest#TO_ADD_MESSAGE} field in + * eo-parser with meaningful assert messages. Don't forget to remove + * {@link EoIndentLexerTest#TO_ADD_MESSAGE} field and remove public modifier from this class if no + * longer need. */ -final class EoIndentLexerTest { +@SuppressWarnings("PMD.JUnit5TestShouldBePackagePrivate") +public final class EoIndentLexerTest { /** * Empty message for JUnit Assertions. */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; + public static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @Test void emitsTab() throws IOException { diff --git a/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java b/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java index d24fa0eb84..6686cba704 100644 --- a/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java @@ -50,15 +50,11 @@ */ @SuppressWarnings("PMD.TooManyMethods") final class EoSyntaxTest { - /** - * Empty message for JUnit Assertions. - */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @Test void parsesSimpleCode() throws Exception { MatcherAssert.assertThat( - EoSyntaxTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, XhtmlMatchers.xhtml( new String( new EoSyntax( @@ -92,7 +88,7 @@ void containsCommentCheckErrors( final String message ) throws IOException { MatcherAssert.assertThat( - EoSyntaxTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, XhtmlMatchers.xhtml( new String( new EoSyntax( @@ -125,7 +121,7 @@ void printsProperListingEvenWhenSyntaxIsBroken() throws Exception { "[] > x-н, 1\n" ); MatcherAssert.assertThat( - EoSyntaxTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, XhtmlMatchers.xhtml( new String( new EoSyntax( @@ -157,7 +153,7 @@ void copiesListingCorrectly() throws Exception { ) ); MatcherAssert.assertThat( - EoSyntaxTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, xml.xpath("/program/listing/text()"), Matchers.contains(src) ); @@ -181,14 +177,14 @@ void parsesSuccessfully(final String code) { ); Assertions.assertDoesNotThrow( syntax::parsed, - EoSyntaxTest.TO_ADD_MESSAGE + EoIndentLexerTest.TO_ADD_MESSAGE ); } @Test void parsesArrow() throws IOException { MatcherAssert.assertThat( - EoSyntaxTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, new EoSyntax( "test-it-3", new InputOf("1 > x") @@ -212,7 +208,7 @@ void prasesNested() throws IOException { " v\n" ); MatcherAssert.assertThat( - EoSyntaxTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, new EoSyntax( "test-it-4", new InputOf(src) @@ -227,7 +223,7 @@ void prasesNested() throws IOException { @Test void parsesDefinition() throws IOException { MatcherAssert.assertThat( - EoSyntaxTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, new EoSyntax( "test-it-5", new InputOf( @@ -249,7 +245,7 @@ void parsesDefinition() throws IOException { @Test void parsesMethodCalls() throws IOException { MatcherAssert.assertThat( - EoSyntaxTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, new EoSyntax( "test-it-1", new InputOf("add.\n 0\n true") @@ -279,7 +275,7 @@ void storesAsBytes(final String code) throws IOException { ) ); MatcherAssert.assertThat( - EoSyntaxTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, xml, XhtmlMatchers.hasXPaths( "/program/objects[count(o)=1]", @@ -299,7 +295,7 @@ void checksTypoPacks(final String yml) throws IOException { new InputOf(String.format("%s\n", map.get("eo"))) ).parsed(); MatcherAssert.assertThat( - EoSyntaxTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, XhtmlMatchers.xhtml(xml.toString()), XhtmlMatchers.hasXPaths("/program/errors/error/@line") ); diff --git a/eo-parser/src/test/java/org/eolang/parser/ObjectsTest.java b/eo-parser/src/test/java/org/eolang/parser/ObjectsTest.java index 394e26b081..fcdd48cbd9 100644 --- a/eo-parser/src/test/java/org/eolang/parser/ObjectsTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/ObjectsTest.java @@ -43,7 +43,7 @@ void parsesOneObject() { objs.data("xxx"); objs.leave(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + EoIndentLexerTest.TO_ADD_MESSAGE, new XMLDocument(new Xembler(objs).domQuietly()), XhtmlMatchers.hasXPaths( "/o", @@ -65,7 +65,7 @@ void parsesNestedObjects() { objs.leave(); objs.leave(); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + EoIndentLexerTest.TO_ADD_MESSAGE, new XMLDocument(new Xembler(objs).domQuietly()), XhtmlMatchers.hasXPaths( "/o", @@ -84,7 +84,7 @@ void parsesObjectsWithEnteringPrevious() { objs.enter(); objs.prop("z", "a"); MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + EoIndentLexerTest.TO_ADD_MESSAGE, new XMLDocument(new Xembler(objs).domQuietly()), XhtmlMatchers.hasXPaths( "/o/o", diff --git a/eo-parser/src/test/java/org/eolang/parser/StUnhexTest.java b/eo-parser/src/test/java/org/eolang/parser/StUnhexTest.java index f72e06dc1a..73505acb2d 100644 --- a/eo-parser/src/test/java/org/eolang/parser/StUnhexTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/StUnhexTest.java @@ -35,15 +35,11 @@ * @since 0.29.0 */ final class StUnhexTest { - /** - * Empty message for JUnit Assertions. - */ - private static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @Test void convertsIntFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( "

01 02 E4 F3 04 67 32 E1

" @@ -56,7 +52,7 @@ void convertsIntFromHexToEo() { @Test void convertsMaxIntFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( "

FF FF FF FF FF FF FF FF

" @@ -69,7 +65,7 @@ void convertsMaxIntFromHexToEo() { @Test void convertsStringFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( String.join( @@ -89,7 +85,7 @@ void convertsStringFromHexToEo() { @Test void convertsEmptyStringFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( "

" @@ -104,7 +100,7 @@ void convertsEmptyStringFromHexToEo() { @Test void convertsFloatFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( "

41 42 43 67 AE CD 3E FD

" @@ -119,7 +115,7 @@ void convertsFloatFromHexToEo() { @Test void convertsTrueFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( String.join( @@ -139,7 +135,7 @@ void convertsTrueFromHexToEo() { @Test void convertsFalseFromHexToEo() { MatcherAssert.assertThat( - StUnhexTest.TO_ADD_MESSAGE, + EoIndentLexerTest.TO_ADD_MESSAGE, new Xsline(new StUnhex()).pass( new XMLDocument( "

00

" diff --git a/eo-parser/src/test/java/org/eolang/parser/StXPathTest.java b/eo-parser/src/test/java/org/eolang/parser/StXPathTest.java index c0920cb5a6..9509a74e5e 100644 --- a/eo-parser/src/test/java/org/eolang/parser/StXPathTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/StXPathTest.java @@ -41,7 +41,7 @@ final class StXPathTest { @Test void modifiesSimpleNode() { MatcherAssert.assertThat( - "TO ADD ASSERTION MESSAGE", + EoIndentLexerTest.TO_ADD_MESSAGE, new Xsline( new StEndless( new StXPath( diff --git a/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java b/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java index 7c2ffafcb3..edf376ab1f 100644 --- a/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java +++ b/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java @@ -34,7 +34,6 @@ * * @since 0.16 * - * * @todo #2297:60m Replace all appearances of {@link AtCompositeTest#TO_ADD_MESSAGE} field in * eo-runtime with meaningful assert messages. Don't forget to remove * {@link AtCompositeTest#TO_ADD_MESSAGE} field and remove public modifier from this class if no @@ -45,7 +44,7 @@ public final class AtCompositeTest { /** * Empty message for JUnit Assertions. To be removed. */ - public static final String TO_ADD_MESSAGE = AtCompositeTest.TO_ADD_MESSAGE; + public static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; @Test void decoratesCheckedException() { From 9008a41cea6b438a95c9e827a8608a66b31f3632 Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:17:01 +0300 Subject: [PATCH 10/11] #2297 fix todo --- .../test/java/org/eolang/maven/BinarizeParseTest.java | 5 ++++- .../test/java/org/eolang/parser/EoIndentLexerTest.java | 5 ++++- .../src/test/java/org/eolang/AtCompositeTest.java | 10 ++++------ 3 files changed, 12 insertions(+), 8 deletions(-) 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 b5911b15fd..4a2e74a30d 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 @@ -54,7 +54,10 @@ public final class BinarizeParseTest { /** - * Empty message for JUnit Assertions. + * @todo #2297:60m Replace all appearances of {@link BinarizeParseTest#TO_ADD_MESSAGE} field in + * eo-maven-plugin 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. */ public static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; diff --git a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java index 8fad3b83ab..379435e861 100644 --- a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java @@ -42,7 +42,10 @@ @SuppressWarnings("PMD.JUnit5TestShouldBePackagePrivate") public final class EoIndentLexerTest { /** - * Empty message for JUnit Assertions. + * @todo #2297:60m Replace all appearances of {@link EoIndentLexerTest#TO_ADD_MESSAGE} field in + * eo-parser with meaningful assert messages. Don't forget to remove + * {@link EoIndentLexerTest#TO_ADD_MESSAGE} field and remove public modifier from this class if no + * longer need. */ public static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; diff --git a/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java b/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java index edf376ab1f..97793a4120 100644 --- a/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java +++ b/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java @@ -33,16 +33,14 @@ * Test case for {@link AtComposite}. * * @since 0.16 - * - * @todo #2297:60m Replace all appearances of {@link AtCompositeTest#TO_ADD_MESSAGE} field in - * eo-runtime with meaningful assert messages. Don't forget to remove - * {@link AtCompositeTest#TO_ADD_MESSAGE} field and remove public modifier from this class if no - * longer need. */ public final class AtCompositeTest { /** - * Empty message for JUnit Assertions. To be removed. + * @todo #2297:60m Replace all appearances of {@link AtCompositeTest#TO_ADD_MESSAGE} field in + * eo-runtime with meaningful assert messages. Don't forget to remove + * {@link AtCompositeTest#TO_ADD_MESSAGE} field and remove public modifier from this class if + * no longer need. */ public static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; From b477065d2587767e910a3156177152d6dca512ab Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:26:02 +0300 Subject: [PATCH 11/11] #2297 fix checkstyle and todo --- .../test/java/org/eolang/maven/BinarizeParseTest.java | 7 ++----- .../java/org/eolang/parser/EoIndentLexerTest.java | 11 ++++------- .../src/test/java/org/eolang/AtCompositeTest.java | 2 ++ 3 files changed, 8 insertions(+), 12 deletions(-) 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 4a2e74a30d..cabac1dc77 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,17 +43,14 @@ * Test case for {@link BinarizeParse}. * * @since 0.1 - * - * @todo #2297:60m Replace all appearances of {@link BinarizeParseTest#TO_ADD_MESSAGE} field in - * eo-maven-plugin 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) public final class BinarizeParseTest { /** + * Empty message for JUnit Assertions. + * * @todo #2297:60m Replace all appearances of {@link BinarizeParseTest#TO_ADD_MESSAGE} field in * eo-maven-plugin with meaningful assert messages. Don't forget to remove * {@link BinarizeParseTest#TO_ADD_MESSAGE} field and remove public modifier from this class if diff --git a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java index 379435e861..acb5dc7405 100644 --- a/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/EoIndentLexerTest.java @@ -33,19 +33,16 @@ * Test for {@link EoIndentLexer}. * * @since 1.0 - * - * @todo #2297:60m Replace all appearances of {@link EoIndentLexerTest#TO_ADD_MESSAGE} field in - * eo-parser with meaningful assert messages. Don't forget to remove - * {@link EoIndentLexerTest#TO_ADD_MESSAGE} field and remove public modifier from this class if no - * longer need. */ @SuppressWarnings("PMD.JUnit5TestShouldBePackagePrivate") public final class EoIndentLexerTest { /** + * Empty message for JUnit Assertions. + * * @todo #2297:60m Replace all appearances of {@link EoIndentLexerTest#TO_ADD_MESSAGE} field in * eo-parser with meaningful assert messages. Don't forget to remove - * {@link EoIndentLexerTest#TO_ADD_MESSAGE} field and remove public modifier from this class if no - * longer need. + * {@link EoIndentLexerTest#TO_ADD_MESSAGE} field and remove public modifier from this class if + * no longer need. */ public static final String TO_ADD_MESSAGE = "TO ADD ASSERTION MESSAGE"; diff --git a/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java b/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java index 97793a4120..df6df237b4 100644 --- a/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java +++ b/eo-runtime/src/test/java/org/eolang/AtCompositeTest.java @@ -37,6 +37,8 @@ public final class AtCompositeTest { /** + * Empty message for JUnit Assertions. + * * @todo #2297:60m Replace all appearances of {@link AtCompositeTest#TO_ADD_MESSAGE} field in * eo-runtime with meaningful assert messages. Don't forget to remove * {@link AtCompositeTest#TO_ADD_MESSAGE} field and remove public modifier from this class if