@Test(expected = XdsbRepositoryAdapterException.class)
public void testFilterByPatientAndAuthor()
		throws XdsbRepositoryAdapterException, DocumentAccessorException {

	RetrieveDocumentSetResponse response = mock(RetrieveDocumentSetResponse.class);
	String patientId = "1";
	String authorNPI = "2";
	DocumentResponse docResponse1 = mock(DocumentResponse.class);
	DocumentResponse docResponse2 = mock(DocumentResponse.class);
	Node nodeMock = mock(Node.class);
	Document documentMock = mock(Document.class);
	byte[] document1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\r\n    xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n    exclude-result-prefixes=\"xs\"\r\n    xmlns:hl7=\"urn:hl7-org:v3\"\r\n    version=\"2.0\">\r\n    <xsl:output method=\"xml\" version=\"1.0\" indent=\"yes\" encoding=\"UTF-8\"/>   \r\n <xsl:template match=\"/\">\r\n    \r\n     <urn:PRPA_IN201301UV02 xmlns:urn=\"urn:hl7-org:v3\"  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"urn:hl7-org:v3 ../schema/HL7V3/NE2008/multicacheschemas/PRPA_IN201301UV02.xsd\"\r\n         xmlns=\"urn:hl7-org:v3\" ITSVersion=\"XML_1.0\">\r\n         <urn:id root=\"21acf7be-007c-41e6-b176-d0969794983b\"/>\r\n         <urn:creationTime value=\"20091112115139\"/>\r\n         <urn:interactionId extension=\"PRPA_IN201301UV02\" root=\"2.16.840.1.113883.1.6\"/>\r\n         <urn:processingCode code=\"P\"/>\r\n         <urn:processingModeCode code=\"T\"/>\r\n         <urn:acceptAckCode code=\"AL\"/>\r\n         <urn:receiver typeCode=\"RCV\">\r\n             <urn:device classCode=\"DEV\" determinerCode=\"INSTANCE\">\r\n                 <urn:id root=\"1.2.840.114350.1.13.99999.4567\"/>\r\n                 <urn:asAgent classCode=\"AGNT\">\r\n                     <urn:representedOrganization determinerCode=\"INSTANCE\" classCode=\"ORG\">\r\n                         <urn:id root=\"1.2.840.114350.1.13.99999.1234\"/>\r\n                     </urn:representedOrganization>\r\n                 </urn:asAgent>\r\n             </urn:device>\r\n         </urn:receiver>\r\n         <urn:sender typeCode=\"SND\">\r\n             <urn:device classCode=\"DEV\" determinerCode=\"INSTANCE\">\r\n                 <urn:id root=\"1.2.840.114350.1.13.99998.8734\"/>\r\n                 <urn:asAgent classCode=\"AGNT\">\r\n                     <urn:representedOrganization determinerCode=\"INSTANCE\" classCode=\"ORG\">\r\n                         <urn:id root=\"1.2.840.114350.1.13.99998\"/>\r\n                     </urn:representedOrganization>\r\n                 </urn:asAgent>\r\n             </urn:device>\r\n         </urn:sender>\r\n         <urn:controlActProcess classCode=\"CACT\" moodCode=\"EVN\">\r\n             <urn:code code=\"PRPA_TE201301UV02\" codeSystem=\"2.16.840.1.113883.1.6\"/>\r\n             <urn:subject typeCode=\"SUBJ\">\r\n                 <urn:registrationEvent classCode=\"REG\" moodCode=\"EVN\">\r\n                     <urn:id nullFlavor=\"NA\"/>\r\n                     <urn:statusCode code=\"active\"/>\r\n                     <urn:subject1 typeCode=\"SBJ\">\r\n                         <urn:patient classCode=\"PAT\">\r\n                             <urn:id extension=\"{/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:id/@extension}\" assigningAuthorityName=\"NIST2010\" root=\"2.16.840.1.113883.3.72.5.9.1\"/>\r\n                             <urn:statusCode code=\"active\"/>\r\n                             <urn:patientPerson>\r\n                                 <urn:name>\r\n                                     <urn:given><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:patient/hl7:name/hl7:given\"/></urn:given>\r\n                                     <urn:family><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:patient/hl7:name/hl7:family\"/></urn:family>\r\n                                 </urn:name>\r\n                                 <urn:telecom use=\"H\" value=\"tel:610-220-4354\"/>\r\n                                 <urn:administrativeGenderCode code=\"{/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:patient/hl7:administrativeGenderCode/@code}\"/>\r\n                                 <urn:birthTime value=\"{/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:patient/hl7:birthTime/@value}\"/>\r\n                                 <urn:addr>\r\n                                     <urn:streetAddressLine><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:addr/hl7:streetAddressLine\"/></urn:streetAddressLine>\r\n                                     <urn:city><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:addr/hl7:city\"/></urn:city>\r\n                                     <urn:state><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:addr/hl7:state\"/></urn:state>\r\n                                     <urn:postalCode><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:addr/hl7:postalCode\"/></urn:postalCode>\r\n                                 </urn:addr>\r\n                                 <urn:asOtherIDs classCode=\"CIT\">\r\n                                     <urn:id root=\"2.16.840.1.113883.4.1\" extension=\"197-18-9761\"/>\r\n                                     <urn:scopingOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\">\r\n                                         <urn:id root=\"2.16.840.1.113883.4.1\"/>\r\n                                     </urn:scopingOrganization>\r\n                                 </urn:asOtherIDs>\r\n                                 <urn:personalRelationship classCode=\"PRS\">\r\n                                     <urn:code codeSystem=\"2.16.840.1.113883.5.111\" codeSystemName=\"PersonalRelationshipRoleType\" code=\"MTH\" displayName=\"Mother\"/>\r\n                                     <urn:relationshipHolder1 classCode=\"PSN\" determinerCode=\"INSTANCE\">\r\n                                     </urn:relationshipHolder1>\r\n                                 </urn:personalRelationship>\r\n                             </urn:patientPerson>\r\n                             <urn:providerOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\">\r\n                                 <urn:id root=\"1.2.840.114350.1.13.99998.8734\"/>\r\n                                 <urn:contactParty classCode=\"CON\"/>\r\n                             </urn:providerOrganization>\r\n                         </urn:patient>\r\n                     </urn:subject1>\r\n                     <urn:custodian typeCode=\"CST\">\r\n                         <urn:assignedEntity classCode=\"ASSIGNED\">\r\n                             <urn:id root=\"1.2.840.114350.1.13.99998.8734\"/>\r\n                         </urn:assignedEntity>\r\n                     </urn:custodian>\r\n                 </urn:registrationEvent>\r\n             </urn:subject>\r\n         </urn:controlActProcess>\r\n     </urn:PRPA_IN201301UV02>\r\n     \r\n </xsl:template>   \r\n    \r\n    \r\n    \r\n</xsl:stylesheet>"
			.getBytes();
	byte[] document2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\r\n    xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n    exclude-result-prefixes=\"xs\"\r\n    xmlns:hl7=\"urn:hl7-org:v3\"\r\n    version=\"2.0\">\r\n    <xsl:output method=\"xml\" version=\"1.0\" indent=\"yes\" encoding=\"UTF-8\"/>   \r\n <xsl:template match=\"/\">\r\n    \r\n     <urn:PRPA_IN201301UV02 xmlns:urn=\"urn:hl7-org:v3\"  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"urn:hl7-org:v3 ../schema/HL7V3/NE2008/multicacheschemas/PRPA_IN201301UV02.xsd\"\r\n         xmlns=\"urn:hl7-org:v3\" ITSVersion=\"XML_1.0\">\r\n         <urn:id root=\"21acf7be-007c-41e6-b176-d0969794983b\"/>\r\n         <urn:creationTime value=\"20091112115139\"/>\r\n         <urn:interactionId extension=\"PRPA_IN201301UV02\" root=\"2.16.840.1.113883.1.6\"/>\r\n         <urn:processingCode code=\"P\"/>\r\n         <urn:processingModeCode code=\"T\"/>\r\n         <urn:acceptAckCode code=\"AL\"/>\r\n         <urn:receiver typeCode=\"RCV\">\r\n             <urn:device classCode=\"DEV\" determinerCode=\"INSTANCE\">\r\n                 <urn:id root=\"1.2.840.114350.1.13.99999.4567\"/>\r\n                 <urn:asAgent classCode=\"AGNT\">\r\n                     <urn:representedOrganization determinerCode=\"INSTANCE\" classCode=\"ORG\">\r\n                         <urn:id root=\"1.2.840.114350.1.13.99999.1234\"/>\r\n                     </urn:representedOrganization>\r\n                 </urn:asAgent>\r\n             </urn:device>\r\n         </urn:receiver>\r\n         <urn:sender typeCode=\"SND\">\r\n             <urn:device classCode=\"DEV\" determinerCode=\"INSTANCE\">\r\n                 <urn:id root=\"1.2.840.114350.1.13.99998.8734\"/>\r\n                 <urn:asAgent classCode=\"AGNT\">\r\n                     <urn:representedOrganization determinerCode=\"INSTANCE\" classCode=\"ORG\">\r\n                         <urn:id root=\"1.2.840.114350.1.13.99998\"/>\r\n                     </urn:representedOrganization>\r\n                 </urn:asAgent>\r\n             </urn:device>\r\n         </urn:sender>\r\n         <urn:controlActProcess classCode=\"CACT\" moodCode=\"EVN\">\r\n             <urn:code code=\"PRPA_TE201301UV02\" codeSystem=\"2.16.840.1.113883.1.6\"/>\r\n             <urn:subject typeCode=\"SUBJ\">\r\n                 <urn:registrationEvent classCode=\"REG\" moodCode=\"EVN\">\r\n                     <urn:id nullFlavor=\"NA\"/>\r\n                     <urn:statusCode code=\"active\"/>\r\n                     <urn:subject1 typeCode=\"SBJ\">\r\n                         <urn:patient classCode=\"PAT\">\r\n                             <urn:id extension=\"{/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:id/@extension}\" assigningAuthorityName=\"NIST2010\" root=\"2.16.840.1.113883.3.72.5.9.1\"/>\r\n                             <urn:statusCode code=\"active\"/>\r\n                             <urn:patientPerson>\r\n                                 <urn:name>\r\n                                     <urn:given><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:patient/hl7:name/hl7:given\"/></urn:given>\r\n                                     <urn:family><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:patient/hl7:name/hl7:family\"/></urn:family>\r\n                                 </urn:name>\r\n                                 <urn:telecom use=\"H\" value=\"tel:610-220-4354\"/>\r\n                                 <urn:administrativeGenderCode code=\"{/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:patient/hl7:administrativeGenderCode/@code}\"/>\r\n                                 <urn:birthTime value=\"{/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:patient/hl7:birthTime/@value}\"/>\r\n                                 <urn:addr>\r\n                                     <urn:streetAddressLine><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:addr/hl7:streetAddressLine\"/></urn:streetAddressLine>\r\n                                     <urn:city><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:addr/hl7:city\"/></urn:city>\r\n                                     <urn:state><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:addr/hl7:state\"/></urn:state>\r\n                                     <urn:postalCode><xsl:value-of select=\"/hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:addr/hl7:postalCode\"/></urn:postalCode>\r\n                                 </urn:addr>\r\n                                 <urn:asOtherIDs classCode=\"CIT\">\r\n                                     <urn:id root=\"2.16.840.1.113883.4.1\" extension=\"197-18-9761\"/>\r\n                                     <urn:scopingOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\">\r\n                                         <urn:id root=\"2.16.840.1.113883.4.1\"/>\r\n                                     </urn:scopingOrganization>\r\n                                 </urn:asOtherIDs>\r\n                                 <urn:personalRelationship classCode=\"PRS\">\r\n                                     <urn:code codeSystem=\"2.16.840.1.113883.5.111\" codeSystemName=\"PersonalRelationshipRoleType\" code=\"MTH\" displayName=\"Mother\"/>\r\n                                     <urn:relationshipHolder1 classCode=\"PSN\" determinerCode=\"INSTANCE\">\r\n                                     </urn:relationshipHolder1>\r\n                                 </urn:personalRelationship>\r\n                             </urn:patientPerson>\r\n                             <urn:providerOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\">\r\n                                 <urn:id root=\"1.2.840.114350.1.13.99998.8734\"/>\r\n                                 <urn:contactParty classCode=\"CON\"/>\r\n                             </urn:providerOrganization>\r\n                         </urn:patient>\r\n                     </urn:subject1>\r\n                     <urn:custodian typeCode=\"CST\">\r\n                         <urn:assignedEntity classCode=\"ASSIGNED\">\r\n                             <urn:id root=\"1.2.840.114350.1.13.99998.8734\"/>\r\n                         </urn:assignedEntity>\r\n                     </urn:custodian>\r\n                 </urn:registrationEvent>\r\n             </urn:subject>\r\n         </urn:controlActProcess>\r\n     </urn:PRPA_IN201301UV02>\r\n     \r\n </xsl:template>   \r\n    \r\n    \r\n    \r\n</xsl:stylesheet>"
			.getBytes();
	when(docResponse1.getDocument()).thenReturn(document1);
	when(docResponse2.getDocument()).thenReturn(document2);
	when(converter.loadDocument(new String(document1))).thenThrow(
			DocumentXmlConverterException.class);
	doReturn(nodeMock).when(documentAccessor).getNode(eq(documentMock),
			anyString(), any(String[].class));
	LinkedList<DocumentResponse> docList = new LinkedList<DocumentResponse>();
	docList.add(docResponse1);
	docList.add(docResponse2);
	when(response.getDocumentResponse()).thenReturn(docList);
	retrieveDocumentSetResponseFilter.filterByPatientAndAuthor(response,
			patientId, authorNPI);
}