@Test public void testFindDtoByPatientDto() { PatientProfileDto patientDto = mock(PatientProfileDto.class); Patient patient = mock(Patient.class); ClinicalDocumentDto clinicalDocumentDto = mock(ClinicalDocumentDto.class); List<ClinicalDocumentDto> dtos = Arrays.asList(clinicalDocumentDto); when(patientDto.getUsername()).thenReturn("user1"); when(patientRepository.findByUsername("user1")).thenReturn(patient); doReturn(dtos).when(sut).findDtoByPatient(patient); assertEquals(dtos, sut.findDtoByPatientDto(patientDto)); }
@Override public List<ClinicalDocumentDto> findDtoByPatientDto( PatientProfileDto patientDto) { Patient patient = patientRepository.findByUsername(patientDto .getUsername()); List<ClinicalDocumentDto> dtos = findDtoByPatient(patient); for (ClinicalDocumentDto dto : dtos) { if (dto.getClinicalDocumentTypeCode() == null) { LookupDto typeCode = new LookupDto(); typeCode.setDisplayName("Not Specified"); dto.setClinicalDocumentTypeCode(typeCode); } } return dtos; }
ClinicalDocumentServiceImpl implements ClinicalDocumentService,
		InitializingBean { @Override public List<ClinicalDocumentDto> findDtoByPatientDto( PatientProfileDto patientDto) { Patient patient = patientRepository.findByUsername(patientDto .getUsername()); List<ClinicalDocumentDto> dtos = findDtoByPatient(patient); for (ClinicalDocumentDto dto : dtos) { if (dto.getClinicalDocumentTypeCode() == null) { LookupDto typeCode = new LookupDto(); typeCode.setDisplayName("Not Specified"); dto.setClinicalDocumentTypeCode(typeCode); } } return dtos; } }
ClinicalDocumentServiceImpl implements ClinicalDocumentService,
		InitializingBean { @Override public List<ClinicalDocumentDto> findDtoByPatientDto( PatientProfileDto patientDto) { Patient patient = patientRepository.findByUsername(patientDto .getUsername()); List<ClinicalDocumentDto> dtos = findDtoByPatient(patient); for (ClinicalDocumentDto dto : dtos) { if (dto.getClinicalDocumentTypeCode() == null) { LookupDto typeCode = new LookupDto(); typeCode.setDisplayName("Not Specified"); dto.setClinicalDocumentTypeCode(typeCode); } } return dtos; } ClinicalDocumentServiceImpl(
			String maxFileSize,
			String permittedExtensions,
			ClinicalDocumentRepository clinicalDocumentRepository,
			ClinicalDocumentTypeCodeRepository clinicalDocumentTypeCodeRepository,
			ModelMapper modelMapper, PatientRepository patientRepository,
			UserContext userContext, Validator validator); }
ClinicalDocumentServiceImpl implements ClinicalDocumentService,
		InitializingBean { @Override public List<ClinicalDocumentDto> findDtoByPatientDto( PatientProfileDto patientDto) { Patient patient = patientRepository.findByUsername(patientDto .getUsername()); List<ClinicalDocumentDto> dtos = findDtoByPatient(patient); for (ClinicalDocumentDto dto : dtos) { if (dto.getClinicalDocumentTypeCode() == null) { LookupDto typeCode = new LookupDto(); typeCode.setDisplayName("Not Specified"); dto.setClinicalDocumentTypeCode(typeCode); } } return dtos; } ClinicalDocumentServiceImpl(
			String maxFileSize,
			String permittedExtensions,
			ClinicalDocumentRepository clinicalDocumentRepository,
			ClinicalDocumentTypeCodeRepository clinicalDocumentTypeCodeRepository,
			ModelMapper modelMapper, PatientRepository patientRepository,
			UserContext userContext, Validator validator); @Override void afterPropertiesSet(); @Override long countAllClinicalDocuments(); @Override void deleteClinicalDocument(ClinicalDocumentDto clinicalDocumentDto); @Override ClinicalDocument findClinicalDocument(Long id); @Override List<ClinicalDocument> findAllClinicalDocuments(); @Override List<ClinicalDocument> findClinicalDocumentEntries(int firstResult,
			int maxResults); @Override void saveClinicalDocument(ClinicalDocumentDto clinicalDocumentDto); @Override ClinicalDocument updateClinicalDocument(
			ClinicalDocument clinicalDocument); @Override ClinicalDocumentDto findClinicalDocumentDto(long documentId); @Override List<ClinicalDocument> findByPatient(Patient patient); @Override List<ClinicalDocument> findByPatientId(long patientId); @Override List<ClinicalDocumentDto> findDtoByPatientDto(
			PatientProfileDto patientDto); @Override boolean isDocumentBelongsToThisUser(
			ClinicalDocumentDto clinicalDocumentDto); @Override boolean isDocumentOversized(MultipartFile file); @Override boolean isDocumentExtensionPermitted(MultipartFile file); }
ClinicalDocumentServiceImpl implements ClinicalDocumentService,
		InitializingBean { @Override public List<ClinicalDocumentDto> findDtoByPatientDto( PatientProfileDto patientDto) { Patient patient = patientRepository.findByUsername(patientDto .getUsername()); List<ClinicalDocumentDto> dtos = findDtoByPatient(patient); for (ClinicalDocumentDto dto : dtos) { if (dto.getClinicalDocumentTypeCode() == null) { LookupDto typeCode = new LookupDto(); typeCode.setDisplayName("Not Specified"); dto.setClinicalDocumentTypeCode(typeCode); } } return dtos; } ClinicalDocumentServiceImpl(
			String maxFileSize,
			String permittedExtensions,
			ClinicalDocumentRepository clinicalDocumentRepository,
			ClinicalDocumentTypeCodeRepository clinicalDocumentTypeCodeRepository,
			ModelMapper modelMapper, PatientRepository patientRepository,
			UserContext userContext, Validator validator); @Override void afterPropertiesSet(); @Override long countAllClinicalDocuments(); @Override void deleteClinicalDocument(ClinicalDocumentDto clinicalDocumentDto); @Override ClinicalDocument findClinicalDocument(Long id); @Override List<ClinicalDocument> findAllClinicalDocuments(); @Override List<ClinicalDocument> findClinicalDocumentEntries(int firstResult,
			int maxResults); @Override void saveClinicalDocument(ClinicalDocumentDto clinicalDocumentDto); @Override ClinicalDocument updateClinicalDocument(
			ClinicalDocument clinicalDocument); @Override ClinicalDocumentDto findClinicalDocumentDto(long documentId); @Override List<ClinicalDocument> findByPatient(Patient patient); @Override List<ClinicalDocument> findByPatientId(long patientId); @Override List<ClinicalDocumentDto> findDtoByPatientDto(
			PatientProfileDto patientDto); @Override boolean isDocumentBelongsToThisUser(
			ClinicalDocumentDto clinicalDocumentDto); @Override boolean isDocumentOversized(MultipartFile file); @Override boolean isDocumentExtensionPermitted(MultipartFile file);  }