@Test void testUpdateUnknown() { mappingProject.setIdentifier("mappingProjectID"); when(dataService.findOneById(TAG, "mappingProjectID")).thenReturn(null); try { mappingProjectRepositoryImpl.update(mappingProject); fail("Expected exception"); } catch (MolgenisDataException expected) { assertEquals("MappingProject does not exist", expected.getMessage()); } }
@Override @Transactional public void update(MappingProject mappingProject) { MappingProject existing = getMappingProject(mappingProject.getIdentifier()); if (existing == null) { throw new MolgenisDataException("MappingProject does not exist"); } Entity mappingProjectEntity = toEntity(mappingProject); dataService.update(MAPPING_PROJECT, mappingProjectEntity); }
MappingProjectRepositoryImpl implements MappingProjectRepository { @Override @Transactional public void update(MappingProject mappingProject) { MappingProject existing = getMappingProject(mappingProject.getIdentifier()); if (existing == null) { throw new MolgenisDataException("MappingProject does not exist"); } Entity mappingProjectEntity = toEntity(mappingProject); dataService.update(MAPPING_PROJECT, mappingProjectEntity); } }
MappingProjectRepositoryImpl implements MappingProjectRepository { @Override @Transactional public void update(MappingProject mappingProject) { MappingProject existing = getMappingProject(mappingProject.getIdentifier()); if (existing == null) { throw new MolgenisDataException("MappingProject does not exist"); } Entity mappingProjectEntity = toEntity(mappingProject); dataService.update(MAPPING_PROJECT, mappingProjectEntity); } MappingProjectRepositoryImpl(
      DataService dataService,
      MappingTargetRepository mappingTargetRepo,
      IdGenerator idGenerator,
      MappingProjectMetadata mappingProjectMeta); }
MappingProjectRepositoryImpl implements MappingProjectRepository { @Override @Transactional public void update(MappingProject mappingProject) { MappingProject existing = getMappingProject(mappingProject.getIdentifier()); if (existing == null) { throw new MolgenisDataException("MappingProject does not exist"); } Entity mappingProjectEntity = toEntity(mappingProject); dataService.update(MAPPING_PROJECT, mappingProjectEntity); } 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 update(MappingProject mappingProject) { MappingProject existing = getMappingProject(mappingProject.getIdentifier()); if (existing == null) { throw new MolgenisDataException("MappingProject does not exist"); } Entity mappingProjectEntity = toEntity(mappingProject); dataService.update(MAPPING_PROJECT, mappingProjectEntity); } 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);  }