ProjectsRepositoryImpl implements ProjectsRepository { @Override public List<FindFlavorsResult> findFlavors(FindFlavorsRequest findFlavorsRequest) { QueryResult flavorsResult = queryRepository.query(findFlavorsRequest.getPayload()); Data data = flavorsResult.getData(); return data.getRows().stream() .map(r -> { ValueFormatter vf = new ValueFormatter(data, r); return new FindFlavorsResult( vf.getString("flavors.id"), vf.getString("flavors.name"), vf.getString("projects.name"), vf.getString("flavors.vcpus"), vf.getString("flavors.ram"), vf.getString("flavors.root_disk"), vf.getString("flavors.ephemeral_disk") ); }) .collect(Collectors.toList()); } @Autowired  ProjectsRepositoryImpl(QueryRepository queryRepository); @Override List<FindProjectsResult> findProjects(FindProjectsRequest findProjectsRequest); @Override List<FindFlavorsResult> findFlavors(FindFlavorsRequest findFlavorsRequest); @Override List<FindNetworksResult> findNetworks(FindNetworksRequest findNetworksRequest); @Override List<FindKeypairsResult> findKeypairs(FindKeypairsRequest findKeypairsRequest);  }
@Test public void testFindFlavors() { Project project = EntityGenerator.getProject(); Flavor flavor = EntityGenerator.getFlavor(); QueryResult queryResult = createMockFlavorsResult(project, flavor); mockQueryRepository.addQueryResult(queryResult); FindFlavorsRequest findFlavorsRequest = requestProvider.get(FindFlavorsRequest.class); List<FindFlavorsResult> flavors = projectsRepository.findFlavors(findFlavorsRequest); assertThat(flavors, hasSize(1)); FindFlavorsResult result = flavors.get(0); assertThat(result.getId(), equalTo(flavor.getId())); assertThat(result.getName(), equalTo(flavor.getName())); assertThat(result.getProjectName(), equalTo(project.getName())); assertThat(result.getVcpus(), equalTo(String.valueOf(flavor.getVcpus()))); assertThat(result.getRam(), equalTo(String.valueOf(flavor.getRam()))); assertThat(result.getRootDisk(), equalTo(String.valueOf(flavor.getRootDisk()))); assertThat(result.getEphemeralDisk(), equalTo(String.valueOf(flavor.getEphemeralDisk()))); }