ProjectsRepositoryImpl implements ProjectsRepository { @Override public List<FindKeypairsResult> findKeypairs(FindKeypairsRequest findKeypairsRequest) { QueryResult keypairsResult = queryRepository.query(findKeypairsRequest.getPayload()); Data data = keypairsResult.getData(); return data.getRows().stream() .map(r -> { ValueFormatter vf = new ValueFormatter(data, r); return new FindKeypairsResult( vf.getString("keypairs.name"), vf.getString("keypairs.fingerprint"), vf.getString("projects.name") ); }) .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 testFindKeypairs() { Project project = EntityGenerator.getProject(); Keypair keypair = EntityGenerator.getKeypair(); QueryResult queryResult = createMockKeypairsResult(project, keypair); mockQueryRepository.addQueryResult(queryResult); FindKeypairsRequest findKeypairsRequest = requestProvider.get(FindKeypairsRequest.class); List<FindKeypairsResult> keypairs = projectsRepository.findKeypairs(findKeypairsRequest); assertThat(keypairs, hasSize(1)); FindKeypairsResult result = keypairs.get(0); assertThat(result.getName(), equalTo(keypair.getName())); assertThat(result.getFingerprint(), equalTo(keypair.getFingerprint())); assertThat(result.getProjectName(), equalTo(project.getName())); }