diff --git a/src/test/java/org/cactoos/scalar/AndInThreadsTest.java b/src/test/java/org/cactoos/scalar/AndInThreadsTest.java index 08ae5a4fa9..e334f0077b 100644 --- a/src/test/java/org/cactoos/scalar/AndInThreadsTest.java +++ b/src/test/java/org/cactoos/scalar/AndInThreadsTest.java @@ -30,12 +30,15 @@ import java.util.concurrent.Executors; import org.cactoos.Proc; import org.cactoos.Scalar; +import org.cactoos.collection.CollectionOf; import org.cactoos.func.FuncOf; import org.cactoos.iterable.IterableOf; import org.cactoos.iterable.Mapped; import org.cactoos.list.ListOf; +import org.hamcrest.Matcher; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; +import org.hamcrest.collection.IsIterableContainingInAnyOrder; import org.junit.Test; import org.llorllale.cactoos.matchers.MatcherOf; import org.llorllale.cactoos.matchers.ScalarHasValue; @@ -43,6 +46,8 @@ /** * Test case for {@link AndInThreads}. * @since 0.25 + * @todo #829:30min Remove the use of the static method + * `Collections.synchronizedList`. Replace by an object-oriented approach. * @checkstyle JavadocMethodCheck (500 lines) * @checkstyle ClassDataAbstractionCouplingCheck (500 lines) */ @@ -112,7 +117,20 @@ public void iteratesList() { ); MatcherAssert.assertThat( list, - Matchers.containsInAnyOrder("hello", "world") + new IsIterableContainingInAnyOrder( + new CollectionOf>( + new MatcherOf<>( + text -> { + return "hello".equals(text); + } + ), + new MatcherOf<>( + text -> { + return "world".equals(text); + } + ) + ) + ) ); } @@ -152,7 +170,20 @@ public void worksWithProc() throws Exception { ).value(); MatcherAssert.assertThat( list, - Matchers.contains(1, 1) + new IsIterableContainingInAnyOrder( + new CollectionOf>( + new MatcherOf<>( + value -> { + return value.equals(1); + } + ), + new MatcherOf<>( + value -> { + return value.equals(1); + } + ) + ) + ) ); } @@ -178,7 +209,20 @@ public void worksWithProcIterable() throws Exception { ).value(); MatcherAssert.assertThat( list, - Matchers.containsInAnyOrder(1, 2) + new IsIterableContainingInAnyOrder( + new CollectionOf>( + new MatcherOf<>( + value -> { + return value.equals(1); + } + ), + new MatcherOf<>( + value -> { + return value.equals(2); + } + ) + ) + ) ); } @@ -208,7 +252,20 @@ public void worksWithExecServiceProcValues() throws Exception { ).value(); MatcherAssert.assertThat( list, - Matchers.containsInAnyOrder(1, 2) + new IsIterableContainingInAnyOrder( + new CollectionOf>( + new MatcherOf<>( + value -> { + return value.equals(1); + } + ), + new MatcherOf<>( + value -> { + return value.equals(2); + } + ) + ) + ) ); } @@ -225,7 +282,20 @@ public void worksWithExecServiceProcIterable() throws Exception { ).value(); MatcherAssert.assertThat( list, - Matchers.containsInAnyOrder(1, 2) + new IsIterableContainingInAnyOrder( + new CollectionOf>( + new MatcherOf<>( + value -> { + return value.equals(1); + } + ), + new MatcherOf<>( + value -> { + return value.equals(2); + } + ) + ) + ) ); }