@Test
public final void testRun() {

    final FindAction action = new FindAction();
    // fully-loaded multiple response
    final StdMutableResponse response = new StdMutableResponse();
    // create a Status object
    StdMutableStatus status = new StdMutableStatus(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
    status.setStatusMessage("some status message");
    final StdMutableStatusDetail statusDetailIn = new StdMutableStatusDetail();
    final StdMutableMissingAttributeDetail mad = new StdMutableMissingAttributeDetail();
    mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PEPACTION"));
    mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_INTEGER.getId(), "PDPACTION"));
    mad.setAttributeId(XACML3.ID_ACTION_PURPOSE);
    mad.setCategory(XACML3.ID_ATTRIBUTE_CATEGORY_ACTION);
    mad.setDataTypeId(XACML3.ID_DATATYPE_STRING);
    mad.setIssuer("an Issuer");
    statusDetailIn.addMissingAttributeDetail(mad);
    status.setStatusDetail(statusDetailIn);
    // create a single result object
    StdMutableResult result = new StdMutableResult(status);
    // set the decision
    result.setDecision(Decision.INDETERMINATE);
    // put the Result into the Response
    response.add(result);
    // create a new Result with a different Decision
    status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
    result = new StdMutableResult(status);
    result.setDecision(Decision.DENY);
    StdMutableObligation obligation = new StdMutableObligation();
    obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
    obligation.addAttributeAssignment(
            new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, XACML3.ID_SUBJECT,
                    "obligation-issuer1", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Test")));
    result.addObligation(obligation);
    final StdMutableAdvice advice = new StdMutableAdvice();
    advice.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
    advice.addAttributeAssignment(
            new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, XACML3.ID_SUBJECT,
                    "advice-issuer1", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Test")));
    response.add(result);
    // The logic below exercises the callRest and takeAction methods in FindAction
    // GET request
    status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
    result = new StdMutableResult(status);
    result.setDecision(Decision.PERMIT);
    obligation = new StdMutableObligation();
    obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
    obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
            new IdentifierImpl("performer"), "obligation-issuer",
            new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PDPACTION")));
    obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
            new IdentifierImpl("URL"), "obligation-issuer",
            new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT)));
    obligation.addAttributeAssignment(
            new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("method"),
                    "obligation-issuer", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "GET")));
    obligation.addAttributeAssignment(
            new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("headers"),
                    "obligation-issuer", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "foobar")));
    result.addObligation(obligation);
    response.add(result);
    // POST request
    status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
    result = new StdMutableResult(status);
    result.setDecision(Decision.PERMIT);
    obligation = new StdMutableObligation();
    obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
    obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
            new IdentifierImpl("performer"), "obligation-issuer",
            new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PDPACTION")));
    obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
            new IdentifierImpl("URL"), "obligation-issuer",
            new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT)));
    obligation.addAttributeAssignment(
            new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("method"),
                    "obligation-issuer", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "POST")));
    obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
            new IdentifierImpl("body"), "obligation-issuer", new StdAttributeValue<String>(
                    DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT + "/foobar")));
    result.addObligation(obligation);
    response.add(result);
    // PUT request
    status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
    result = new StdMutableResult(status);
    result.setDecision(Decision.PERMIT);
    obligation = new StdMutableObligation();
    obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
    obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
            new IdentifierImpl("performer"), "obligation-issuer",
            new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PDPACTION")));
    obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
            new IdentifierImpl("URL"), "obligation-issuer",
            new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT)));
    obligation.addAttributeAssignment(
            new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("method"),
                    "obligation-issuer", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PUT")));
    obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
            new IdentifierImpl("body"), "obligation-issuer", new StdAttributeValue<String>(
                    DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT + "/foobar")));
    result.addObligation(obligation);
    response.add(result);
    try {
        assertTrue(action.run(response, request) != null);
    } catch (final Exception e) {
        fail("operation failed, e=" + e);
    }
}