ValueSetCategoryServiceImpl implements ValueSetCategoryService { @Override public List<AddConsentFieldsDto> findAllValueSetCategoriesAddConsentFieldsDto() { List<ValueSetCategory> valueSetCategoryList = valueSetCategoryRepository .findAll(); List<AddConsentFieldsDto> sensitivityPolicyDto = new ArrayList<AddConsentFieldsDto>(); for (ValueSetCategory valueSetCategory : valueSetCategoryList) { AddConsentFieldsDto sensitivityPolicyDtoItem = new AddConsentFieldsDto(); sensitivityPolicyDtoItem.setCode(valueSetCategory.getCode()); sensitivityPolicyDtoItem.setDisplayName(valueSetCategory.getName()); sensitivityPolicyDtoItem.setDescription(valueSetCategory .getDescription()); sensitivityPolicyDto.add(sensitivityPolicyDtoItem); } return sensitivityPolicyDto; } 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();  }
@Test public void testFindAllValueSetCategoriesAddConsentFieldsDto() { String vscMockCode = "vscMockCode"; String vscMockName = "vscMockName"; String vscMockDescription = "vscMockDescription"; String vscMock2Code = "vscMock2Code"; String vscMock2Name = "vscMock2Name"; String vscMock2Description = "vscMock2Description"; ValueSetCategory vscMock = mock(ValueSetCategory.class); ValueSetCategory vscMock2 = mock(ValueSetCategory.class); when(vscMock.getCode()).thenReturn(vscMockCode); when(vscMock.getName()).thenReturn(vscMockName); when(vscMock.getDescription()).thenReturn(vscMockDescription); when(vscMock2.getCode()).thenReturn(vscMock2Code); when(vscMock2.getName()).thenReturn(vscMock2Name); when(vscMock2.getDescription()).thenReturn(vscMock2Description); List<ValueSetCategory> valueSetCategoryListMock = new ArrayList<ValueSetCategory>(); valueSetCategoryListMock.add(vscMock); valueSetCategoryListMock.add(vscMock2); when(valueSetCategoryRepository.findAll()).thenReturn( valueSetCategoryListMock); List<AddConsentFieldsDto> sensitivityPolicyDto = vst .findAllValueSetCategoriesAddConsentFieldsDto(); assertEquals(2, sensitivityPolicyDto.size()); assertEquals(vscMockCode, sensitivityPolicyDto.get(0).getCode()); assertEquals(vscMockName, sensitivityPolicyDto.get(0).getDisplayName()); assertEquals(vscMockDescription, sensitivityPolicyDto.get(0) .getDescription()); assertEquals(vscMock2Code, sensitivityPolicyDto.get(1).getCode()); assertEquals(vscMock2Name, sensitivityPolicyDto.get(1).getDisplayName()); assertEquals(vscMock2Description, sensitivityPolicyDto.get(1) .getDescription()); }