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

	// Arrange
	final long consentId = 1;
	final ConsentDto consentDtoMock = mock(ConsentDto.class);
	final String cdar2XslUrlStrMock = "cdar2XslUrlStrMock";
	when(consentDtoFactoryMock.createConsentDto(anyLong())).thenReturn(
			consentDtoMock);
	final String cdar2Mock = "cdar2Mock";
	when(xacmlXslUrlProvider.getUrl(XslResource.CDAR2XSLNAME)).thenReturn(
			cdar2XslUrlStrMock);
	when(
			xmlTransformerMock.transform(eq(consentDtoMock),
					eq(cdar2XslUrlStrMock), isA(Optional.class),
					isA(Optional.class))).thenReturn(cdar2Mock);
	// Act
	final String cdar2 = sut.buildConsent2Cdar2(consentId);
	// Assert
	assertEquals(cdar2Mock, cdar2);
}