use of org.cactoos.list.Synced in project cactoos by yegor256.
the class AndInThreadsTest method worksWithExecServiceProcIterable.
@Test
void worksWithExecServiceProcIterable() throws Exception {
final List<Integer> list = new Synced<>(new ListOf<>());
final ExecutorService service = Executors.newSingleThreadExecutor();
new AndInThreads(service, new ProcNoNulls<Integer>(list::add), new ListOf<>(1, 2)).value();
MatcherAssert.assertThat(list, new IsIterableContainingInAnyOrder<>(new ListOf<>(new IsEqual<>(1), new IsEqual<>(2))));
}
use of org.cactoos.list.Synced in project cactoos by yegor256.
the class AndInThreadsTest method worksWithExecServiceProcValues.
@Test
void worksWithExecServiceProcValues() throws Exception {
final List<Integer> list = new Synced<>(new ListOf<>());
final ExecutorService service = Executors.newSingleThreadExecutor();
new AndInThreads(service, new ProcNoNulls<Integer>(list::add), 1, 2).value();
MatcherAssert.assertThat(list, new IsIterableContainingInAnyOrder<>(new ListOf<>(new IsEqual<>(1), new IsEqual<>(2))));
}
Aggregations