/** * Instruct Awaitility to not ignore any exceptions that occur during evaluation. * This is only useful if Awaitility is configured to ignore exceptions by default but you want to * have a different behavior for a single test case. * * @return the condition factory. */ public ConditionFactory ignoreNoExceptions() { return ignoreExceptionsMatching(new Predicate<Throwable>() { public boolean matches(Throwable e) { return false; } }); }
/** * Instruct Awaitility to ignore <i>all</i> exceptions that occur during evaluation. * Exceptions will be treated as evaluating to * <code>false</code>. This is useful in situations where the evaluated * conditions may temporarily throw exceptions. * * @return the condition factory. */ public ConditionFactory ignoreExceptions() { return ignoreExceptionsMatching(new Predicate<Throwable>() { public boolean matches(Throwable e) { return true; } }); }
/** * Instruct Awaitility to not ignore any exceptions that occur during evaluation. * This is only useful if Awaitility is configured to ignore exceptions by default but you want to * have a different behavior for a single test case. * * @return the condition factory. */ public ConditionFactory ignoreNoExceptions() { return ignoreExceptionsMatching(new Predicate<Throwable>() { public boolean matches(Throwable e) { return false; } }); }
/** * Instruct Awaitility to ignore <i>all</i> exceptions that occur during evaluation. * Exceptions will be treated as evaluating to * <code>false</code>. This is useful in situations where the evaluated * conditions may temporarily throw exceptions. * * @return the condition factory. */ public ConditionFactory ignoreExceptions() { return ignoreExceptionsMatching(new Predicate<Throwable>() { public boolean matches(Throwable e) { return true; } }); }
@Test(timeout = 2000) public void exceptionIgnoringWorksForHamcrestMatchers() { new Asynch(fakeRepository).perform(); await().atMost(1000, MILLISECONDS).with().ignoreExceptionsMatching(instanceOf(RuntimeException.class)).until(conditionsThatIsThrowingAnExceptionForATime(IllegalArgumentException.class)); }
@Test(timeout = 2000) public void assertionErrorIgnoringWorksForHamcrestMatchers() { new Asynch(fakeRepository).perform(); await().atMost(1000, MILLISECONDS).with().ignoreExceptionsMatching(instanceOf(AssertionError.class)).until(conditionsThatIsThrowingAnExceptionForATime(AssertionError.class)); }
@Test(timeout = 2000) public void exceptionIgnoringWorksForPredicates() { new Asynch(fakeRepository).perform(); await().atMost(1000, MILLISECONDS).with().ignoreExceptionsMatching(new Predicate<Throwable>() { public boolean matches(Throwable e) { return e instanceof RuntimeException; } }).until(conditionsThatIsThrowingAnExceptionForATime(IllegalArgumentException.class)); }