Search in sources :

Example 1 with RunnableOf

use of org.cactoos.proc.RunnableOf in project cactoos by yegor256.

the class ScalarOfTest method worksWithRunnable.

@Test
void worksWithRunnable() {
    final Object obj = new Object();
    final Object result = new Object();
    final AtomicReference<Object> done = new AtomicReference<>();
    new Assertion<>("Must convert Runnable into Scalar", new ScalarOf<>(new RunnableOf(() -> {
        done.set(result);
    }), obj), new Satisfies<>(scalar -> {
        final Object res = scalar.value();
        return res.equals(obj) && done.get().equals(result);
    })).affirm();
}
Also used : Satisfies(org.llorllale.cactoos.matchers.Satisfies) AtomicReference(java.util.concurrent.atomic.AtomicReference) RunnableOf(org.cactoos.proc.RunnableOf) Test(org.junit.jupiter.api.Test)

Aggregations

AtomicReference (java.util.concurrent.atomic.AtomicReference)1 RunnableOf (org.cactoos.proc.RunnableOf)1 Test (org.junit.jupiter.api.Test)1 Satisfies (org.llorllale.cactoos.matchers.Satisfies)1