@Test public void changesets_with_at_least_1_matching_context_will_always_match() { ExecutionContexts executionContexts = new ExecutionContexts(asList("foo", "bar")); assertThat(executionContexts.matches(Optional.of(singletonList("foo")))).isTrue(); assertThat(executionContexts.matches(Optional.of(singletonList("bar")))).isTrue(); assertThat(executionContexts.matches(Optional.of(asList("foo", "bar")))).isTrue(); assertThat(executionContexts.matches(Optional.of(asList("foo", "baz")))).isTrue(); assertThat(executionContexts.matches(Optional.of(singletonList("baz")))).isFalse(); }
public boolean matches(Optional<Collection<String>> declaredContexts) { if (!declaredContexts.isPresent()) { return true; } Collection<String> changesetContexts = declaredContexts.get(); if (changesetContexts.isEmpty()) { return true; } return changesetContexts.stream().anyMatch(anyContext); }
ExecutionContexts { public boolean matches(Optional<Collection<String>> declaredContexts) { if (!declaredContexts.isPresent()) { return true; } Collection<String> changesetContexts = declaredContexts.get(); if (changesetContexts.isEmpty()) { return true; } return changesetContexts.stream().anyMatch(anyContext); } }
ExecutionContexts { public boolean matches(Optional<Collection<String>> declaredContexts) { if (!declaredContexts.isPresent()) { return true; } Collection<String> changesetContexts = declaredContexts.get(); if (changesetContexts.isEmpty()) { return true; } return changesetContexts.stream().anyMatch(anyContext); } ExecutionContexts(Collection<String> executionContexts); private  ExecutionContexts(Optional<Collection<String>> contexts); }
ExecutionContexts { public boolean matches(Optional<Collection<String>> declaredContexts) { if (!declaredContexts.isPresent()) { return true; } Collection<String> changesetContexts = declaredContexts.get(); if (changesetContexts.isEmpty()) { return true; } return changesetContexts.stream().anyMatch(anyContext); } ExecutionContexts(Collection<String> executionContexts); private  ExecutionContexts(Optional<Collection<String>> contexts); boolean matches(Optional<Collection<String>> declaredContexts); }
ExecutionContexts { public boolean matches(Optional<Collection<String>> declaredContexts) { if (!declaredContexts.isPresent()) { return true; } Collection<String> changesetContexts = declaredContexts.get(); if (changesetContexts.isEmpty()) { return true; } return changesetContexts.stream().anyMatch(anyContext); } ExecutionContexts(Collection<String> executionContexts); private  ExecutionContexts(Optional<Collection<String>> contexts); boolean matches(Optional<Collection<String>> declaredContexts); static final ExecutionContexts DEFAULT_CONTEXT; }