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

	// Arrange
	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);
	// Act
	final String xacml = sut.buildConsent2Xacml(consentId);
	// Assert
	assertEquals(xacmlMock, xacml);
}