FederationResult { private FederationResult(ImmutableList<TargetResult> targetResults) { this.targetResults = targetResults; if (targetResults.stream().anyMatch(TargetResult::isMandatory)) targetsToWaitFor = targetResults.stream().filter(TargetResult::isMandatory).collect(Collectors.toList()); else targetsToWaitFor = new ArrayList<>(targetResults); } private  FederationResult(ImmutableList<TargetResult> targetResults); void waitForAll(int queryTimeout, Clock clock); List<TargetResult> all();  }
@Test public void testFederationResult() { assertTimeout(ImmutableSet.of(), 100, 200, 180); assertTimeout(ImmutableSet.of(), 480, 400, 400); assertTimeout(ImmutableSet.of("dsp1"), 260, 280, 220); assertTimeout(ImmutableSet.of("organic"), 520, 160, 160); assertTimeout(ImmutableSet.of("dsp2"), 200, 220, 230); assertTimeout(ImmutableSet.of(), 200, 220, 210); assertTimeout(ImmutableSet.of("dsp1", "dsp2"), 200, 260, 260); assertTimeout(ImmutableSet.of("organic"), 520, 260, 260); }