@SuppressWarnings("unchecked") @Test public void testBuildConsent2Cdar2_ConsentGenException() throws ConsentGenException { thrown.expect(ConsentGenException.class); final long consentId = 1; final String cdar2XslUrlStrMock = "cdar2XslUrlStrMock"; final ConsentDto consentDtoMock = mock(ConsentDto.class); when(consentDtoFactoryMock.createConsentDto(anyLong())).thenReturn( consentDtoMock); when(xacmlXslUrlProvider.getUrl(XslResource.CDAR2XSLNAME)).thenReturn( cdar2XslUrlStrMock); when( xmlTransformerMock.transform(eq(consentDtoMock), eq(cdar2XslUrlStrMock), isA(Optional.class), isA(Optional.class))).thenThrow( new RuntimeException("Error in saxon transform")); sut.buildConsent2Cdar2(consentId); }
@Override public String buildConsent2Cdar2(long consentId) throws ConsentGenException { try { final ConsentDto consentDto = consentDtoFactory .createConsentDto(consentId); final String cdar2 = xmlTransformer.transform(consentDto, xacmlXslUrlProvider.getUrl(XslResource.CDAR2XSLNAME), Optional.empty(), Optional.empty()); return cdar2; } catch (final Exception e) { throw new ConsentGenException(e.getMessage(), e); } }
ConsentBuilderImpl implements ConsentBuilder { @Override public String buildConsent2Cdar2(long consentId) throws ConsentGenException { try { final ConsentDto consentDto = consentDtoFactory .createConsentDto(consentId); final String cdar2 = xmlTransformer.transform(consentDto, xacmlXslUrlProvider.getUrl(XslResource.CDAR2XSLNAME), Optional.empty(), Optional.empty()); return cdar2; } catch (final Exception e) { throw new ConsentGenException(e.getMessage(), e); } } }
ConsentBuilderImpl implements ConsentBuilder { @Override public String buildConsent2Cdar2(long consentId) throws ConsentGenException { try { final ConsentDto consentDto = consentDtoFactory .createConsentDto(consentId); final String cdar2 = xmlTransformer.transform(consentDto, xacmlXslUrlProvider.getUrl(XslResource.CDAR2XSLNAME), Optional.empty(), Optional.empty()); return cdar2; } 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 buildConsent2Cdar2(long consentId) throws ConsentGenException { try { final ConsentDto consentDto = consentDtoFactory .createConsentDto(consentId); final String cdar2 = xmlTransformer.transform(consentDto, xacmlXslUrlProvider.getUrl(XslResource.CDAR2XSLNAME), Optional.empty(), Optional.empty()); return cdar2; } 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 buildConsent2Cdar2(long consentId) throws ConsentGenException { try { final ConsentDto consentDto = consentDtoFactory .createConsentDto(consentId); final String cdar2 = xmlTransformer.transform(consentDto, xacmlXslUrlProvider.getUrl(XslResource.CDAR2XSLNAME), Optional.empty(), Optional.empty()); return cdar2; } 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; }