Skip to content

Commit

Permalink
#2297 resolve empty message duplication for eo-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
c71n93 committed Apr 19, 2024
1 parent 7e465e1 commit e89c483
Show file tree
Hide file tree
Showing 44 changed files with 248 additions and 216 deletions.
Expand Up @@ -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.
*/
Expand Down
13 changes: 7 additions & 6 deletions eo-runtime/src/test/java/EOorg/EOeolang/CagesTest.java
Expand Up @@ -27,6 +27,7 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.ExFailure;
import org.eolang.PhFake;
Expand All @@ -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
);
}

Expand All @@ -57,7 +58,7 @@ void rencagesTheSameObject() {
Cages.INSTANCE.init(phi);
Assertions.assertDoesNotThrow(
() -> Cages.INSTANCE.init(phi),
"TO ADD ASSERTION MESSAGE"
AtCompositeTest.TO_ADD_MESSAGE
);
}

Expand All @@ -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())
);
Expand All @@ -80,7 +81,7 @@ void failsToEncageObjectIfIsWasInitialized() {
Assertions.assertThrows(
ExFailure.class,
() -> Cages.INSTANCE.encage(phi.hashCode(), phi),
"TO ADD ASSERTION MESSAGE"
AtCompositeTest.TO_ADD_MESSAGE
);
}

Expand All @@ -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
);
}

Expand All @@ -99,7 +100,7 @@ void failsToGetObjectIfWasNotInitialized() {
Assertions.assertThrows(
ExFailure.class,
() -> Cages.INSTANCE.get(new PhFake().hashCode()),
"TO ADD ASSERTION MESSAGE"
AtCompositeTest.TO_ADD_MESSAGE
);
}
}
3 changes: 2 additions & 1 deletion eo-runtime/src/test/java/EOorg/EOeolang/EOas_phiTest.java
Expand Up @@ -27,6 +27,7 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.Dataized;
import org.eolang.PhWith;
Expand All @@ -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.),
Expand Down
Expand Up @@ -27,6 +27,7 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.Dataized;
import org.eolang.PhMethod;
Expand Down Expand Up @@ -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. 銊ゃ劆!")
);
Expand Down
23 changes: 12 additions & 11 deletions eo-runtime/src/test/java/EOorg/EOeolang/EOcageTest.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
);
Expand All @@ -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)
);
Expand All @@ -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)
);
Expand All @@ -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)
);
Expand All @@ -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)
);
Expand All @@ -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)
);
Expand All @@ -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
);
}

Expand All @@ -156,7 +157,7 @@ void doesNotWriteBoundedMethod() {
Assertions.assertThrows(
EOerror.ExError.class,
() -> EOcageTest.encageTo(cage, ten),
"TO ADD ASSERTION MESSAGE"
AtCompositeTest.TO_ADD_MESSAGE
);
}

Expand All @@ -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
);
}

Expand Down Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions eo-runtime/src/test/java/EOorg/EOeolang/EOerrorTest.java
Expand Up @@ -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;
Expand Down Expand Up @@ -63,7 +64,7 @@ void makesToxicObject() {
new Data.ToPhi("intentional error")
)
).take(),
"TO ADD ASSERTION MESSAGE"
AtCompositeTest.TO_ADD_MESSAGE
);
}

Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion eo-runtime/src/test/java/EOorg/EOeolang/EOintEOeqTest.java
Expand Up @@ -31,6 +31,7 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.Dataized;
import org.eolang.PhWith;
Expand Down Expand Up @@ -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)
);
Expand Down
3 changes: 2 additions & 1 deletion eo-runtime/src/test/java/EOorg/EOeolang/EOintEOltTest.java
Expand Up @@ -27,6 +27,7 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.Dataized;
import org.eolang.Phi;
Expand All @@ -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)
);
Expand Down
Expand Up @@ -27,6 +27,7 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.Dataized;
import org.eolang.PhMethod;
Expand Down Expand Up @@ -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)
);
Expand Down
3 changes: 2 additions & 1 deletion eo-runtime/src/test/java/EOorg/EOeolang/EOintEOnegTest.java
Expand Up @@ -27,6 +27,7 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.Dataized;
import org.eolang.PhMethod;
Expand All @@ -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)
);
Expand Down
3 changes: 2 additions & 1 deletion eo-runtime/src/test/java/EOorg/EOeolang/EOintEOplusTest.java
Expand Up @@ -27,6 +27,7 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.Dataized;
import org.eolang.Phi;
Expand All @@ -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)
);
Expand Down
7 changes: 4 additions & 3 deletions eo-runtime/src/test/java/EOorg/EOeolang/EOintTest.java
Expand Up @@ -27,6 +27,7 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.Phi;
import org.hamcrest.MatcherAssert;
Expand All @@ -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()))
);
Expand All @@ -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)
);
Expand All @@ -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())
);
Expand Down

0 comments on commit e89c483

Please sign in to comment.