@SuppressWarnings("unchecked") @Test public void testBuildConsent2Xacml() throws ConsentGenException { final String mrnMock = "mrnMock"; final Long consentId = new Long(1); final ConsentDto consentDtoMock = mock(ConsentDto.class); final PatientDto patientDtoMock = mock(PatientDto.class); when(consentDtoFactoryMock.createConsentDto(consentId)).thenReturn( consentDtoMock); when(consentDtoMock.getPatientDto()).thenReturn(patientDtoMock); when(patientDtoMock.getMedicalRecordNumber()).thenReturn(mrnMock); final String xacmlMock = "xacml"; final String xacmlXslUrl = "xacmlXslUrl"; when(xacmlXslUrlProvider.getUrl(XslResource.XACMLXSLNAME)).thenReturn( xacmlXslUrl); when( xmlTransformerMock.transform(eq(consentDtoMock), eq(xacmlXslUrl), isA(Optional.class), isA(Optional.class))).thenReturn(xacmlMock); final String xacml = sut.buildConsent2Xacml(consentId); assertEquals(xacmlMock, xacml); }
@Override public String buildConsent2Xacml(Object obj) throws ConsentGenException { try { final ConsentDto consentDto = consentDtoFactory .createConsentDto(obj); final String xacml = xmlTransformer.transform(consentDto, xacmlXslUrlProvider.getUrl(XslResource.XACMLXSLNAME), Optional.of(ParamsBuilder.withParam(PARAM_MRN, consentDto .getPatientDto().getMedicalRecordNumber())), Optional.empty()); return xacml; } catch (final Exception e) { throw new ConsentGenException(e.getMessage(), e); } }
ConsentBuilderImpl implements ConsentBuilder { @Override public String buildConsent2Xacml(Object obj) throws ConsentGenException { try { final ConsentDto consentDto = consentDtoFactory .createConsentDto(obj); final String xacml = xmlTransformer.transform(consentDto, xacmlXslUrlProvider.getUrl(XslResource.XACMLXSLNAME), Optional.of(ParamsBuilder.withParam(PARAM_MRN, consentDto .getPatientDto().getMedicalRecordNumber())), Optional.empty()); return xacml; } catch (final Exception e) { throw new ConsentGenException(e.getMessage(), e); } } }
ConsentBuilderImpl implements ConsentBuilder { @Override public String buildConsent2Xacml(Object obj) throws ConsentGenException { try { final ConsentDto consentDto = consentDtoFactory .createConsentDto(obj); final String xacml = xmlTransformer.transform(consentDto, xacmlXslUrlProvider.getUrl(XslResource.XACMLXSLNAME), Optional.of(ParamsBuilder.withParam(PARAM_MRN, consentDto .getPatientDto().getMedicalRecordNumber())), Optional.empty()); return xacml; } catch (final Exception e) { throw new ConsentGenException(e.getMessage(), e); } } ConsentBuilderImpl(String c2sAccountOrg,
			XacmlXslUrlProvider xacmlXslUrlProvider,
			ConsentDtoFactory consentDtoFactory, XmlTransformer xmlTransformer); }
ConsentBuilderImpl implements ConsentBuilder { @Override public String buildConsent2Xacml(Object obj) throws ConsentGenException { try { final ConsentDto consentDto = consentDtoFactory .createConsentDto(obj); final String xacml = xmlTransformer.transform(consentDto, xacmlXslUrlProvider.getUrl(XslResource.XACMLXSLNAME), Optional.of(ParamsBuilder.withParam(PARAM_MRN, consentDto .getPatientDto().getMedicalRecordNumber())), Optional.empty()); return xacml; } catch (final Exception e) { throw new ConsentGenException(e.getMessage(), e); } } ConsentBuilderImpl(String c2sAccountOrg,
			XacmlXslUrlProvider xacmlXslUrlProvider,
			ConsentDtoFactory consentDtoFactory, XmlTransformer xmlTransformer); @Override String buildConsent2Cdar2(long consentId); @Override String buildConsent2Xacml(Object obj); @Override String buildConsent2XacmlPdfConsentFrom(Object obj); @Override String buildConsent2XacmlPdfConsentTo(Object obj); }
ConsentBuilderImpl implements ConsentBuilder { @Override public String buildConsent2Xacml(Object obj) throws ConsentGenException { try { final ConsentDto consentDto = consentDtoFactory .createConsentDto(obj); final String xacml = xmlTransformer.transform(consentDto, xacmlXslUrlProvider.getUrl(XslResource.XACMLXSLNAME), Optional.of(ParamsBuilder.withParam(PARAM_MRN, consentDto .getPatientDto().getMedicalRecordNumber())), Optional.empty()); return xacml; } catch (final Exception e) { throw new ConsentGenException(e.getMessage(), e); } } ConsentBuilderImpl(String c2sAccountOrg,
			XacmlXslUrlProvider xacmlXslUrlProvider,
			ConsentDtoFactory consentDtoFactory, XmlTransformer xmlTransformer); @Override String buildConsent2Cdar2(long consentId); @Override String buildConsent2Xacml(Object obj); @Override String buildConsent2XacmlPdfConsentFrom(Object obj); @Override String buildConsent2XacmlPdfConsentTo(Object obj); final static String PARAM_EID; final static String PARAM_MRN; final static String PARAM_POLICY_ID; }