@SuppressWarnings("unchecked")
@Test
public void testBuildConsent2Xacml_ConsentGenException()
		throws ConsentGenException {

	// Arrange
	final String mrnMock = "mrnMock";
	thrown.expect(ConsentGenException.class);
	final Long consentId = new Long(1);
	final ConsentDto consentDtoMock = mock(ConsentDto.class);
	final PatientDto patientDtoMock = mock(PatientDto.class);
	when(consentDtoMock.getPatientDto()).thenReturn(patientDtoMock);
	when(patientDtoMock.getMedicalRecordNumber()).thenReturn(mrnMock);
	when(consentDtoFactoryMock.createConsentDto(consentId)).thenReturn(
			consentDtoMock);
	final String xacmlXslUrlMock = "xacmlXslUrlMock";
	when(xacmlXslUrlProvider.getUrl(XslResource.XACMLXSLNAME)).thenReturn(
			xacmlXslUrlMock);
	when(
			xmlTransformerMock.transform(eq(consentDtoMock),
					eq(xacmlXslUrlMock), isA(Optional.class),
					isA(Optional.class))).thenThrow(
			new RuntimeException("Error in saxon transform"));
	// Act
	sut.buildConsent2Xacml(consentId);
	// Assert
}