@Test
public void testProvideAndRegisterClinicalDocument() throws JAXBException,
		IOException, Hl7v3TransformerException {

	// Arrange
	final String c32XmlMock = "c32XmlMock";
	final String hl7v3Xml = "hl7v3Xml";
	final String eidMock = "eidMock";
	final PRPAIN201309UV02 mockPRPAIN201309UV02 = new PRPAIN201309UV02();
	final PRPAIN201310UV02 mockPRPAIN201310UV02 = new PRPAIN201310UV02();
	final PixManagerBean pixManagerBeanMock = new PixManagerBean();
	final HashMap<String, String> queryMap = new HashMap<String, String>();
	queryMap.put(PixManagerConstants.GLOBAL_DOMAIN_ID, eidMock);
	final RegistryResponse registryResponseMock = new RegistryResponse();
	pixManagerBeanMock.setQueryIdMap(queryMap);
	sut.setPixManagerTransformService(pixManagerTransformServiceMock);
	sut.setXdsbRegistryGetter(xdsbRegistryGetterMock);
	sut.setPixMgrService(pixMgrServiceMock);
	sut.setXdsbRepository(xdsbRepositoryMock);
	sut.setXmlAttributeSetter(xmlAttributeSetter);
	sut.setRequestXMLToJava(requestXMLToJavaMock);
	when(
			requestXMLToJavaMock.getPIXQueryReqObject(hl7v3Xml,
					PixManagerConstants.ENCODE_STRING)).thenReturn(
			mockPRPAIN201309UV02);
	when(pixMgrServiceMock.pixManagerPRPAIN201309UV02(mockPRPAIN201309UV02))
			.thenReturn(mockPRPAIN201310UV02);
	when(pixManagerTransformServiceMock.getPixQueryXml(c32XmlMock))
			.thenReturn(hl7v3Xml);
	when(sut.queryPerson(hl7v3Xml)).thenReturn(pixManagerBeanMock);
	when(
			xmlAttributeSetter.setAttributeValue(eq(c32XmlMock),
					anyString(), anyString(), anyString()))
			.thenReturn(c32XmlMock).thenReturn(c32XmlMock)
			.thenReturn(c32XmlMock).thenReturn(c32XmlMock)
			.thenReturn(c32XmlMock).thenReturn(c32XmlMock);
	when(
			xdsbRepositoryMock.provideAndRegisterDocumentSet(c32XmlMock,
					PixManagerConstants.GLOBAL_DOMAIN_ID,
					XdsbDocumentType.CLINICAL_DOCUMENT)).thenReturn(
			registryResponseMock);
	// Act
	final RegistryResponse actualResponse = sut
			.provideAndRegisterClinicalDocument(c32XmlMock);
	// Assert
	assertEquals(registryResponseMock, actualResponse);
}