### Question:
QualityService { Set<Run> getRunsToIncludeInQuality(Execution execution) { return execution.getRuns().stream() .filter(r -> r.getIncludeInThresholds() == Boolean.TRUE) .collect(Collectors.toSet()); }  void computeQuality(Execution execution);  }### Answer:
@Test public void getRunsToIncludeInQuality_should_return_all_runs_to_include() { final Run run1 = run().withIncludeInThresholds(Boolean.TRUE); final Run run2 = run().withIncludeInThresholds(Boolean.TRUE); Execution execution = new Execution() .withRuns(new HashSet<>(Arrays.asList( run1, run2))); Set<Run> runs = cut.getRunsToIncludeInQuality(execution); assertThat(runs).containsOnly(run1, run2); }
@Test public void getRunsToIncludeInQuality_should_return_only_runs_to_include() { final Run run1 = run().withIncludeInThresholds(Boolean.TRUE); final Run run2 = run().withIncludeInThresholds(Boolean.FALSE); final Run run3 = run().withIncludeInThresholds(null); Execution execution = new Execution() .withRuns(new HashSet<>(Arrays.asList( run1, run2, run3))); Set<Run> runs = cut.getRunsToIncludeInQuality(execution); assertThat(runs).containsOnly(run1); }