Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task #3132: Removing AtCompositeTest.TO_ADD_MESSAGE #3187

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions eo-runtime/src/test/java/EOorg/EOeolang/CagesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.ExFailure;
import org.eolang.PhFake;
Expand All @@ -48,7 +47,7 @@ void initializesObjectForTheFirstTime() {
final int locator = Cages.INSTANCE.init(phi);
Assertions.assertDoesNotThrow(
() -> Cages.INSTANCE.get(locator),
AtCompositeTest.TO_ADD_MESSAGE
"We expect the first time initialization will be done"
);
}

Expand All @@ -58,7 +57,7 @@ void rencagesTheSameObject() {
Cages.INSTANCE.init(phi);
Assertions.assertDoesNotThrow(
() -> Cages.INSTANCE.init(phi),
AtCompositeTest.TO_ADD_MESSAGE
"We expect the reinitialization will be done"
);
}

Expand All @@ -69,7 +68,7 @@ void encagesObjectWithLocator() {
final int locator = Cages.INSTANCE.init(first);
Cages.INSTANCE.encage(locator, second);
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
"We expect the encage with locator will be done",
Cages.INSTANCE.get(locator).hashCode(),
Matchers.equalTo(second.hashCode())
);
Expand All @@ -81,17 +80,17 @@ void failsToEncageObjectIfIsWasInitialized() {
Assertions.assertThrows(
ExFailure.class,
() -> Cages.INSTANCE.encage(phi.hashCode(), phi),
AtCompositeTest.TO_ADD_MESSAGE
"We expect the encage when object was initialized will be done"
);
}

@Test
void failsToEncageObjectOfDifferentForma() {
void failsToEncageObjectOfDifferentFormat() {
final int locator = Cages.INSTANCE.init(new PhFake());
Assertions.assertThrows(
ExFailure.class,
() -> Cages.INSTANCE.encage(locator, new Data.ToPhi(5L)),
AtCompositeTest.TO_ADD_MESSAGE
"We expect the encage with object of different format will be done"
);
}

Expand All @@ -100,7 +99,7 @@ void failsToGetObjectIfWasNotInitialized() {
Assertions.assertThrows(
ExFailure.class,
() -> Cages.INSTANCE.get(new PhFake().hashCode()),
AtCompositeTest.TO_ADD_MESSAGE
"We expect that getting of not initialization object will be done"
);
}
}
4 changes: 1 addition & 3 deletions eo-runtime/src/test/java/EOorg/EOeolang/EOas_phiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.Dataized;
import org.eolang.PhWith;
import org.eolang.Phi;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
Expand All @@ -47,7 +45,7 @@ final class EOas_phiTest {
@Test
void printsAndReturns() {
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
"We expect that print will be done",
new Dataized(
new PhWith(
new EOas_phi(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
*/
package EOorg.EOeolang;

import org.eolang.AtCompositeTest;
import org.eolang.Data;
import org.eolang.Dataized;
import org.eolang.PhMethod;
Expand Down Expand Up @@ -58,7 +57,7 @@ void concatenatesBytes() {
"as-string"
);
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
"We expect the bytes concat will be done",
new Dataized(phi).take(String.class),
Matchers.equalTo("привет mr. ㄤㄠ!")
);
Expand Down
23 changes: 11 additions & 12 deletions eo-runtime/src/test/java/EOorg/EOeolang/EOcageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
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 @@ -64,7 +63,7 @@ final class EOcageTest {
void encagesViaApplication() {
final Phi cage = EOcageTest.encaged(new Data.ToPhi(1L));
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
"We expect the encage via application will be done",
new Dataized(cage).take(Long.class),
Matchers.equalTo(1L)
);
Expand All @@ -75,7 +74,7 @@ void encagesAndFrees() {
final Phi cage = EOcageTest.encaged(new Data.ToPhi(1L));
EOcageTest.encageTo(cage, new Data.ToPhi(2L));
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
"We expect the encage and free afterwards will be done",
new Dataized(cage).take(Long.class),
Matchers.equalTo(2L)
);
Expand All @@ -90,7 +89,7 @@ void overwritesCagedObject() {
)
);
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
"We expect the encage will be done",
new Dataized(new PhMethod(cage, "x")).take(Long.class),
Matchers.equalTo(1L)
);
Expand All @@ -102,7 +101,7 @@ void overwritesCagedObject() {
)
);
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
"We expect the overwrite of object will be done",
new Dataized(new PhMethod(cage, "x")).take(Long.class),
Matchers.equalTo(2L)
);
Expand All @@ -114,7 +113,7 @@ void encagesObjectOnCopy() {
final Phi second = first.copy();
EOcageTest.encageTo(second, new Data.ToPhi(2L));
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
"We expect the encage of object for copying will be done",
new Dataized(first).take(Long.class),
Matchers.equalTo(2L)
);
Expand All @@ -124,13 +123,13 @@ void encagesObjectOnCopy() {
void writesAndRewritesPrimitive() {
final Phi cage = EOcageTest.encaged(new Data.ToPhi(1L));
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
"We expect the writing of primitive will be done",
new Dataized(cage).take(Long.class),
Matchers.equalTo(1L)
);
EOcageTest.encageTo(cage, new Data.ToPhi(5L));
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
"We expect the rewriting of primitive will be done",
new Dataized(cage).take(Long.class),
Matchers.equalTo(5L)
);
Expand All @@ -142,7 +141,7 @@ void doesNotWritePrimitivesFormedDifferently() {
Assertions.assertThrows(
EOerror.ExError.class,
() -> EOcageTest.encageTo(cage, new Data.ToPhi("Hello world")),
AtCompositeTest.TO_ADD_MESSAGE
"We expect the writing of formed differently primitive will be done"
);
}

Expand All @@ -158,7 +157,7 @@ void doesNotWriteBoundedMethod() {
Assertions.assertThrows(
EOerror.ExError.class,
() -> EOcageTest.encageTo(cage, ten),
AtCompositeTest.TO_ADD_MESSAGE
"We expect the writing of bounded method will be done"
);
}

Expand All @@ -170,7 +169,7 @@ void writesBoundedCopyOfTheSameBase() {
EOcageTest.encaged(dummy),
new PhWith(new PhCopy(dummy), "x", new Data.ToPhi("Hello world"))
),
AtCompositeTest.TO_ADD_MESSAGE
"We expect the writing of bounded copy of different base will be done"
);
}

Expand Down Expand Up @@ -230,7 +229,7 @@ void doesNotThrowIfDataizesConcurrently() {
);
final int threads = 500;
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
"Dataizes concurrent threads failed",
ZacParize marked this conversation as resolved.
Show resolved Hide resolved
new SumOf(
new Threads<>(
threads,
Expand Down
4 changes: 2 additions & 2 deletions eo-runtime/src/test/java/EOorg/EOeolang/EOerrorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void makesToxicObject() {
new Data.ToPhi("intentional error")
)
).take(),
AtCompositeTest.TO_ADD_MESSAGE
AtCompositeTest.FAILED_ASSERT_MESSAGE_SUPPLIER.get()
);
}

Expand All @@ -79,7 +79,7 @@ void getsReadableError(final Object cnst) {
}
assert error != null;
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
AtCompositeTest.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
error.toString(),
Matchers.containsString(
new VerboseBytesAsStringTest.ArgumentsUtils().toString(cnst)
Expand Down
2 changes: 1 addition & 1 deletion eo-runtime/src/test/java/EOorg/EOeolang/EOintEOeqTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void comparesWithAnotherNumber() {
0, right
);
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
AtCompositeTest.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
new Dataized(eql).take(Boolean.class),
Matchers.equalTo(false)
);
Expand Down
2 changes: 1 addition & 1 deletion eo-runtime/src/test/java/EOorg/EOeolang/EOintEOltTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void comparesWithAnotherNumber() {
final Phi less = left.take("lt");
less.put(0, right);
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
AtCompositeTest.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
new Dataized(less).take(Boolean.class),
Matchers.equalTo(false)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void subtractsNumber() {
0, right
);
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
AtCompositeTest.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
new Dataized(sub).take(Long.class),
Matchers.equalTo(29L)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void negatesNumber() {
final Phi left = new Data.ToPhi(42L);
final Phi neg = new PhMethod(left, "neg");
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
AtCompositeTest.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
new Dataized(neg).take(Long.class),
Matchers.equalTo(-42L)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void addsNumbers() {
final Phi add = left.take("plus");
add.put(0, right);
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
AtCompositeTest.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
new Dataized(add).take(Long.class),
Matchers.equalTo(55L)
);
Expand Down
6 changes: 3 additions & 3 deletions eo-runtime/src/test/java/EOorg/EOeolang/EOintTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void hasDifferentHashes() {
final Phi left = new Data.ToPhi(42L);
final Phi right = new Data.ToPhi(42L);
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
AtCompositeTest.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
left.hashCode(),
Matchers.not(Matchers.equalTo(right.hashCode()))
);
Expand All @@ -58,7 +58,7 @@ void hasDifferentHashes() {
void hasHashEvenWithoutData() {
final Phi phi = new EOint();
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
AtCompositeTest.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
phi.hashCode(),
Matchers.greaterThan(0)
);
Expand All @@ -69,7 +69,7 @@ void hasDifferentHash() {
final Phi raw = new EOint();
final Phi initialized = new Data.ToPhi(0L);
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
AtCompositeTest.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
raw.hashCode(),
Matchers.not(initialized.hashCode())
);
Expand Down
Loading
Loading