@Test public void shouldAcceptNullResults() throws Exception { when(matcher1.match(mail)).thenReturn(ImmutableList.of(ANY_AT_JAMES, ANY_AT_JAMES2)); when(matcher2.match(mail)).thenReturn(null); testee.add(matcher1); testee.add(matcher2); assertThat(testee.match(mail)).containsOnly(ANY_AT_JAMES, ANY_AT_JAMES2); }
@Override public Collection<MailAddress> match(Mail mail) { return getMatchers().stream() .flatMap(Throwing.<Matcher, Stream<MailAddress>>function(matcher -> applyMatcher(matcher, mail)) .sneakyThrow()) .collect(Collectors.toSet()); }
Or extends GenericCompositeMatcher { @Override public Collection<MailAddress> match(Mail mail) { return getMatchers().stream() .flatMap(Throwing.<Matcher, Stream<MailAddress>>function(matcher -> applyMatcher(matcher, mail)) .sneakyThrow()) .collect(Collectors.toSet()); } }
Or extends GenericCompositeMatcher { @Override public Collection<MailAddress> match(Mail mail) { return getMatchers().stream() .flatMap(Throwing.<Matcher, Stream<MailAddress>>function(matcher -> applyMatcher(matcher, mail)) .sneakyThrow()) .collect(Collectors.toSet()); }  }
Or extends GenericCompositeMatcher { @Override public Collection<MailAddress> match(Mail mail) { return getMatchers().stream() .flatMap(Throwing.<Matcher, Stream<MailAddress>>function(matcher -> applyMatcher(matcher, mail)) .sneakyThrow()) .collect(Collectors.toSet()); }  @Override Collection<MailAddress> match(Mail mail); }
Or extends GenericCompositeMatcher { @Override public Collection<MailAddress> match(Mail mail) { return getMatchers().stream() .flatMap(Throwing.<Matcher, Stream<MailAddress>>function(matcher -> applyMatcher(matcher, mail)) .sneakyThrow()) .collect(Collectors.toSet()); }  @Override Collection<MailAddress> match(Mail mail);  }