PredicateBinaryExceptionClassifier extends ClassifierSupport<Throwable, Boolean> { @Override public Boolean classify(Throwable classifiable) { return predicate.apply(classifiable); } PredicateBinaryExceptionClassifier(Predicate<Throwable> predicate); Predicate<Throwable> getPredicate(); void setPredicate(Predicate<Throwable> predicate); @Override Boolean classify(Throwable classifiable);  }
@Test public void testClassify() { Predicate predicate = Mockito.mock(Predicate.class); PredicateBinaryExceptionClassifier classifier = new PredicateBinaryExceptionClassifier(predicate); classifier.setPredicate(predicate); Mockito.when(predicate.apply(Mockito.any(Throwable.class))).thenReturn(false); Assert.assertSame(predicate, classifier.getPredicate()); Assert.assertFalse(classifier.classify(new RuntimeException())); Mockito.verify(predicate, Mockito.times(1)).apply(Mockito.any(Throwable.class)); }