@Test @SuppressWarnings("unchecked") public void testMatchOnFailure() throws Exception { when(elementMatcher.matches(target)).thenThrow(RuntimeException.class); assertThat(new FailSafeMatcher<Object>(elementMatcher, true).matches(target), is(true)); verifyZeroInteractions(target); verify(elementMatcher).matches(target); verifyNoMoreInteractions(elementMatcher); }
public boolean matches(T target) { try { return matcher.matches(target); } catch (Exception ignored) { return fallback; } }
FailSafeMatcher extends ElementMatcher.Junction.AbstractBase<T> { public boolean matches(T target) { try { return matcher.matches(target); } catch (Exception ignored) { return fallback; } } }
FailSafeMatcher extends ElementMatcher.Junction.AbstractBase<T> { public boolean matches(T target) { try { return matcher.matches(target); } catch (Exception ignored) { return fallback; } } FailSafeMatcher(ElementMatcher<? super T> matcher, boolean fallback); }
FailSafeMatcher extends ElementMatcher.Junction.AbstractBase<T> { public boolean matches(T target) { try { return matcher.matches(target); } catch (Exception ignored) { return fallback; } } FailSafeMatcher(ElementMatcher<? super T> matcher, boolean fallback); boolean matches(T target); @Override String toString(); }
FailSafeMatcher extends ElementMatcher.Junction.AbstractBase<T> { public boolean matches(T target) { try { return matcher.matches(target); } catch (Exception ignored) { return fallback; } } FailSafeMatcher(ElementMatcher<? super T> matcher, boolean fallback); boolean matches(T target); @Override String toString();  }