@Test void testAdd() { when(idGenerator.generateId()).thenReturn("mappingProjectID"); when(mappingTargetRepository.upsert(asList(mappingTarget1, mappingTarget2))) .thenReturn(mappingTargetEntities); mappingProjectRepositoryImpl.add(mappingProject); ArgumentCaptor<DynamicEntity> argumentCaptor = ArgumentCaptor.forClass(DynamicEntity.class); Mockito.verify(dataService).add(eq(MAPPING_PROJECT), argumentCaptor.capture()); assertEquals("mappingProjectID", argumentCaptor.getValue().getString(IDENTIFIER)); assertNull(mappingTarget1.getIdentifier()); assertNull(mappingTarget2.getIdentifier()); }
@Override @Transactional public void add(MappingProject mappingProject) { if (mappingProject.getIdentifier() != null) { throw new MolgenisDataException("MappingProject already exists"); } dataService.add(MAPPING_PROJECT, toEntity(mappingProject)); }
MappingProjectRepositoryImpl implements MappingProjectRepository { @Override @Transactional public void add(MappingProject mappingProject) { if (mappingProject.getIdentifier() != null) { throw new MolgenisDataException("MappingProject already exists"); } dataService.add(MAPPING_PROJECT, toEntity(mappingProject)); } }
MappingProjectRepositoryImpl implements MappingProjectRepository { @Override @Transactional public void add(MappingProject mappingProject) { if (mappingProject.getIdentifier() != null) { throw new MolgenisDataException("MappingProject already exists"); } dataService.add(MAPPING_PROJECT, toEntity(mappingProject)); } MappingProjectRepositoryImpl(
      DataService dataService,
      MappingTargetRepository mappingTargetRepo,
      IdGenerator idGenerator,
      MappingProjectMetadata mappingProjectMeta); }
MappingProjectRepositoryImpl implements MappingProjectRepository { @Override @Transactional public void add(MappingProject mappingProject) { if (mappingProject.getIdentifier() != null) { throw new MolgenisDataException("MappingProject already exists"); } dataService.add(MAPPING_PROJECT, toEntity(mappingProject)); } 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 @Transactional public void add(MappingProject mappingProject) { if (mappingProject.getIdentifier() != null) { throw new MolgenisDataException("MappingProject already exists"); } dataService.add(MAPPING_PROJECT, toEntity(mappingProject)); } 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);  }