ValueSetServiceImpl implements ValueSetService { @Override public ValueSetDto findById(Long id) throws ValueSetCategoryNotFoundException { logger.debug("Finding a ValueSet with id: " + id); ValueSet valueSet = valueSetRepository.findOne(id); ValueSetDto valueSetDto = valueSetMgmtHelper .createValuesetDtoFromEntity(valueSet); List<ValueSetCategory> valueSetCategories = valueSetCategoryRepository .findAll(); if (valueSetCategories == null || valueSetCategories.size() == 0) { logger.debug("No Valueset Categories found in the system"); throw new ValueSetCategoryNotFoundException(); } valueSetDto.setValueSetCategoryMap(valueSetMgmtHelper .convertValueSetCategoryEntitiesToMap(valueSetCategories)); return valueSetDto; } ValueSetServiceImpl(int valueSetPageSize,
			ValueSetRepository valueSetRepository,
			ValueSetCategoryRepository valueSetCategoryRepository,
			ConceptCodeValueSetRepository conceptCodeValueSetRepository,
			ValueSetMgmtHelper valueSetMgmtHelper); @Override @Transactional ValueSetDto create(ValueSetDto created); @Override @Transactional(rollbackFor = ValueSetNotFoundException.class) ValueSetDto delete(Long valueSetId); @Override ValueSetDto findById(Long id); @Override @Transactional(rollbackFor = ValueSetNotFoundException.class) ValueSetDto update(ValueSetDto updated); @Override ValueSetVSCDto create(); @Override List<ValueSetDto> findAll(); @Override List<ValueSetDto> findAllWithoutDeletable(); @Override Map<String, Object> findAll(int pageNumber); @Override Map<String, Object> findAllByName(String searchTerm,
			String valueSetCategory, int pageNumber); @Override Map<String, Object> findAllByCode(String searchTerm,
			String valueSetCategory, int pageNumber); @Override @Transactional(rollbackFor = DataIntegrityViolationException.class) ValueSetDto valueSetBatchUpload(ValueSetDto valueSetDto,
			MultipartFile file);  }
@Test(expected = ValueSetCategoryNotFoundException.class) public void testfindId() throws ValueSetCategoryNotFoundException { ValueSet valueSet = mock(ValueSet.class); when(valueSetRepository.findOne(anyLong())).thenReturn(valueSet); ValueSetDto valueSetDto = mock(ValueSetDto.class); when(valueSetMgmtHelper.createValuesetDtoFromEntity(valueSet)) .thenReturn(valueSetDto); assertEquals(vst.findById((long) 1), valueSetDto); }