Skip to content

Commit

Permalink
(#829) Fix PR issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pbenety committed May 22, 2018
1 parent 0284285 commit 688d6d5
Showing 1 changed file with 76 additions and 5 deletions.
81 changes: 76 additions & 5 deletions src/test/java/org/cactoos/scalar/AndInThreadsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,25 @@
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;

/**
* 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.
* Create a class similar to `SyncCollection` but mutable.
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
Expand Down Expand Up @@ -112,7 +118,20 @@ public void iteratesList() {
);
MatcherAssert.assertThat(
list,
Matchers.containsInAnyOrder("hello", "world")
new IsIterableContainingInAnyOrder<String>(
new CollectionOf<Matcher<? super String>>(
new MatcherOf<>(
text -> {
return "hello".equals(text);
}
),
new MatcherOf<>(
text -> {
return "world".equals(text);
}
)
)
)
);
}

Expand Down Expand Up @@ -152,7 +171,20 @@ public void worksWithProc() throws Exception {
).value();
MatcherAssert.assertThat(
list,
Matchers.contains(1, 1)
new IsIterableContainingInAnyOrder<Integer>(
new CollectionOf<Matcher<? super Integer>>(
new MatcherOf<>(
value -> {
return value.equals(1);
}
),
new MatcherOf<>(
value -> {
return value.equals(1);
}
)
)
)
);
}

Expand All @@ -178,7 +210,20 @@ public void worksWithProcIterable() throws Exception {
).value();
MatcherAssert.assertThat(
list,
Matchers.containsInAnyOrder(1, 2)
new IsIterableContainingInAnyOrder<Integer>(
new CollectionOf<Matcher<? super Integer>>(
new MatcherOf<>(
value -> {
return value.equals(1);
}
),
new MatcherOf<>(
value -> {
return value.equals(2);
}
)
)
)
);
}

Expand Down Expand Up @@ -208,7 +253,20 @@ public void worksWithExecServiceProcValues() throws Exception {
).value();
MatcherAssert.assertThat(
list,
Matchers.containsInAnyOrder(1, 2)
new IsIterableContainingInAnyOrder<Integer>(
new CollectionOf<Matcher<? super Integer>>(
new MatcherOf<>(
value -> {
return value.equals(1);
}
),
new MatcherOf<>(
value -> {
return value.equals(2);
}
)
)
)
);
}

Expand All @@ -225,7 +283,20 @@ public void worksWithExecServiceProcIterable() throws Exception {
).value();
MatcherAssert.assertThat(
list,
Matchers.containsInAnyOrder(1, 2)
new IsIterableContainingInAnyOrder<Integer>(
new CollectionOf<Matcher<? super Integer>>(
new MatcherOf<>(
value -> {
return value.equals(1);
}
),
new MatcherOf<>(
value -> {
return value.equals(2);
}
)
)
)
);
}

Expand Down

0 comments on commit 688d6d5

Please sign in to comment.