MatchesStreamQuery implements Predicate<Event> { @Override public boolean test(@Nullable Event input) { checkNotNull(input); if (filterList.isEmpty()) { return true; } for (EventFilter filter : filterList) { Predicate<Event> filterPredicate = new MatchFilter(filter); if (filterPredicate.test(input)) { return true; } } return false; } MatchesStreamQuery(EventStreamQuery query); @Override boolean test(@Nullable Event input);  }
@Test @DisplayName("match proper records") void matchProperRecords() { ProjectId properValue = generate(); Event event = eventWith(properValue); MatchesStreamQuery predicate = queryWith(FIELD_NAME, properValue); assertTrue(predicate.test(event)); }
@Test @DisplayName("not match improper records") void notMatchImproperRecords() { ProjectId properField = generate(); ProjectId wrongValue = ProjectId.getDefaultInstance(); Event event = eventWith(wrongValue); MatchesStreamQuery predicate = queryWith(FIELD_NAME, properField); assertFalse(predicate.test(event)); }