Search in sources :

Example 1 with ProcNoNulls

use of org.cactoos.proc.ProcNoNulls 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))));
}
Also used : Synced(org.cactoos.list.Synced) ExecutorService(java.util.concurrent.ExecutorService) ListOf(org.cactoos.list.ListOf) ProcNoNulls(org.cactoos.proc.ProcNoNulls) Test(org.junit.jupiter.api.Test)

Example 2 with ProcNoNulls

use of org.cactoos.proc.ProcNoNulls 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))));
}
Also used : Synced(org.cactoos.list.Synced) ExecutorService(java.util.concurrent.ExecutorService) ListOf(org.cactoos.list.ListOf) ProcNoNulls(org.cactoos.proc.ProcNoNulls) Test(org.junit.jupiter.api.Test)

Aggregations

ExecutorService (java.util.concurrent.ExecutorService)2 ListOf (org.cactoos.list.ListOf)2 Synced (org.cactoos.list.Synced)2 ProcNoNulls (org.cactoos.proc.ProcNoNulls)2 Test (org.junit.jupiter.api.Test)2