Package com.jayway.awaitility.support

Examples of com.jayway.awaitility.support.CountDown.call()


    public void expectedMatchMessageForCallableConditionsWithoutAliasWhenUsingLambda() {
        final CountDown countDown = new CountDown(10);
        final AtomicReference<String> lastMatchMessage = new AtomicReference<>();
        with()
                .conditionEvaluationListener(condition -> lastMatchMessage.set(condition.getDescription()))
                .until(() -> countDown.call() == 5);

        assertThat(lastMatchMessage.get(), allOf(startsWith("Condition defined as a lambda expression in"), containsString(getClass().getName()), endsWith("returned true")));
    }

    @Test(timeout = 2000)
View Full Code Here


        final CountDown countDown = new CountDown(10);
        final AtomicReference<String> lastMatchMessage = new AtomicReference<>();
        with()
                .conditionEvaluationListener(condition -> lastMatchMessage.set(condition.getDescription()))
                .await("my alias")
                .until(() -> countDown.call() == 5);

        assertThat(lastMatchMessage.get(), allOf(startsWith("Condition with alias my alias defined as a lambda expression in "), containsString(getClass().getName()), endsWith("returned true")));
    }

    // Callable<Boolean> mismatch tests
View Full Code Here

                    .conditionEvaluationListener(condition -> lastMatchMessage.set(condition.getDescription()))
                    .await().atMost(150, MILLISECONDS)
                    .until(new Callable<Boolean>() {
                        @Override
                        public Boolean call() throws Exception {
                            return countDown.call() == -1;
                        }
                    });
            fail("Should fail");
        } catch (Exception e) {
            assertThat(lastMatchMessage.get(), allOf(startsWith("Callable condition defined in"), containsString(testName.getMethodName()), endsWith("returned false")));
View Full Code Here

                    .conditionEvaluationListener(condition -> lastMatchMessage.set(condition.getDescription()))
                    .await("my alias").atMost(150, MILLISECONDS)
                    .until(new Callable<Boolean>() {
                        @Override
                        public Boolean call() throws Exception {
                            return countDown.call() == 5;
                        }
                    });
            fail("Should fail");
        } catch (Exception e) {
            assertThat(lastMatchMessage.get(), allOf(startsWith("Callable condition with alias my alias defined in"), containsString(testName.getMethodName()), endsWith("returned false")));
View Full Code Here

        final AtomicReference<String> lastMatchMessage = new AtomicReference<>();
        try {
            with()
                    .conditionEvaluationListener(condition -> lastMatchMessage.set(condition.getDescription()))
                    .await().atMost(150, MILLISECONDS)
                    .until(() -> countDown.call() == 5);
            fail("Should fail");
        } catch (Exception e) {
            assertThat(lastMatchMessage.get(), allOf(startsWith("Condition defined as a lambda expression in"), containsString(getClass().getName()), endsWith("returned false")));
        }
    }
View Full Code Here

        final AtomicReference<String> lastMatchMessage = new AtomicReference<>();
        try {
            with()
                    .conditionEvaluationListener(condition -> lastMatchMessage.set(condition.getDescription()))
                    .await("my alias").atMost(150, MILLISECONDS)
                    .until(() -> countDown.call() == 5);
            fail("Should fail");
        } catch (Exception e) {
            assertThat(lastMatchMessage.get(), allOf(startsWith("Condition with alias my alias defined as a lambda expression in "), containsString(getClass().getName()), endsWith("returned false")));
        }
    }
View Full Code Here

    public void conditionOfCallableBooleanHasBooleanValuesInConditionEvalutionListener() {
        final CountDown countDown = new CountDown(10);
        final List<Boolean> results = new ArrayList<>();
        with()
                .conditionEvaluationListener(condition -> results.add((Boolean) condition.getValue()))
                .until(() -> countDown.call() == 5);

        assertThat(results.get(results.size() - 1), is(true));
        assertThat(results.subList(0, results.size() - 1), allOf(hasItem(false), not(hasItem(true))));
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.