### Question:
IntegrationIdFilter implements Function<ListResult<IntegrationDeployment>, ListResult<IntegrationDeployment>> { @Override public ListResult<IntegrationDeployment> apply(final ListResult<IntegrationDeployment> list) { if (integrationId == null) { return list; } final List<IntegrationDeployment> filtered = list.getItems().stream() .filter(i -> i.getSpec().idEquals(integrationId)).collect(Collectors.toList()); return ListResult.of(filtered); } IntegrationIdFilter(final String integrationId); @Override ListResult<IntegrationDeployment> apply(final ListResult<IntegrationDeployment> list);  }### Answer:
@Test public void shouldFilterEmptyResults() { assertThat(filter.apply(ListResult.of(emptyList()))).isEmpty(); }
@Test public void shouldFilterOutTrivialWantedDeployments() { assertThat(filter.apply(ListResult.of(wanted))).containsOnly(wanted); }
@Test public void shouldFilterOutWantedDeployments() { assertThat(filter.apply(ListResult.of(unwanted, wanted, unwanted))).containsOnly(wanted); }
@Test public void shouldFilterOutWantedDeploymentsNotFinding() { assertThat(filter.apply(ListResult.of(unwanted, unwanted, unwanted))).isEmpty(); }