Skip to content

Commit

Permalink
#3132: change info messages in CagesTest, EOas_phiTest, EObytesEOconc…
Browse files Browse the repository at this point in the history
…atTest & EOcageTest
  • Loading branch information
ZacParize committed May 19, 2024
1 parent 2d4694b commit 46f18b2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 25 deletions.
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.FAILED_ASSERT_MESSAGE_SUPPLIER.get()
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get()
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get()
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get()
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get()
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get()
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get()
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get()
"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.FAILED_ASSERT_MESSAGE_SUPPLIER.get(),
"Dataizes concurrent threads failed",
new SumOf(
new Threads<>(
threads,
Expand Down

0 comments on commit 46f18b2

Please sign in to comment.