@Test public void testGetAllAsCloudResourceStatusWhenNoResource() { List<Resource> resources = new ArrayList<>(); Mockito.when(resourceRepository.findAllByStackId(1L)).thenReturn(resources); List<CloudResourceStatus> actual = underTest.getAllAsCloudResourceStatus(1L); Assert.assertEquals(0L, actual.size()); }
public List<CloudResourceStatus> getAllAsCloudResourceStatus(Long stackId) { List<Resource> resources = repository.findAllByStackId(stackId); List<CloudResourceStatus> list = new ArrayList<>(); resources.forEach(r -> { CloudResource cloudResource = conversionService.convert(r, CloudResource.class); list.add(new CloudResourceStatus(cloudResource, ResourceStatus.CREATED)); }); return list; }
ResourceService { public List<CloudResourceStatus> getAllAsCloudResourceStatus(Long stackId) { List<Resource> resources = repository.findAllByStackId(stackId); List<CloudResourceStatus> list = new ArrayList<>(); resources.forEach(r -> { CloudResource cloudResource = conversionService.convert(r, CloudResource.class); list.add(new CloudResourceStatus(cloudResource, ResourceStatus.CREATED)); }); return list; } }
ResourceService { public List<CloudResourceStatus> getAllAsCloudResourceStatus(Long stackId) { List<Resource> resources = repository.findAllByStackId(stackId); List<CloudResourceStatus> list = new ArrayList<>(); resources.forEach(r -> { CloudResource cloudResource = conversionService.convert(r, CloudResource.class); list.add(new CloudResourceStatus(cloudResource, ResourceStatus.CREATED)); }); return list; }  }
ResourceService { public List<CloudResourceStatus> getAllAsCloudResourceStatus(Long stackId) { List<Resource> resources = repository.findAllByStackId(stackId); List<CloudResourceStatus> list = new ArrayList<>(); resources.forEach(r -> { CloudResource cloudResource = conversionService.convert(r, CloudResource.class); list.add(new CloudResourceStatus(cloudResource, ResourceStatus.CREATED)); }); return list; }  List<CloudResourceStatus> getAllAsCloudResourceStatus(Long stackId); Set<Resource> getNotInstanceRelatedByStackId(Long stackId); Collection<Resource> getAllByStackId(Long stackId); Optional<Resource> findByStackIdAndNameAndType(Long stackId, String name, ResourceType type); List<Resource> findByStackIdAndType(Long stackId,  ResourceType type); void delete(Resource resource); Resource save(Resource resource); Iterable<Resource> saveAll(Iterable<Resource> resources); Optional<Resource> findByResourceReferenceAndStatusAndType(String resourceReference, CommonStatus status, ResourceType resourceType); }
ResourceService { public List<CloudResourceStatus> getAllAsCloudResourceStatus(Long stackId) { List<Resource> resources = repository.findAllByStackId(stackId); List<CloudResourceStatus> list = new ArrayList<>(); resources.forEach(r -> { CloudResource cloudResource = conversionService.convert(r, CloudResource.class); list.add(new CloudResourceStatus(cloudResource, ResourceStatus.CREATED)); }); return list; }  List<CloudResourceStatus> getAllAsCloudResourceStatus(Long stackId); Set<Resource> getNotInstanceRelatedByStackId(Long stackId); Collection<Resource> getAllByStackId(Long stackId); Optional<Resource> findByStackIdAndNameAndType(Long stackId, String name, ResourceType type); List<Resource> findByStackIdAndType(Long stackId,  ResourceType type); void delete(Resource resource); Resource save(Resource resource); Iterable<Resource> saveAll(Iterable<Resource> resources); Optional<Resource> findByResourceReferenceAndStatusAndType(String resourceReference, CommonStatus status, ResourceType resourceType);  }