CodeSystemVersionServiceImpl implements CodeSystemVersionService { @Override @Transactional(rollbackFor = CodeSystemVersionNotFoundException.class) public CodeSystemVersionDto delete(Long codeSystemVersionId) throws CodeSystemVersionNotFoundException { logger.debug("Deleting CodeSystemVersion with id: " + codeSystemVersionId); CodeSystemVersion deleted = codeSystemVersionRepository .findOne(codeSystemVersionId); if (deleted == null) { logger.debug("No CodeSystemVersion found with an id: " + codeSystemVersionId); throw new CodeSystemVersionNotFoundException(); } codeSystemVersionRepository.delete(deleted); return codeSystemVersionMgmtHelper .createCodeSystemVersionDtoFromEntity(deleted); } CodeSystemVersionServiceImpl(
			CodeSystemVersionRepository codeSystemVersionRepository,
			CodeSystemRepository codeSystemRepository,
			ValueSetMgmtHelper codeSystemVersionMgmtHelper); @Override @Transactional CodeSystemVersionDto create(CodeSystemVersionDto created); @Override @Transactional(rollbackFor = CodeSystemVersionNotFoundException.class) CodeSystemVersionDto delete(Long codeSystemVersionId); @Override List<CodeSystemVersionDto> findAll(); @Override CodeSystemVersionDto findById(Long id); @Override @Transactional(rollbackFor = CodeSystemVersionNotFoundException.class) CodeSystemVersionDto update(CodeSystemVersionDto updated); @Override CodeSystemVersionCSDto create(); @Override List<CodeSystemVersionDto> groupByCodeSystem(
			List<CodeSystemVersionDto> codeSystemVersionDtos);  }
@Test public void testDeleteCodeSystemVersion() throws CodeSystemVersionNotFoundException { CodeSystemVersion deleted = mock(CodeSystemVersion.class); when(codeSystemVersionRepository.findOne(anyLong())) .thenReturn(deleted); CodeSystemVersionDto codeSystemVersionDto = mock(CodeSystemVersionDto.class); when(valueSetMgmtHelper.createCodeSystemVersionDtoFromEntity(deleted)) .thenReturn(codeSystemVersionDto); Assert.assertEquals(vst.delete((long) 1), codeSystemVersionDto); }
@Test(expected = CodeSystemVersionNotFoundException.class) public void testDeleteCodeSystemVersion_throw_CodeSystemVersionNotFoundException() throws CodeSystemVersionNotFoundException { when(codeSystemVersionRepository.findOne(anyLong())).thenReturn(null); vst.delete((long) 1); }