@Test public void itListsAllClusters() throws Exception { when(repository.listClusters(null, null)) .thenReturn(asList(cluster("1", "alpha"), cluster("2", "beta"), cluster("3", "gamma"))); ListClustersResponse response = api.listClusters(ListClustersRequest.builder().build()); assertThat(response.getClusters()) .extracting("accountId", "clusterName") .containsExactlyInAnyOrder(tuple("1", "alpha"), tuple("2", "beta"), tuple("3", "gamma")); }
public ListClustersResponse listClusters(@NonNull final ListClustersRequest request) throws InternalServiceException { try { List<Cluster> clusters = environmentRepository.listClusters( request.getAccountId(), request.getClusterNamePrefix()); return ListClustersResponse.builder() .clusters(clusters.stream().map(apiModelMapper::toCluster).collect(Collectors.toList())) .build(); } catch (final Exception e) { log.error(e.getMessage(), e); throw new InternalServiceException(e.getMessage(), e); } }
ListClustersApi { public ListClustersResponse listClusters(@NonNull final ListClustersRequest request) throws InternalServiceException { try { List<Cluster> clusters = environmentRepository.listClusters( request.getAccountId(), request.getClusterNamePrefix()); return ListClustersResponse.builder() .clusters(clusters.stream().map(apiModelMapper::toCluster).collect(Collectors.toList())) .build(); } catch (final Exception e) { log.error(e.getMessage(), e); throw new InternalServiceException(e.getMessage(), e); } } }
ListClustersApi { public ListClustersResponse listClusters(@NonNull final ListClustersRequest request) throws InternalServiceException { try { List<Cluster> clusters = environmentRepository.listClusters( request.getAccountId(), request.getClusterNamePrefix()); return ListClustersResponse.builder() .clusters(clusters.stream().map(apiModelMapper::toCluster).collect(Collectors.toList())) .build(); } catch (final Exception e) { log.error(e.getMessage(), e); throw new InternalServiceException(e.getMessage(), e); } }  }
ListClustersApi { public ListClustersResponse listClusters(@NonNull final ListClustersRequest request) throws InternalServiceException { try { List<Cluster> clusters = environmentRepository.listClusters( request.getAccountId(), request.getClusterNamePrefix()); return ListClustersResponse.builder() .clusters(clusters.stream().map(apiModelMapper::toCluster).collect(Collectors.toList())) .build(); } catch (final Exception e) { log.error(e.getMessage(), e); throw new InternalServiceException(e.getMessage(), e); } }  ListClustersResponse listClusters(@NonNull final ListClustersRequest request); }
ListClustersApi { public ListClustersResponse listClusters(@NonNull final ListClustersRequest request) throws InternalServiceException { try { List<Cluster> clusters = environmentRepository.listClusters( request.getAccountId(), request.getClusterNamePrefix()); return ListClustersResponse.builder() .clusters(clusters.stream().map(apiModelMapper::toCluster).collect(Collectors.toList())) .build(); } catch (final Exception e) { log.error(e.getMessage(), e); throw new InternalServiceException(e.getMessage(), e); } }  ListClustersResponse listClusters(@NonNull final ListClustersRequest request);  }