SpiritClientHelper { public EhrPatientClientDto convertFromPatientDto(PatientDto patientDto, boolean isBasic, EhrPatientClientDto eClientDto) { if (null == eClientDto) eClientDto = new EhrPatientClientDto(); eClientDto.setFamilyName(patientDto.getLastName()); eClientDto.setGivenName(patientDto.getFirstName()); eClientDto.setCountry(patientDto.getCountry()); eClientDto.setSex(patientDto.getGenderCode()); eClientDto.setBirthdate(patientDto.getBirthDate().toString()); setSsn(eClientDto, patientDto); if (!isBasic) { eClientDto.setEmailHome(patientDto.getEmailHome()); eClientDto.setStreetAddress(patientDto.getStreetAddress()); eClientDto.setCity(patientDto.getCity()); eClientDto.setState(patientDto.getState()); eClientDto.setZip(patientDto.getZip()); eClientDto.setHomePhone(patientDto.getHomePhone()); eClientDto.setMaritalStatus(patientDto.getMaritalStatus()); eClientDto.setReligion(patientDto.getReligion()); eClientDto.setRace(patientDto.getRace()); eClientDto.setLanguage(patientDto.getLanguage()); } return eClientDto; }  EhrPatientClientDto convertFromPatientDto(PatientDto patientDto,
			boolean isBasic, EhrPatientClientDto eClientDto); PatientDto convertFromEhrPatientClientDto(
			EhrPatientRsp patientResponse, PatientDto patientDto); String createC2SLocalIdentifier(String c2sEnvType); List<EhrPIDClientDto> createPIDList(String patientId,
			String domainId, String domainIdType);  }
@Test public void testConvertFromPatientDto() { EhrPatientClientDto eClientDto = new EhrPatientClientDto(); PatientDto patientDto = mock(PatientDto.class); when(patientDto.getLastName()).thenReturn("lastname"); when(patientDto.getFirstName()).thenReturn("firstname"); when(patientDto.getCountry()).thenReturn("usa"); when(patientDto.getGenderCode()).thenReturn("M"); when(patientDto.getBirthDate()).thenReturn("19970101"); when(patientDto.getEmailHome()).thenReturn("myemail@mail.com"); when(patientDto.getStreetAddress()).thenReturn("streetaddress"); when(patientDto.getCity()).thenReturn("columbia"); when(patientDto.getState()).thenReturn("MD"); when(patientDto.getZip()).thenReturn("21046"); when(patientDto.getHomePhone()).thenReturn("4431111111"); when(patientDto.getSsnNumber()).thenReturn("777-777-7777"); when(patientDto.getMaritalStatus()).thenReturn("married"); when(patientDto.getReligion()).thenReturn("religion"); when(patientDto.getRace()).thenReturn("race"); when(patientDto.getLanguage()).thenReturn("english"); helper.convertFromPatientDto(patientDto, false, eClientDto); assertEquals("lastname", eClientDto.getFamilyName()); assertEquals("firstname", eClientDto.getGivenName()); assertEquals("usa", eClientDto.getCountry()); assertEquals("M", eClientDto.getSex()); assertEquals("19970101", eClientDto.getBirthdate()); assertEquals("myemail@mail.com", eClientDto.getEmailHome()); assertEquals("streetaddress", eClientDto.getStreetAddress()); assertEquals("columbia", eClientDto.getCity()); assertEquals("MD", eClientDto.getState()); assertEquals("21046", eClientDto.getZip()); assertEquals("4431111111", eClientDto.getHomePhone()); assertEquals("777-777-7777", eClientDto.getPid().get(0).getPatientID()); assertEquals("married", eClientDto.getMaritalStatus()); assertEquals("religion", eClientDto.getReligion()); assertEquals("race", eClientDto.getRace()); assertEquals("english", eClientDto.getLanguage()); }
@Test public void testConvertFromPatientDto_basic() { EhrPatientClientDto eClientDto = new EhrPatientClientDto(); PatientDto patientDto = mock(PatientDto.class); when(patientDto.getLastName()).thenReturn("lastname"); when(patientDto.getFirstName()).thenReturn("firstname"); when(patientDto.getCountry()).thenReturn("usa"); when(patientDto.getGenderCode()).thenReturn("M"); when(patientDto.getBirthDate()).thenReturn("19970101"); when(patientDto.getEmailHome()).thenReturn("myemail@mail.com"); when(patientDto.getStreetAddress()).thenReturn("streetaddress"); when(patientDto.getCity()).thenReturn("columbia"); when(patientDto.getState()).thenReturn("MD"); when(patientDto.getZip()).thenReturn("21046"); when(patientDto.getHomePhone()).thenReturn("4431111111"); when(patientDto.getSsnNumber()).thenReturn("777-777-7777"); when(patientDto.getMaritalStatus()).thenReturn("married"); when(patientDto.getReligion()).thenReturn("religion"); when(patientDto.getRace()).thenReturn("race"); when(patientDto.getLanguage()).thenReturn("english"); helper.convertFromPatientDto(patientDto, true, eClientDto); assertEquals("lastname", eClientDto.getFamilyName()); assertEquals("firstname", eClientDto.getGivenName()); assertEquals("usa", eClientDto.getCountry()); assertEquals("M", eClientDto.getSex()); assertEquals("19970101", eClientDto.getBirthdate()); assertEquals(null, eClientDto.getStreetAddress()); assertEquals(null, eClientDto.getCity()); assertEquals(null, eClientDto.getState()); assertEquals(null, eClientDto.getZip()); assertEquals(null, eClientDto.getHomePhone()); assertEquals("777-777-7777", eClientDto.getPid().get(0).getPatientID()); assertEquals(null, eClientDto.getMaritalStatus()); assertEquals(null, eClientDto.getReligion()); assertEquals(null, eClientDto.getRace()); assertEquals(null, eClientDto.getLanguage()); }