@Test public void testDeleteValueSetCategory() throws ValueSetCategoryNotFoundException { ValueSetCategory deleted = mock(ValueSetCategory.class); when(valueSetCategoryRepository.findOne(anyLong())).thenReturn(deleted); when( consentRepositoryMock .findAllByDoNotShareSensitivityPolicyCodesValueSetCategory(deleted)) .thenReturn(null); ValueSetCategoryDto valueSetCategoryDto = mock(ValueSetCategoryDto.class); when( valueSetMgmtHelper.createValuesetCategoryDtoFromEntity(deleted, consentRepositoryMock)).thenReturn(valueSetCategoryDto); Assert.assertEquals(vst.delete((long) 1), valueSetCategoryDto); }
@Override @Transactional(rollbackFor = ValueSetCategoryNotFoundException.class) public ValueSetCategoryDto delete(Long valueSetCategoryId) throws ValueSetCategoryNotFoundException { logger.debug("Deleting ValueSetCategory with id: " + valueSetCategoryId); ValueSetCategory deleted = valueSetCategoryRepository .findOne(valueSetCategoryId); if (deleted == null) { logger.debug("No ValueSetCategory found with an id: " + valueSetCategoryId); throw new ValueSetCategoryNotFoundException(); } valueSetCategoryRepository.delete(deleted); return valueSetMgmtHelper.createValuesetCategoryDtoFromEntity(deleted, consentRepository); }
ValueSetCategoryServiceImpl implements ValueSetCategoryService { @Override @Transactional(rollbackFor = ValueSetCategoryNotFoundException.class) public ValueSetCategoryDto delete(Long valueSetCategoryId) throws ValueSetCategoryNotFoundException { logger.debug("Deleting ValueSetCategory with id: " + valueSetCategoryId); ValueSetCategory deleted = valueSetCategoryRepository .findOne(valueSetCategoryId); if (deleted == null) { logger.debug("No ValueSetCategory found with an id: " + valueSetCategoryId); throw new ValueSetCategoryNotFoundException(); } valueSetCategoryRepository.delete(deleted); return valueSetMgmtHelper.createValuesetCategoryDtoFromEntity(deleted, consentRepository); } }
ValueSetCategoryServiceImpl implements ValueSetCategoryService { @Override @Transactional(rollbackFor = ValueSetCategoryNotFoundException.class) public ValueSetCategoryDto delete(Long valueSetCategoryId) throws ValueSetCategoryNotFoundException { logger.debug("Deleting ValueSetCategory with id: " + valueSetCategoryId); ValueSetCategory deleted = valueSetCategoryRepository .findOne(valueSetCategoryId); if (deleted == null) { logger.debug("No ValueSetCategory found with an id: " + valueSetCategoryId); throw new ValueSetCategoryNotFoundException(); } valueSetCategoryRepository.delete(deleted); return valueSetMgmtHelper.createValuesetCategoryDtoFromEntity(deleted, consentRepository); } ValueSetCategoryServiceImpl(
			ValueSetCategoryRepository valueSetCategoryRepository,
			ConsentRepository consentRepository,
			ValueSetMgmtHelper valueSetMgmtHelper); }
ValueSetCategoryServiceImpl implements ValueSetCategoryService { @Override @Transactional(rollbackFor = ValueSetCategoryNotFoundException.class) public ValueSetCategoryDto delete(Long valueSetCategoryId) throws ValueSetCategoryNotFoundException { logger.debug("Deleting ValueSetCategory with id: " + valueSetCategoryId); ValueSetCategory deleted = valueSetCategoryRepository .findOne(valueSetCategoryId); if (deleted == null) { logger.debug("No ValueSetCategory found with an id: " + valueSetCategoryId); throw new ValueSetCategoryNotFoundException(); } valueSetCategoryRepository.delete(deleted); return valueSetMgmtHelper.createValuesetCategoryDtoFromEntity(deleted, consentRepository); } ValueSetCategoryServiceImpl(
			ValueSetCategoryRepository valueSetCategoryRepository,
			ConsentRepository consentRepository,
			ValueSetMgmtHelper valueSetMgmtHelper); @Override @Transactional ValueSetCategoryDto create(ValueSetCategoryDto created); @Override @Transactional(rollbackFor = ValueSetCategoryNotFoundException.class) ValueSetCategoryDto delete(Long valueSetCategoryId); @Override List<ValueSetCategoryDto> findAll(); @Override ValueSetCategoryDto findById(Long id); @Override @Transactional(rollbackFor = ValueSetCategoryNotFoundException.class) ValueSetCategoryDto update(ValueSetCategoryDto updated); @Override List<AddConsentFieldsDto> findAllValueSetCategoriesAddConsentFieldsDto(); }
ValueSetCategoryServiceImpl implements ValueSetCategoryService { @Override @Transactional(rollbackFor = ValueSetCategoryNotFoundException.class) public ValueSetCategoryDto delete(Long valueSetCategoryId) throws ValueSetCategoryNotFoundException { logger.debug("Deleting ValueSetCategory with id: " + valueSetCategoryId); ValueSetCategory deleted = valueSetCategoryRepository .findOne(valueSetCategoryId); if (deleted == null) { logger.debug("No ValueSetCategory found with an id: " + valueSetCategoryId); throw new ValueSetCategoryNotFoundException(); } valueSetCategoryRepository.delete(deleted); return valueSetMgmtHelper.createValuesetCategoryDtoFromEntity(deleted, consentRepository); } ValueSetCategoryServiceImpl(
			ValueSetCategoryRepository valueSetCategoryRepository,
			ConsentRepository consentRepository,
			ValueSetMgmtHelper valueSetMgmtHelper); @Override @Transactional ValueSetCategoryDto create(ValueSetCategoryDto created); @Override @Transactional(rollbackFor = ValueSetCategoryNotFoundException.class) ValueSetCategoryDto delete(Long valueSetCategoryId); @Override List<ValueSetCategoryDto> findAll(); @Override ValueSetCategoryDto findById(Long id); @Override @Transactional(rollbackFor = ValueSetCategoryNotFoundException.class) ValueSetCategoryDto update(ValueSetCategoryDto updated); @Override List<AddConsentFieldsDto> findAllValueSetCategoriesAddConsentFieldsDto();  }