SW360ComponentClientAdapterAsyncImpl implements SW360ComponentClientAdapterAsync { @Override public CompletableFuture<MultiStatusResponse> deleteComponents(Collection<String> idsToDelete) { return SW360DeleteUtils.deleteEntities(getComponentClient()::deleteComponents, idsToDelete); } SW360ComponentClientAdapterAsyncImpl(SW360ComponentClient client); @Override SW360ComponentClient getComponentClient(); @Override CompletableFuture<SW360Component> createComponent(SW360Component component); @Override CompletableFuture<Optional<SW360Component>> getComponentById(String componentId); @Override CompletableFuture<Optional<SW360Component>> getComponentByName(String componentName); @Override CompletableFuture<List<SW360SparseComponent>> search(ComponentSearchParams searchParams); @Override CompletableFuture<PagingResult<SW360SparseComponent>> searchWithPaging(ComponentSearchParams searchParams); @Override CompletableFuture<SW360Component> updateComponent(SW360Component component); @Override CompletableFuture<MultiStatusResponse> deleteComponents(Collection<String> idsToDelete); @Override CompletableFuture<Void> deleteComponent(String componentId);  }
@Test public void testDeleteComponentsEmptyCollection() { MultiStatusResponse response = block(componentClientAdapter.deleteComponents(Collections.emptySet())); assertThat(response.responseCount()).isEqualTo(0); verifyZeroInteractions(componentClient); }
@Test public void testDeleteMultipleComponents() { Collection<String> componentsToDelete = Arrays.asList(COMPONENT_ID, "DEL-1", "DEL-2"); MultiStatusResponse expResponse = new MultiStatusResponse(Collections.singletonMap(COMPONENT_ID, 200)); when(componentClient.deleteComponents(componentsToDelete)) .thenReturn(CompletableFuture.completedFuture(expResponse)); MultiStatusResponse response = block(componentClientAdapter.deleteComponents(componentsToDelete)); assertThat(response).isEqualTo(expResponse); }