@Test void testQuery() { Query<Entity> q = new QueryImpl<>(); when(dataService.findAll(MAPPING_PROJECT, q)).thenReturn(Stream.of(mappingProjectEntity)); when(mappingTargetRepository.toMappingTargets(mappingTargetEntities)) .thenReturn(asList(mappingTarget1, mappingTarget2)); List<MappingProject> result = mappingProjectRepositoryImpl.getMappingProjects(q); mappingProject.setIdentifier("mappingProjectID"); assertEquals(singletonList(mappingProject), result); }
@Override public List<MappingProject> getMappingProjects(Query<Entity> q) { List<MappingProject> results = new ArrayList<>(); dataService .findAll(MAPPING_PROJECT, q) .forEach(entity -> results.add(toMappingProject(entity))); return results; }
MappingProjectRepositoryImpl implements MappingProjectRepository { @Override public List<MappingProject> getMappingProjects(Query<Entity> q) { List<MappingProject> results = new ArrayList<>(); dataService .findAll(MAPPING_PROJECT, q) .forEach(entity -> results.add(toMappingProject(entity))); return results; } }
MappingProjectRepositoryImpl implements MappingProjectRepository { @Override public List<MappingProject> getMappingProjects(Query<Entity> q) { List<MappingProject> results = new ArrayList<>(); dataService .findAll(MAPPING_PROJECT, q) .forEach(entity -> results.add(toMappingProject(entity))); return results; } MappingProjectRepositoryImpl(
      DataService dataService,
      MappingTargetRepository mappingTargetRepo,
      IdGenerator idGenerator,
      MappingProjectMetadata mappingProjectMeta); }
MappingProjectRepositoryImpl implements MappingProjectRepository { @Override public List<MappingProject> getMappingProjects(Query<Entity> q) { List<MappingProject> results = new ArrayList<>(); dataService .findAll(MAPPING_PROJECT, q) .forEach(entity -> results.add(toMappingProject(entity))); return results; } MappingProjectRepositoryImpl(
      DataService dataService,
      MappingTargetRepository mappingTargetRepo,
      IdGenerator idGenerator,
      MappingProjectMetadata mappingProjectMeta); @Override @Transactional void add(MappingProject mappingProject); @Override @Transactional void update(MappingProject mappingProject); @Override MappingProject getMappingProject(String identifier); @Override List<MappingProject> getAllMappingProjects(); @Override List<MappingProject> getMappingProjects(Query<Entity> q); @Override void delete(String mappingProjectId); }
MappingProjectRepositoryImpl implements MappingProjectRepository { @Override public List<MappingProject> getMappingProjects(Query<Entity> q) { List<MappingProject> results = new ArrayList<>(); dataService .findAll(MAPPING_PROJECT, q) .forEach(entity -> results.add(toMappingProject(entity))); return results; } MappingProjectRepositoryImpl(
      DataService dataService,
      MappingTargetRepository mappingTargetRepo,
      IdGenerator idGenerator,
      MappingProjectMetadata mappingProjectMeta); @Override @Transactional void add(MappingProject mappingProject); @Override @Transactional void update(MappingProject mappingProject); @Override MappingProject getMappingProject(String identifier); @Override List<MappingProject> getAllMappingProjects(); @Override List<MappingProject> getMappingProjects(Query<Entity> q); @Override void delete(String mappingProjectId);  }