Search in sources :

Example 6 with Satisfies

use of org.llorllale.cactoos.matchers.Satisfies in project cactoos by yegor256.

the class BiProcOfTest method worksWithTwoProcs.

@Test
void worksWithTwoProcs() throws Exception {
    final AtomicInteger fst = new AtomicInteger();
    final AtomicInteger snd = new AtomicInteger();
    new Assertion<>("Must execute BiProc with two Procs", new BiProcOf<>(AtomicInteger::incrementAndGet, AtomicInteger::incrementAndGet), new Satisfies<>(proc -> {
        proc.exec(fst, snd);
        return fst.get() == 1 && snd.get() == 1;
    })).affirm();
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Satisfies(org.llorllale.cactoos.matchers.Satisfies) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)6 Satisfies (org.llorllale.cactoos.matchers.Satisfies)6 CountDownLatch (java.util.concurrent.CountDownLatch)3 Executors (java.util.concurrent.Executors)3 ThreadFactory (java.util.concurrent.ThreadFactory)3 TimeUnit (java.util.concurrent.TimeUnit)3 IsEqual (org.hamcrest.core.IsEqual)3 Assertion (org.llorllale.cactoos.matchers.Assertion)3 IsApplicable (org.llorllale.cactoos.matchers.IsApplicable)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 RunnableOf (org.cactoos.proc.RunnableOf)1 HasString (org.llorllale.cactoos.matchers.HasString)1