@SuppressWarnings("Convert2Lambda")
@Test(timeout = 2000)
public void expectedMismatchMessageForAssertionConditionsWhenNotUsingLambdasWithAlias() {
final AtomicReference<String> lastMatchMessage = new AtomicReference<>();
CountDown countDown = new CountDown(10);
try {
with()
.conditionEvaluationListener(condition -> {
lastMatchMessage.set(condition.getDescription());
try {
countDown.call();
} catch (Exception e) {
throw new RuntimeException(e);
}
}).await("my alias").atMost(150, MILLISECONDS)
.until(new Runnable() {
@Override
public void run() {
assertEquals(5, (int) countDown.get());
}
});
fail("Expected to fail");
} catch (ConditionTimeoutException e) {
assertThat(lastMatchMessage.get(), allOf(startsWith("Runnable condition with alias my alias defined in"), containsString(testName.getMethodName()), containsString("expected:")));