@Test public void testUpdateCodeSystem() throws CodeSystemNotFoundException { CodeSystemDto updated = mock(CodeSystemDto.class); when(updated.getId()).thenReturn((long) 1); when(updated.getCode()).thenReturn("code"); when(updated.getName()).thenReturn("name"); when(updated.getUserName()).thenReturn("username"); CodeSystem codeSystem = mock(CodeSystem.class); when(codeSystemRepository.findOne(anyLong())).thenReturn(codeSystem); CodeSystemDto codeSystemDto = mock(CodeSystemDto.class); when(valueSetMgmtHelper.createCodeSystemDtoFromEntity(codeSystem)) .thenReturn(codeSystemDto); assertEquals(vst.update(updated), codeSystemDto); }
@Override @Transactional(rollbackFor = CodeSystemNotFoundException.class) public CodeSystemDto update(CodeSystemDto updated) throws CodeSystemNotFoundException { LOGGER.debug("Updating CodeSystem with information" + updated); CodeSystem codeSystem = codeSystemRepository.findOne(updated.getId()); if (codeSystem == null) { LOGGER.debug("No CodeSystem found with an id: " + updated.getId()); throw new CodeSystemNotFoundException(); } codeSystem.update(updated.getCodeSystemOId(), updated.getCode(), updated.getName(), updated.getDisplayName(), updated.getUserName()); return valueSetMgmtHelper.createCodeSystemDtoFromEntity(codeSystem); }
CodeSystemServiceImpl implements CodeSystemService { @Override @Transactional(rollbackFor = CodeSystemNotFoundException.class) public CodeSystemDto update(CodeSystemDto updated) throws CodeSystemNotFoundException { LOGGER.debug("Updating CodeSystem with information" + updated); CodeSystem codeSystem = codeSystemRepository.findOne(updated.getId()); if (codeSystem == null) { LOGGER.debug("No CodeSystem found with an id: " + updated.getId()); throw new CodeSystemNotFoundException(); } codeSystem.update(updated.getCodeSystemOId(), updated.getCode(), updated.getName(), updated.getDisplayName(), updated.getUserName()); return valueSetMgmtHelper.createCodeSystemDtoFromEntity(codeSystem); } }
CodeSystemServiceImpl implements CodeSystemService { @Override @Transactional(rollbackFor = CodeSystemNotFoundException.class) public CodeSystemDto update(CodeSystemDto updated) throws CodeSystemNotFoundException { LOGGER.debug("Updating CodeSystem with information" + updated); CodeSystem codeSystem = codeSystemRepository.findOne(updated.getId()); if (codeSystem == null) { LOGGER.debug("No CodeSystem found with an id: " + updated.getId()); throw new CodeSystemNotFoundException(); } codeSystem.update(updated.getCodeSystemOId(), updated.getCode(), updated.getName(), updated.getDisplayName(), updated.getUserName()); return valueSetMgmtHelper.createCodeSystemDtoFromEntity(codeSystem); } CodeSystemServiceImpl(CodeSystemRepository codeSystemRepository,
			ValueSetMgmtHelper valueSetMgmtHelper); }
CodeSystemServiceImpl implements CodeSystemService { @Override @Transactional(rollbackFor = CodeSystemNotFoundException.class) public CodeSystemDto update(CodeSystemDto updated) throws CodeSystemNotFoundException { LOGGER.debug("Updating CodeSystem with information" + updated); CodeSystem codeSystem = codeSystemRepository.findOne(updated.getId()); if (codeSystem == null) { LOGGER.debug("No CodeSystem found with an id: " + updated.getId()); throw new CodeSystemNotFoundException(); } codeSystem.update(updated.getCodeSystemOId(), updated.getCode(), updated.getName(), updated.getDisplayName(), updated.getUserName()); return valueSetMgmtHelper.createCodeSystemDtoFromEntity(codeSystem); } CodeSystemServiceImpl(CodeSystemRepository codeSystemRepository,
			ValueSetMgmtHelper valueSetMgmtHelper); @Override @Transactional CodeSystemDto create(CodeSystemDto created); @Override @Transactional(rollbackFor = CodeSystemNotFoundException.class) CodeSystemDto delete(Long codeSystemId); @Override List<CodeSystemDto> findAll(); @Override CodeSystemDto findById(Long id); @Override @Transactional(rollbackFor = CodeSystemNotFoundException.class) CodeSystemDto update(CodeSystemDto updated); }
CodeSystemServiceImpl implements CodeSystemService { @Override @Transactional(rollbackFor = CodeSystemNotFoundException.class) public CodeSystemDto update(CodeSystemDto updated) throws CodeSystemNotFoundException { LOGGER.debug("Updating CodeSystem with information" + updated); CodeSystem codeSystem = codeSystemRepository.findOne(updated.getId()); if (codeSystem == null) { LOGGER.debug("No CodeSystem found with an id: " + updated.getId()); throw new CodeSystemNotFoundException(); } codeSystem.update(updated.getCodeSystemOId(), updated.getCode(), updated.getName(), updated.getDisplayName(), updated.getUserName()); return valueSetMgmtHelper.createCodeSystemDtoFromEntity(codeSystem); } CodeSystemServiceImpl(CodeSystemRepository codeSystemRepository,
			ValueSetMgmtHelper valueSetMgmtHelper); @Override @Transactional CodeSystemDto create(CodeSystemDto created); @Override @Transactional(rollbackFor = CodeSystemNotFoundException.class) CodeSystemDto delete(Long codeSystemId); @Override List<CodeSystemDto> findAll(); @Override CodeSystemDto findById(Long id); @Override @Transactional(rollbackFor = CodeSystemNotFoundException.class) CodeSystemDto update(CodeSystemDto updated);  }