@Test public void testFindAll() { Query q = new QueryImpl(); q.eq(OWNER, "flup"); when(dataService.findAll(ENTITY_NAME)).thenReturn(Stream.of(mappingProjectEntity)); when(userService.getUser("flup")).thenReturn(owner); when(mappingTargetRepository.toMappingTargets(mappingTargetEntities)) .thenReturn(asList(mappingTarget1, mappingTarget2)); List<MappingProject> result = mappingProjectRepositoryImpl.getAllMappingProjects(); mappingProject.setIdentifier("mappingProjectID"); assertEquals(result, asList(mappingProject)); }