@Test public void testListEnvironments() throws Exception { when(environmentRepository.listEnvironments(cluster, null)) .thenReturn(Collections.singletonList(environment)); final ListEnvironmentsResponse response = api.listEnvironments(request); verify(apiModelMapper).toModelCluster(clusterWrapper); verify(environmentRepository).listEnvironments(cluster, null); assertThat(response.getEnvironmentIds().size()).isEqualTo(1); assertThat(response.getEnvironmentIds().get(0)).isEqualTo(environmentIdWrapper); }
public ListEnvironmentsResponse listEnvironments(@NonNull final ListEnvironmentsRequest request) throws InternalServiceException { final Cluster cluster = apiModelMapper.toModelCluster(request.getCluster()); try { final List<Environment> environments = environmentRepository.listEnvironments(cluster, request.getEnvironmentNamePrefix()); return ListEnvironmentsResponse.builder() .environmentIds( environments .stream() .map(e -> apiModelMapper.toWrapperEnvironmentId(e.getEnvironmentId())) .collect(Collectors.toList())) .build(); } catch (final InternalServiceException e) { log.error(e.getMessage(), e); throw e; } catch (final Exception e) { log.error(e.getMessage(), e); throw new InternalServiceException(e.getMessage(), e); } }
ListEnvironmentsApi { public ListEnvironmentsResponse listEnvironments(@NonNull final ListEnvironmentsRequest request) throws InternalServiceException { final Cluster cluster = apiModelMapper.toModelCluster(request.getCluster()); try { final List<Environment> environments = environmentRepository.listEnvironments(cluster, request.getEnvironmentNamePrefix()); return ListEnvironmentsResponse.builder() .environmentIds( environments .stream() .map(e -> apiModelMapper.toWrapperEnvironmentId(e.getEnvironmentId())) .collect(Collectors.toList())) .build(); } catch (final InternalServiceException e) { log.error(e.getMessage(), e); throw e; } catch (final Exception e) { log.error(e.getMessage(), e); throw new InternalServiceException(e.getMessage(), e); } } }
ListEnvironmentsApi { public ListEnvironmentsResponse listEnvironments(@NonNull final ListEnvironmentsRequest request) throws InternalServiceException { final Cluster cluster = apiModelMapper.toModelCluster(request.getCluster()); try { final List<Environment> environments = environmentRepository.listEnvironments(cluster, request.getEnvironmentNamePrefix()); return ListEnvironmentsResponse.builder() .environmentIds( environments .stream() .map(e -> apiModelMapper.toWrapperEnvironmentId(e.getEnvironmentId())) .collect(Collectors.toList())) .build(); } catch (final InternalServiceException e) { log.error(e.getMessage(), e); throw e; } catch (final Exception e) { log.error(e.getMessage(), e); throw new InternalServiceException(e.getMessage(), e); } }  }
ListEnvironmentsApi { public ListEnvironmentsResponse listEnvironments(@NonNull final ListEnvironmentsRequest request) throws InternalServiceException { final Cluster cluster = apiModelMapper.toModelCluster(request.getCluster()); try { final List<Environment> environments = environmentRepository.listEnvironments(cluster, request.getEnvironmentNamePrefix()); return ListEnvironmentsResponse.builder() .environmentIds( environments .stream() .map(e -> apiModelMapper.toWrapperEnvironmentId(e.getEnvironmentId())) .collect(Collectors.toList())) .build(); } catch (final InternalServiceException e) { log.error(e.getMessage(), e); throw e; } catch (final Exception e) { log.error(e.getMessage(), e); throw new InternalServiceException(e.getMessage(), e); } }  ListEnvironmentsResponse listEnvironments(@NonNull final ListEnvironmentsRequest request); }
ListEnvironmentsApi { public ListEnvironmentsResponse listEnvironments(@NonNull final ListEnvironmentsRequest request) throws InternalServiceException { final Cluster cluster = apiModelMapper.toModelCluster(request.getCluster()); try { final List<Environment> environments = environmentRepository.listEnvironments(cluster, request.getEnvironmentNamePrefix()); return ListEnvironmentsResponse.builder() .environmentIds( environments .stream() .map(e -> apiModelMapper.toWrapperEnvironmentId(e.getEnvironmentId())) .collect(Collectors.toList())) .build(); } catch (final InternalServiceException e) { log.error(e.getMessage(), e); throw e; } catch (final Exception e) { log.error(e.getMessage(), e); throw new InternalServiceException(e.getMessage(), e); } }  ListEnvironmentsResponse listEnvironments(@NonNull final ListEnvironmentsRequest request);  }