@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"); } }