@Test
public void testTryPolicy() throws SimpleMarshallerException,
InvalidSegmentedClinicalDocumentException,
XmlDocumentReadFailureException, AuditException, TryPolicyException {

	// Arrange
	final String c32Xml = "c32Xml";
	final String xacmlPolicy = "xacmlPolicy";
	final String purposeOfUse = "TREATMENT";
	final PdpRequestResponse pdpRequestResponse = mock(PdpRequestResponse.class);
	final XacmlRequest xacmlRequest = mock(XacmlRequest.class);
	final XacmlResponse xacmlResponse = mock(XacmlResponse.class);
	when(xacmlRequest.getPurposeOfUse()).thenReturn(
			SubjectPurposeOfUse.HEALTHCARE_TREATMENT.getPurpose());
	when(xacmlResponse.getPdpObligation()).thenReturn(
			new ArrayList<String>());
	when(
			contextHandler.makeDecisionForTryingPolicy(xacmlPolicy,
					purposeOfUse)).thenReturn(pdpRequestResponse);
	when(pdpRequestResponse.getXacmlRequest()).thenReturn(xacmlRequest);
	when(pdpRequestResponse.getXacmlResponse()).thenReturn(xacmlResponse);
	final String enforcementPolicies = "String enforcementPolicies";
	// when(marshaller.marshall(isA(XacmlResult.class))).thenReturn(enforcementPolicies);
	when(
			marshaller
			.marshal(argThat(new IsXacmlResultWithCorrectProperties(
					xacmlRequest, xacmlResponse)))).thenReturn(
							enforcementPolicies);
	final SegmentDocumentResponse segmentDocumentResponse = mock(SegmentDocumentResponse.class);
	final String segmentedC32 = "segmentedC32";
	when(segmentDocumentResponse.getTryPolicyDocumentXml()).thenReturn(
			segmentedC32);
	final DSSResponse response = mock(DSSResponse.class);
	when(response.getTryPolicyDocumentXml()).thenReturn(segmentedC32);
	when(documentSegmentation.segmentDocument(isA(DSSRequest.class)))
	.thenReturn(response);
	// Act
	final String result = sut.tryPolicy(c32Xml, xacmlPolicy, purposeOfUse);
	// Assert
	assertEquals("Not return expected result", segmentedC32, result);
	verify(documentSegmentation, times(1)).segmentDocument(
			argThat(matching((DSSRequest r) -> r.getDocumentXml().equals(
					c32Xml)
					&& r.getEnforcementPoliciesXml().equals(
							enforcementPolicies)
							&& r.isAudited() == false
							&& r.isAuditFailureByPass() == true)));
}