@Test
 public void testAddWithIdentifier() {
   MappingProject mappingProject = new MappingProject("My first mapping project", owner);
   mappingProject.setIdentifier("mappingProjectID");
   try {
     mappingProjectRepositoryImpl.add(mappingProject);
   } catch (MolgenisDataException mde) {
     assertEquals(mde.getMessage(), "MappingProject already exists");
   }
 }
 @Test
 public void testUpdateUnknown() {
   mappingProject.setIdentifier("mappingProjectID");
   when(dataService.findOne(ENTITY_NAME, "mappingProjectID")).thenReturn(null);
   try {
     mappingProjectRepositoryImpl.update(mappingProject);
     fail("Expected exception");
   } catch (MolgenisDataException expected) {
     assertEquals(expected.getMessage(), "MappingProject does not exist");
   }
 }
 @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));
 }
  @Test
  public void testAdd() {
    when(idGenerator.generateId()).thenReturn("mappingProjectID");
    when(mappingTargetRepository.upsert(asList(mappingTarget1, mappingTarget2)))
        .thenReturn(mappingTargetEntities);

    mappingProjectRepositoryImpl.add(mappingProject);

    Mockito.verify(dataService).add(ENTITY_NAME, mappingProjectEntity);
    assertNull(mappingTarget1.getIdentifier());
    assertNull(mappingTarget2.getIdentifier());
  }
 @Test
 public void testDelete() {
   mappingProjectRepositoryImpl.delete("abc");
   verify(dataService).delete(ENTITY_NAME, "abc");
 }