SkippedCauseFilter implements Predicate<GitHubPRCause> { @Override public boolean apply(GitHubPRCause cause) { if (cause.isSkip()) { listener.debug("Skipping PR #{}", cause.getNumber()); return false; } else { listener.debug("Prepare to trigger build for PR #{}, because {}", cause.getNumber(), cause.getReason()); return true; } } SkippedCauseFilter(LoggingTaskListenerWrapper listener); @Override boolean apply(GitHubPRCause cause);  }
@Test public void shouldNotSkip() throws Exception { when(cause.isSkip()).thenReturn(false); assertThat("not skip", new SkippedCauseFilter(tlRule.getListener()).apply(cause), is(true)); }
@Test public void shouldSkip() throws Exception { when(cause.isSkip()).thenReturn(true); assertThat("skip", new SkippedCauseFilter(tlRule.getListener()).apply(cause), is(false)); }