You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openaz.apache.org by pd...@apache.org on 2015/05/13 18:02:28 UTC

[06/56] [abbrv] [partial] incubator-openaz git commit: Merging re-factoring with PMD work

http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/cfbe399c/openaz-xacml-test/src/test/java/org/apache/openaz/xacml/pdp/std/json/ResponseTest.java
----------------------------------------------------------------------
diff --cc openaz-xacml-test/src/test/java/org/apache/openaz/xacml/pdp/std/json/ResponseTest.java
index d8e2122,0000000..410bb54
mode 100644,000000..100644
--- a/openaz-xacml-test/src/test/java/org/apache/openaz/xacml/pdp/std/json/ResponseTest.java
+++ b/openaz-xacml-test/src/test/java/org/apache/openaz/xacml/pdp/std/json/ResponseTest.java
@@@ -1,2558 -1,0 +1,2728 @@@
 +/*
 + *  Licensed to the Apache Software Foundation (ASF) under one
 + *  or more contributor license agreements.  See the NOTICE file
 + *  distributed with this work for additional information
 + *  regarding copyright ownership.  The ASF licenses this file
 + *  to you under the Apache License, Version 2.0 (the
 + *  "License"); you may not use this file except in compliance
 + *  with the License.  You may obtain a copy of the License at
 + *
 + *    http://www.apache.org/licenses/LICENSE-2.0
 + *
 + *  Unless required by applicable law or agreed to in writing,
 + *  software distributed under the License is distributed on an
 + *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + *  KIND, either express or implied.  See the License for the
 + *  specific language governing permissions and limitations
 + *  under the License.
 + *
 + */
 +
 +/*
 + *                        AT&T - PROPRIETARY
 + *          THIS FILE CONTAINS PROPRIETARY INFORMATION OF
 + *        AT&T AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN
 + *             ACCORDANCE WITH APPLICABLE AGREEMENTS.
 + *
 + *          Copyright (c) 2013 AT&T Knowledge Ventures
 + *              Unpublished and Not for Publication
 + *                     All Rights Reserved
 + */
 +package org.apache.openaz.xacml.pdp.std.json;
 +
 +import static org.junit.Assert.assertEquals;
 +import static org.junit.Assert.assertTrue;
 +import static org.junit.Assert.fail;
 +
 +import java.text.ParseException;
 +import java.util.ArrayList;
 +import java.util.Arrays;
 +import java.util.Collection;
 +import java.util.List;
 +import java.math.BigInteger;
 +
 +import org.apache.openaz.xacml.api.Attribute;
 +import org.apache.openaz.xacml.api.AttributeValue;
 +import org.apache.openaz.xacml.api.Decision;
 +import org.apache.openaz.xacml.api.Identifier;
 +import org.apache.openaz.xacml.api.XACML3;
 +import org.apache.openaz.xacml.std.IdentifierImpl;
 +import org.apache.openaz.xacml.std.StdAttribute;
 +import org.apache.openaz.xacml.std.StdAttributeCategory;
 +import org.apache.openaz.xacml.std.StdAttributeValue;
 +import org.apache.openaz.xacml.std.StdIdReference;
 +import org.apache.openaz.xacml.std.StdMutableAdvice;
 +import org.apache.openaz.xacml.std.StdMutableAttribute;
 +import org.apache.openaz.xacml.std.StdMutableAttributeAssignment;
 +import org.apache.openaz.xacml.std.StdMutableMissingAttributeDetail;
 +import org.apache.openaz.xacml.std.StdMutableObligation;
 +import org.apache.openaz.xacml.std.StdMutableResponse;
 +import org.apache.openaz.xacml.std.StdMutableResult;
 +import org.apache.openaz.xacml.std.StdMutableStatus;
 +import org.apache.openaz.xacml.std.StdMutableStatusDetail;
 +import org.apache.openaz.xacml.std.StdStatusCode;
 +import org.apache.openaz.xacml.std.StdVersion;
 +import org.apache.openaz.xacml.std.datatypes.DataTypes;
 +import org.apache.openaz.xacml.std.datatypes.StringNamespaceContext;
 +import org.apache.openaz.xacml.std.datatypes.XPathExpressionWrapper;
 +import org.apache.openaz.xacml.std.json.JSONResponse;
 +import org.apache.openaz.xacml.std.json.JSONStructureException;
 +import org.junit.Test;
 +
 +import com.fasterxml.jackson.databind.JsonNode;
 +import com.fasterxml.jackson.databind.ObjectMapper;
 +
 +/**
-  * Test JSON Responses
-  *
-  * TO RUN - use jUnit
-  * In Eclipse select this file or the enclosing directory, right-click and select Run As/JUnit Test
-  *
-  *
++ * Test JSON Responses TO RUN - use jUnit In Eclipse select this file or the enclosing directory, right-click
++ * and select Run As/JUnit Test
 + */
 +public class ResponseTest {
 +
 +    String jsonResponse;
 +
 +    StdMutableResponse response;
 +
 +    StdMutableResult result;
 +
 +    StdMutableStatus status;
 +
- 
 +    // Note: Initially test responses without Obligations, Associated Advice, Attributes, or PolicyIdentifier
 +
- 
 +    @Test
 +    public void testEmptyAndDecisions() {
 +        // null response
 +        try {
 +            jsonResponse = JSONResponse.toString(null, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
 +        // empty response (no Result object)
 +        response = new StdMutableResponse();
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
- 
 +        // just decision, no status
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        result.setDecision(Decision.PERMIT);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            assertEquals("{\"Response\":[{\"Decision\":\"Permit\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        // just status (empty), no decision
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        result.setStatus(status);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
 +        // just status (non-empty), no decision
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_OK);
 +        result.setStatus(status);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
- 
 +        // test other decisions without Status
 +
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        result.setDecision(Decision.DENY);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            assertEquals("{\"Response\":[{\"Decision\":\"Deny\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        result.setDecision(Decision.NOTAPPLICABLE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            assertEquals("{\"Response\":[{\"Decision\":\"NotApplicable\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            assertEquals("{\"Response\":[{\"Decision\":\"Indeterminate\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        result.setDecision(Decision.INDETERMINATE_DENY);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            assertEquals("{\"Response\":[{\"Decision\":\"Indeterminate{D}\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        result.setDecision(Decision.INDETERMINATE_DENYPERMIT);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            assertEquals("{\"Response\":[{\"Decision\":\"Indeterminate{DP}\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        result.setDecision(Decision.INDETERMINATE_PERMIT);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            assertEquals("{\"Response\":[{\"Decision\":\"Indeterminate{P}\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
- 
 +        // test Multiple Decisions - success
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        result.setDecision(Decision.PERMIT);
 +        response.add(result);
 +        StdMutableResult result2 = new StdMutableResult();
 +        result2.setDecision(Decision.DENY);
 +        response.add(result2);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            assertEquals("{\"Response\":[{\"Decision\":\"Permit\"},{\"Decision\":\"Deny\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
- 
 +        // test Multiple Decisions - one success and one error
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        result.setDecision(Decision.PERMIT);
 +        response.add(result);
 +        result2 = new StdMutableResult();
 +        result2.setDecision(Decision.INDETERMINATE);
 +        response.add(result2);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Decision\":\"Permit\"},{\"Decision\":\"Indeterminate\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Decision\":\"Permit\"},{\"Decision\":\"Indeterminate\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +    }
 +
- 
- 
- 
 +    // Test with every field filled in with multiple values where appropriate
 +    @Test
 +    public void testAllFieldsResponse() {
 +
 +        // fully-loaded multiple response
 +
 +        StdMutableResponse response = new StdMutableResponse();
 +        // create a Status object
 +        StdMutableStatus status = new StdMutableStatus(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +        status.setStatusMessage("some status message");
 +        StdMutableStatusDetail statusDetailIn = new StdMutableStatusDetail();
 +        StdMutableMissingAttributeDetail mad = new StdMutableMissingAttributeDetail();
 +        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "doh"));
 +        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_INTEGER.getId(), "5432"));
 +        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "meh"));
 +        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(), "Bart")));
-         obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-                                               XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
-                                               XACML3.ID_SUBJECT,
-                                               "obligation-issuer2",
-                                               new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Ned")));
++        obligation
++            .addAttributeAssignment(new StdMutableAttributeAssignment(
++                                                                      XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
++                                                                      XACML3.ID_SUBJECT,
++                                                                      "obligation-issuer1",
++                                                                      new StdAttributeValue<String>(
++                                                                                                    DataTypes.DT_STRING
++                                                                                                        .getId(),
++                                                                                                    "Bart")));
++        obligation
++            .addAttributeAssignment(new StdMutableAttributeAssignment(
++                                                                      XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
++                                                                      XACML3.ID_SUBJECT,
++                                                                      "obligation-issuer2",
++                                                                      new StdAttributeValue<String>(
++                                                                                                    DataTypes.DT_STRING
++                                                                                                        .getId(),
++                                                                                                    "Ned")));
 +        result.addObligation(obligation);
 +        obligation = new StdMutableObligation();
 +        obligation.setId(XACML3.ID_SUBJECT_CATEGORY_INTERMEDIARY_SUBJECT);
-         obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-                                               XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
-                                               XACML3.ID_SUBJECT,
-                                               "obligation-issuer3",
-                                               new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Maggie")));
-         obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-                                               XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
-                                               XACML3.ID_SUBJECT,
-                                               "obligation-issuer4",
-                                               new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Homer")));
++        obligation
++            .addAttributeAssignment(new StdMutableAttributeAssignment(
++                                                                      XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
++                                                                      XACML3.ID_SUBJECT,
++                                                                      "obligation-issuer3",
++                                                                      new StdAttributeValue<String>(
++                                                                                                    DataTypes.DT_STRING
++                                                                                                        .getId(),
++                                                                                                    "Maggie")));
++        obligation
++            .addAttributeAssignment(new StdMutableAttributeAssignment(
++                                                                      XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
++                                                                      XACML3.ID_SUBJECT,
++                                                                      "obligation-issuer4",
++                                                                      new StdAttributeValue<String>(
++                                                                                                    DataTypes.DT_STRING
++                                                                                                        .getId(),
++                                                                                                    "Homer")));
 +        result.addObligation(obligation);
 +
- 
 +        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(), "Apu")));
-         advice.addAttributeAssignment(new StdMutableAttributeAssignment(
-                                           null,
-                                           XACML3.ID_SUBJECT,
-                                           "advice-issuerNoCategory",
-                                           new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Crusty")));
++        advice
++            .addAttributeAssignment(new StdMutableAttributeAssignment(
++                                                                      XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
++                                                                      XACML3.ID_SUBJECT,
++                                                                      "advice-issuer1",
++                                                                      new StdAttributeValue<String>(
++                                                                                                    DataTypes.DT_STRING
++                                                                                                        .getId(),
++                                                                                                    "Apu")));
++        advice
++            .addAttributeAssignment(new StdMutableAttributeAssignment(
++                                                                      null,
++                                                                      XACML3.ID_SUBJECT,
++                                                                      "advice-issuerNoCategory",
++                                                                      new StdAttributeValue<String>(
++                                                                                                    DataTypes.DT_STRING
++                                                                                                        .getId(),
++                                                                                                    "Crusty")));
 +        result.addAdvice(advice);
 +
- 
 +        response.add(result);
 +
- 
 +        // create a new Result with a different Decision
 +        // add Child/minor status codes within the main status
-         StdStatusCode childChildChildStatusCode = new StdStatusCode(new IdentifierImpl("childChildChildStatusCode"));
-         StdStatusCode childChildStatusCode = new StdStatusCode(new IdentifierImpl("childChildStatusCode"), childChildChildStatusCode);
-         StdStatusCode child1StatusCode = new StdStatusCode(new IdentifierImpl("child1StatusCode"), childChildStatusCode);
++        StdStatusCode childChildChildStatusCode = new StdStatusCode(
++                                                                    new IdentifierImpl(
++                                                                                       "childChildChildStatusCode"));
++        StdStatusCode childChildStatusCode = new StdStatusCode(new IdentifierImpl("childChildStatusCode"),
++                                                               childChildChildStatusCode);
++        StdStatusCode child1StatusCode = new StdStatusCode(new IdentifierImpl("child1StatusCode"),
++                                                           childChildStatusCode);
 +        StdStatusCode statusCode = new StdStatusCode(XACML3.ID_STATUS_OK, child1StatusCode);
 +
 +        status = new StdMutableStatus(statusCode);
 +
- 
 +        result = new StdMutableResult(status);
 +        result.setDecision(Decision.PERMIT);
 +
- 
- 
- 
 +        // add attribute list in result
 +        Identifier categoryIdentifier = new IdentifierImpl("firstCategory");
 +        Attribute[] attrList = {
-             new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent1"), new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Apu"), "AIssue", true),
-             new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent2"), new StdAttributeValue<String>(DataTypes.DT_YEARMONTHDURATION.getId(), "P10Y4M"), "BIssue", false),
-             new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent3"), new StdAttributeValue<Double>(DataTypes.DT_DOUBLE.getId(), 765.432), "CIssue", true),
-             new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent4"), new StdAttributeValue<Boolean>(DataTypes.DT_BOOLEAN.getId(), true), "DIssue", true),
-             new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent5"), new StdAttributeValue<BigInteger>(DataTypes.DT_INTEGER.getId(), BigInteger.valueOf(4567)), "EIssue", true),
-             new StdAttribute(categoryIdentifier, new IdentifierImpl("attrNoIssuer"), new StdAttributeValue<BigInteger>(DataTypes.DT_INTEGER.getId(), BigInteger.valueOf(4567)), null, true)
++                                new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent1"),
++                             new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Apu"), "AIssue",
++                             true),
++                                new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent2"),
++                             new StdAttributeValue<String>(DataTypes.DT_YEARMONTHDURATION.getId(), "P10Y4M"),
++                             "BIssue", false),
++                                new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent3"),
++                             new StdAttributeValue<Double>(DataTypes.DT_DOUBLE.getId(), 765.432), "CIssue",
++                             true),
++                                new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent4"),
++                             new StdAttributeValue<Boolean>(DataTypes.DT_BOOLEAN.getId(), true), "DIssue",
++                             true),
++                                new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent5"),
++                             new StdAttributeValue<BigInteger>(DataTypes.DT_INTEGER.getId(),
++                                                               BigInteger.valueOf(4567)), "EIssue", true),
++                                new StdAttribute(categoryIdentifier, new IdentifierImpl("attrNoIssuer"),
++                             new StdAttributeValue<BigInteger>(DataTypes.DT_INTEGER.getId(),
++                                                               BigInteger.valueOf(4567)), null, true)
 +        };
 +        result.addAttributeCategory(new StdAttributeCategory(categoryIdentifier, Arrays.asList(attrList)));
 +        categoryIdentifier = new IdentifierImpl("secondCategory");
 +        Attribute[] secondAttrList = {
-             new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent12"), new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Apu2"), "AIssue2", true),
-             new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent22"), new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Abc2"), "BIssue2", false),
-             new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent32"), new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Der2"), "CIssue2", true)
++                                      new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent12"),
++                             new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Apu2"), "AIssue2",
++                             true),
++                                      new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent22"),
++                             new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Abc2"), "BIssue2",
++                             false),
++                                      new StdAttribute(categoryIdentifier, new IdentifierImpl("attrIdent32"),
++                             new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Der2"), "CIssue2",
++                             true)
 +        };
-         result.addAttributeCategory(new StdAttributeCategory(categoryIdentifier, Arrays.asList(secondAttrList)));
- 
++        result.addAttributeCategory(new StdAttributeCategory(categoryIdentifier, Arrays
++            .asList(secondAttrList)));
 +
 +        // add PolicyIdentifierList to result
 +        StdIdReference policyIdentifier1 = null;
 +        StdIdReference policyIdentifier2 = null;
 +        StdIdReference policySetIdentifier1 = null;
 +        StdIdReference policySetIdentifier2 = null;
 +        try {
-             policyIdentifier1 = new StdIdReference(new IdentifierImpl("idRef1"), StdVersion.newInstance("1.2.3"));
++            policyIdentifier1 = new StdIdReference(new IdentifierImpl("idRef1"),
++                                                   StdVersion.newInstance("1.2.3"));
 +            policyIdentifier2 = new StdIdReference(new IdentifierImpl("idRef2_NoVersion"));
-             policySetIdentifier1 = new StdIdReference(new IdentifierImpl("idSetRef1"), StdVersion.newInstance("4.5.6.7.8.9.0"));
++            policySetIdentifier1 = new StdIdReference(new IdentifierImpl("idSetRef1"),
++                                                      StdVersion.newInstance("4.5.6.7.8.9.0"));
 +            policySetIdentifier2 = new StdIdReference(new IdentifierImpl("idSetRef2_NoVersion"));
 +        } catch (ParseException e1) {
-             fail("creating policyIds, e="+e1);
++            fail("creating policyIds, e=" + e1);
 +        }
 +
 +        result.addPolicyIdentifier(policyIdentifier1);
 +        result.addPolicyIdentifier(policyIdentifier2);
 +
 +        result.addPolicySetIdentifier(policySetIdentifier1);
 +        result.addPolicySetIdentifier(policySetIdentifier2);
 +
 +        response.add(result);
 +
 +        // convert Response to JSON
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            System.out.println(jsonResponse);
-             
 +            String expectedJson = "{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusMessage\":\"some status message\",\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\\\\\\\" AttributeId=\\\\\\\"urn:oasis:names:tc:xacml:2.0:action:purpose\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\" Issuer=\\\\\\\"an Issuer\\\\\\\"><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\">doh</AttributeValue><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#integer\\\\\\\">5432</AttributeValue><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\">meh</AttributeValue></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"},{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"}},\"Obligations\":[{\"Id\":\"urn:oasis:names:tc:xacml:1.0:action:
 implied-action\",\"AttributeAssignment\":[{\"Issuer\":\"obligation-issuer1\",\"Value\":\"Bart\",\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"},{\"Issuer\":\"obligation-issuer2\",\"Value\":\"Ned\",\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"}]},{\"Id\":\"urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject\",\"AttributeAssignment\":[{\"Issuer\":\"obligation-issuer3\",\"Value\":\"Maggie\",\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"},{\"Issuer\":\"obligation-issuer4\",\"Value\":\"Homer\",\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:r
 esource\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"}]}],\"Decision\":\"Deny\",\"AssociatedAdvice\":[{\"Id\":\"urn:oasis:names:tc:xacml:1.0:action:implied-action\",\"AttributeAssignment\":[{\"Issuer\":\"advice-issuer1\",\"Value\":\"Apu\",\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"},{\"Issuer\":\"advice-issuerNoCategory\",\"Value\":\"Crusty\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"}]}]},{\"Status\":{\"StatusCode\":{\"StatusCode\":{\"StatusCode\":{\"StatusCode\":{\"Value\":\"childChildChildStatusCode\"},\"Value\":\"childChildStatusCode\"},\"Value\":\"child1StatusCode\"},\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"}},\"Category\":[{\"CategoryId\":\"firstCategory\",\"Attribute\":[{\"Issuer\":\"A
 Issue\",\"Value\":\"Apu\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"attrIdent1\"},{\"Issuer\":\"CIssue\",\"Value\":765.432,\"DataType\":\"http://www.w3.org/2001/XMLSchema#double\",\"AttributeId\":\"attrIdent3\"},{\"Issuer\":\"DIssue\",\"Value\":true,\"DataType\":\"http://www.w3.org/2001/XMLSchema#boolean\",\"AttributeId\":\"attrIdent4\"},{\"Issuer\":\"EIssue\",\"Value\":4567,\"DataType\":\"http://www.w3.org/2001/XMLSchema#integer\",\"AttributeId\":\"attrIdent5\"},{\"Value\":4567,\"DataType\":\"http://www.w3.org/2001/XMLSchema#integer\",\"AttributeId\":\"attrNoIssuer\"}]},{\"CategoryId\":\"secondCategory\",\"Attribute\":[{\"Issuer\":\"AIssue2\",\"Value\":\"Apu2\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"attrIdent12\"},{\"Issuer\":\"CIssue2\",\"Value\":\"Der2\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"attrIdent32\"}]}],\"Decision\":\"Permit\",\"PolicyIdentifier\":{\"PolicyIdReference\"
 :[{\"Id\":\"idRef1\",\"Version\":\"1.2.3\"},{\"Id\":\"idRef2_NoVersion\"}],\"PolicySetIdReference\":[{\"Id\":\"idSetRef1\",\"Version\":\"4.5.6.7.8.9.0\"},{\"Id\":\"idSetRef2_NoVersion\"}]}}]}";
- 
 +            ObjectMapper mapper = new ObjectMapper();
 +            JsonNode tree = mapper.readTree(jsonResponse);
 +            JsonNode treeExpected = mapper.readTree(expectedJson);
-             assertTrue(tree.equals(treeExpected));
-             
- //System.out.println(JSONResponse.toString(response, true));
- //            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusMessage\":\"some status message\",\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\\\\\\\" AttributeId=\\\\\\\"urn:oasis:names:tc:xacml:2.0:action:purpose\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\" Issuer=\\\\\\\"an Issuer\\\\\\\"><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\">doh</AttributeValue><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#integer\\\\\\\">5432</AttributeValue><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\">meh</AttributeValue></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"},{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"}},\"Obligations\":[{\"Id\":\"urn:oasis:names:tc:xacml:1.0:action:implied
 -action\",\"AttributeAssignment\":[{\"Issuer\":\"obligation-issuer1\",\"Value\":\"Bart\",\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"},{\"Issuer\":\"obligation-issuer2\",\"Value\":\"Ned\",\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"}]},{\"Id\":\"urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject\",\"AttributeAssignment\":[{\"Issuer\":\"obligation-issuer3\",\"Value\":\"Maggie\",\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"},{\"Issuer\":\"obligation-issuer4\",\"Value\":\"Homer\",\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource
 \",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"}]}],\"Decision\":\"Deny\",\"AssociatedAdvice\":[{\"Id\":\"urn:oasis:names:tc:xacml:1.0:action:implied-action\",\"AttributeAssignment\":[{\"Issuer\":\"advice-issuer1\",\"Value\":\"Apu\",\"Category\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"},{\"Issuer\":\"advice-issuerNoCategory\",\"Value\":\"Crusty\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject\"}]}]},{\"Status\":{\"StatusCode\":{\"StatusCode\":{\"StatusCode\":{\"StatusCode\":{\"Value\":\"childChildChildStatusCode\"},\"Value\":\"childChildStatusCode\"},\"Value\":\"child1StatusCode\"},\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"}},\"Category\":[{\"CategoryId\":\"firstCategory\",\"Attribute\":[{\"Issuer\":\"AIssue\"
 ,\"Value\":\"Apu\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"attrIdent1\"},{\"Issuer\":\"CIssue\",\"Value\":765.432,\"DataType\":\"http://www.w3.org/2001/XMLSchema#double\",\"AttributeId\":\"attrIdent3\"},{\"Issuer\":\"DIssue\",\"Value\":true,\"DataType\":\"http://www.w3.org/2001/XMLSchema#boolean\",\"AttributeId\":\"attrIdent4\"},{\"Issuer\":\"EIssue\",\"Value\":4567,\"DataType\":\"http://www.w3.org/2001/XMLSchema#integer\",\"AttributeId\":\"attrIdent5\"},{\"Value\":4567,\"DataType\":\"http://www.w3.org/2001/XMLSchema#integer\",\"AttributeId\":\"attrNoIssuer\"}]},{\"CategoryId\":\"secondCategory\",\"Attribute\":[{\"Issuer\":\"AIssue2\",\"Value\":\"Apu2\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"attrIdent12\"},{\"Issuer\":\"CIssue2\",\"Value\":\"Der2\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"AttributeId\":\"attrIdent32\"}]}],\"Decision\":\"Permit\",\"PolicyIdentifier\":{\"PolicyIdReference\":[{\"Id
 \":\"idRef1\",\"Version\":\"1.2.3\"},{\"Id\":\"idRef2_NoVersion\"}],\"PolicySetIdReference\":[{\"Id\":\"idSetRef1\",\"Version\":\"4.5.6.7.8.9.0\"},{\"Id\":\"idSetRef2_NoVersion\"}]}}]}", jsonResponse);
++            assertTrue(tree.equals(treeExpected));            
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +    }
 +
- 
- 
- 
 +    // combinations of Status values with Decision values
 +    @Test
 +    public void testDecisionStatusMatch() {
-         // the tests in this method use different values and do not change structures, so we can re-use the objects
++        // the tests in this method use different values and do not change structures, so we can re-use the
++        // objects
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        result.setStatus(status);
 +        response.add(result);
 +
 +        // StatusCode = OK
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_OK);
 +        result.setDecision(Decision.PERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"}},\"Decision\":\"Permit\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"}},\"Decision\":\"Permit\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.DENY);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"}},\"Decision\":\"Deny\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"}},\"Decision\":\"Deny\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.NOTAPPLICABLE);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"}},\"Decision\":\"NotApplicable\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"}},\"Decision\":\"NotApplicable\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_DENY);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_DENYPERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_PERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
- 
- 
- 
- 
- 
 +        // StatusCode = SyntaxError
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_SYNTAX_ERROR);
 +        result.setDecision(Decision.PERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.DENY);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.NOTAPPLICABLE);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:syntax-error\"}},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:syntax-error\"}},\"Decision\":\"Indeterminate\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_DENY);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:syntax-error\"}},\"Decision\":\"Indeterminate{D}\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:syntax-error\"}},\"Decision\":\"Indeterminate{D}\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_DENYPERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:syntax-error\"}},\"Decision\":\"Indeterminate{DP}\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:syntax-error\"}},\"Decision\":\"Indeterminate{DP}\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_PERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:syntax-error\"}},\"Decision\":\"Indeterminate{P}\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:syntax-error\"}},\"Decision\":\"Indeterminate{P}\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
- 
 +        // StatusCode = ProcessingError
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_PROCESSING_ERROR);
 +        result.setDecision(Decision.PERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.DENY);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.NOTAPPLICABLE);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:processing-error\"}},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:processing-error\"}},\"Decision\":\"Indeterminate\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_DENY);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:processing-error\"}},\"Decision\":\"Indeterminate{D}\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:processing-error\"}},\"Decision\":\"Indeterminate{D}\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_DENYPERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:processing-error\"}},\"Decision\":\"Indeterminate{DP}\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:processing-error\"}},\"Decision\":\"Indeterminate{DP}\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_PERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:processing-error\"}},\"Decision\":\"Indeterminate{P}\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:processing-error\"}},\"Decision\":\"Indeterminate{P}\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
- 
- 
 +        // StatusCode = MissingAttribute
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +        result.setDecision(Decision.PERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.DENY);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.NOTAPPLICABLE);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"}},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"}},\"Decision\":\"Indeterminate\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_DENY);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"}},\"Decision\":\"Indeterminate{D}\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"}},\"Decision\":\"Indeterminate{D}\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_DENYPERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"}},\"Decision\":\"Indeterminate{DP}\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"}},\"Decision\":\"Indeterminate{DP}\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        result.setDecision(Decision.INDETERMINATE_PERMIT);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"}},\"Decision\":\"Indeterminate{P}\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"}},\"Decision\":\"Indeterminate{P}\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +    }
 +
- 
- 
- 
 +    // tests related to Status and its components
 +    @Test
 +    public void testStatus() {
 +        // Status with no StatusCode - error
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        result.setStatus(status);
 +        result.setDecision(Decision.PERMIT);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
 +        // Status with StatusMessage when OK
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_OK);
 +        status.setStatusMessage("I'm ok, you're ok");
 +        result.setStatus(status);
 +        result.setDecision(Decision.PERMIT);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"},\"StatusMessage\":\"I'm ok, you're ok\"},\"Decision\":\"Permit\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"},\"StatusMessage\":\"I'm ok, you're ok\"},\"Decision\":\"Permit\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        // Status with StatusDetail when OK
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_OK);
 +        StdMutableStatusDetail statusDetail = new StdMutableStatusDetail();
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.PERMIT);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
 +        // Status with StatusMessage when SyntaxError
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_SYNTAX_ERROR);
 +        status.setStatusMessage("I'm ok, you're ok");
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:syntax-error\"},\"StatusMessage\":\"I'm ok, you're ok\"},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:syntax-error\"},\"StatusMessage\":\"I'm ok, you're ok\"},\"Decision\":\"Indeterminate\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        // Status with empty StatusDetail when SyntaxError
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_SYNTAX_ERROR);
 +        statusDetail = new StdMutableStatusDetail();
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
- 
 +        // Status with StatusMessage when ProcessingError
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_PROCESSING_ERROR);
 +        status.setStatusMessage("I'm ok, you're ok");
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:processing-error\"},\"StatusMessage\":\"I'm ok, you're ok\"},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:processing-error\"},\"StatusMessage\":\"I'm ok, you're ok\"},\"Decision\":\"Indeterminate\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        // Status with empty StatusDetail when ProcessingError
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_PROCESSING_ERROR);
 +        statusDetail = new StdMutableStatusDetail();
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
- 
 +        // Status with StatusMessage when MissingAttribute
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +        status.setStatusMessage("I'm ok, you're ok");
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusMessage\":\"I'm ok, you're ok\"},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusMessage\":\"I'm ok, you're ok\"},\"Decision\":\"Indeterminate\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        // Status with empty StatusDetail when MissingAttribute
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +        statusDetail = new StdMutableStatusDetail();
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
-             assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"}},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
++            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"}},\"Decision\":\"Indeterminate\"}]}",
++                         jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
- 
- 
 +        // Status with StatusDetail with empty detail when MissingAttribute
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +        statusDetail = new StdMutableStatusDetail();
 +        StdMutableMissingAttributeDetail mad = new StdMutableMissingAttributeDetail();
 +        statusDetail.addMissingAttributeDetail(mad);
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
 +        // Status with StatusDetail with valid detail with no value when MissingAttribute
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +        statusDetail = new StdMutableStatusDetail();
 +        mad = new StdMutableMissingAttributeDetail();
 +        mad.setAttributeId(new IdentifierImpl("mad"));
 +        mad.setCategory(XACML3.ID_ACTION);
 +        mad.setDataTypeId(DataTypes.DT_STRING.getId());
 +        statusDetail.addMissingAttributeDetail(mad);
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            String expectedJson = "{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:1.0:action\\\\\\\" AttributeId=\\\\\\\"mad\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\"></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}";
 +            ObjectMapper mapper = new ObjectMapper();
 +            JsonNode tree = mapper.readTree(jsonResponse);
 +            JsonNode treeExpected = mapper.readTree(expectedJson);
 +            assertTrue(tree.equals(treeExpected));
- //            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:1.0:action\\\\\\\" AttributeId=\\\\\\\"mad\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\"></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        // Status with StatusDetail with valid detail with value when MissingAttribute
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +        statusDetail = new StdMutableStatusDetail();
 +        mad = new StdMutableMissingAttributeDetail();
 +        mad.setAttributeId(new IdentifierImpl("mad"));
 +        mad.setCategory(XACML3.ID_ACTION);
 +        mad.setDataTypeId(DataTypes.DT_STRING.getId());
 +        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "meh"));
 +        statusDetail.addMissingAttributeDetail(mad);
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            String expectedJson = "{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:1.0:action\\\\\\\" AttributeId=\\\\\\\"mad\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\"><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\">meh</AttributeValue></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}";
 +            ObjectMapper mapper = new ObjectMapper();
 +            JsonNode tree = mapper.readTree(jsonResponse);
 +            JsonNode treeExpected = mapper.readTree(expectedJson);
 +            assertTrue(tree.equals(treeExpected));
- //            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:1.0:action\\\\\\\" AttributeId=\\\\\\\"mad\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\"><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\">meh</AttributeValue></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
 +        // Status with StatusDetail with array valid detail with value when MissingAttribute
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +        statusDetail = new StdMutableStatusDetail();
 +        mad = new StdMutableMissingAttributeDetail();
 +        mad.setAttributeId(new IdentifierImpl("mad"));
 +        mad.setCategory(XACML3.ID_ACTION);
 +        mad.setDataTypeId(DataTypes.DT_STRING.getId());
 +        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "meh"));
 +        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "nu?"));
 +        statusDetail.addMissingAttributeDetail(mad);
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            String expectedJson = "{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:1.0:action\\\\\\\" AttributeId=\\\\\\\"mad\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\"><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\">meh</AttributeValue><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\">nu?</AttributeValue></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}";
 +            ObjectMapper mapper = new ObjectMapper();
 +            JsonNode tree = mapper.readTree(jsonResponse);
 +            JsonNode treeExpected = mapper.readTree(expectedJson);
 +            assertTrue(tree.equals(treeExpected));
- //            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:1.0:action\\\\\\\" AttributeId=\\\\\\\"mad\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\"><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\">meh</AttributeValue><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\">nu?</AttributeValue></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +
- 
 +        // Status with StatusDetail with valid detail with Integer value when MissingAttribute
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +        statusDetail = new StdMutableStatusDetail();
 +        mad = new StdMutableMissingAttributeDetail();
 +        mad.setAttributeId(new IdentifierImpl("mad"));
 +        mad.setCategory(XACML3.ID_ACTION);
 +        mad.setDataTypeId(DataTypes.DT_INTEGER.getId());
-         mad.addAttributeValue(new StdAttributeValue<BigInteger>(DataTypes.DT_INTEGER.getId(), BigInteger.valueOf(1111)));
++        mad.addAttributeValue(new StdAttributeValue<BigInteger>(DataTypes.DT_INTEGER.getId(), BigInteger
++            .valueOf(1111)));
 +        statusDetail.addMissingAttributeDetail(mad);
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
- //            System.out.println(JSONResponse.toString(response, true));
 +            jsonResponse = JSONResponse.toString(response, false);
 +            /*
 +             * 
-              * PLD - chnaged this to integer, why was this a string?
++             * PLD - changed this to integer, why was this a string?
 +             */
 +            String expectedJson = "{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:1.0:action\\\\\\\" AttributeId=\\\\\\\"mad\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#integer\\\\\\\"><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#integer\\\\\\\">1111</AttributeValue></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}";
 +            ObjectMapper mapper = new ObjectMapper();
 +            JsonNode tree = mapper.readTree(jsonResponse);
 +            JsonNode treeExpected = mapper.readTree(expectedJson);
 +            
 +            System.out.println("Tree");
 +            System.out.println(tree);
 +            System.out.println(treeExpected);
 +            System.out.println("Done");
 +            
 +            assertTrue(tree.equals(treeExpected));
- //			assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:1.0:action\\\\\\\" AttributeId=\\\\\\\"mad\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\"><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#integer\\\\\\\">1111</AttributeValue></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
 +        } catch (Exception e) {
 +            java.io.StringWriter sw = new java.io.StringWriter();
 +            java.io.PrintWriter pw = new java.io.PrintWriter(sw);
 +            e.printStackTrace(pw);
-             
- //            System.err.println(jsonResponse);
- 
-             fail("operation failed, e="+e + sw.toString());
++            fail("operation failed, e=" + e + sw.toString());
 +        }
 +
 +        // Status with StatusDetail with array valid detail with Integer value when MissingAttribute
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +        statusDetail = new StdMutableStatusDetail();
 +        mad = new StdMutableMissingAttributeDetail();
 +        mad.setAttributeId(new IdentifierImpl("mad"));
 +        mad.setCategory(XACML3.ID_ACTION);
 +        mad.setDataTypeId(DataTypes.DT_STRING.getId());
-         mad.addAttributeValue(new StdAttributeValue<BigInteger>(DataTypes.DT_INTEGER.getId(), BigInteger.valueOf(1111)));
-         mad.addAttributeValue(new StdAttributeValue<BigInteger>(DataTypes.DT_INTEGER.getId(), BigInteger.valueOf(2222)));
++        mad.addAttributeValue(new StdAttributeValue<BigInteger>(DataTypes.DT_INTEGER.getId(), BigInteger
++            .valueOf(1111)));
++        mad.addAttributeValue(new StdAttributeValue<BigInteger>(DataTypes.DT_INTEGER.getId(), BigInteger
++            .valueOf(2222)));
 +        statusDetail.addMissingAttributeDetail(mad);
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            String expectedJson = "{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:1.0:action\\\\\\\" AttributeId=\\\\\\\"mad\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\"><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#integer\\\\\\\">1111</AttributeValue><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#integer\\\\\\\">2222</AttributeValue></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}";
 +            ObjectMapper mapper = new ObjectMapper();
 +            JsonNode tree = mapper.readTree(jsonResponse);
 +            JsonNode treeExpected = mapper.readTree(expectedJson);
 +            assertTrue(tree.equals(treeExpected));
- //            assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<MissingAttributeDetail Category=\\\\\\\"urn:oasis:names:tc:xacml:1.0:action\\\\\\\" AttributeId=\\\\\\\"mad\\\\\\\" DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#string\\\\\\\"><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#integer\\\\\\\">1111</AttributeValue><AttributeValue DataType=\\\\\\\"http://www.w3.org/2001/XMLSchema#integer\\\\\\\">2222</AttributeValue></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
 +        } catch (Exception e) {
 +            fail("operation failed, e="+e);
 +        }
 +
 +//		StringNamespaceContext snc = new StringNamespaceContext();
 +//		try {
 +//			snc.add("defaultURI");
 +//			snc.add("md", "referenceForMD");
 +//		} catch (Exception e) {
 +//			fail("unable to create NamespaceContext e="+e);
 +//		}
 +//		XPathExpressionWrapper xpathExpressionWrapper = new XPathExpressionWrapper(snc, "//md:record");
 +//
 +//TODO - assume that we will never try to pass back an XPathExpression in a MissingAttributeDetail - it doesn't make sense and is unclear how to put into XML
 +//		// Status with StatusDetail with valid detail with XPathExpression value when MissingAttribute
 +//		response = new StdMutableResponse();
 +//		result = new StdMutableResult();
 +//		status = new StdMutableStatus();
 +//		status.setStatusCode(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +//		statusDetail = new StdMutableStatusDetail();
 +//		mad = new StdMutableMissingAttributeDetail();
 +//		mad.setAttributeId(new IdentifierImpl("mad"));
 +//		mad.setCategory(XACML3.ID_ACTION);
 +//		mad.setDataTypeId(DataTypes.DT_STRING.getId());
 +//		mad.addAttributeValue(new StdAttributeValue<XPathExpressionWrapper>(DataTypes.DT_XPATHEXPRESSION.getId(), xpathExpressionWrapper, new IdentifierImpl("xpathCategoryId")));
 +//		statusDetail.addMissingAttributeDetail(mad);
 +//		status.setStatusDetail(statusDetail);
 +//		result.setStatus(status);
 +//		result.setDecision(Decision.INDETERMINATE);
 +//		response.add(result);
 +//		try {
 +//			jsonResponse = JSONResponse.toString(response, false);
 +//			assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<AttributeValue>1111</AttributeValue><Category>urn:oasis:names:tc:xacml:1.0:action</Category><AttributeId>mad</AttributeId><DataType>http://www.w3.org/2001/XMLSchema#string</DataType></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
 +//		} catch (Exception e) {
 +//			fail("operation failed, e="+e);
 +//		}
 +//
 +//		// Status with StatusDetail with array valid detail with XPathExpression value when MissingAttribute
 +//		response = new StdMutableResponse();
 +//		result = new StdMutableResult();
 +//		status = new StdMutableStatus();
 +//		status.setStatusCode(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
 +//		statusDetail = new StdMutableStatusDetail();
 +//		mad = new StdMutableMissingAttributeDetail();
 +//		mad.setAttributeId(new IdentifierImpl("mad"));
 +//		mad.setCategory(XACML3.ID_ACTION);
 +//		mad.setDataTypeId(DataTypes.DT_STRING.getId());
 +//		mad.addAttributeValue(new StdAttributeValue<XPathExpressionWrapper>(DataTypes.DT_XPATHEXPRESSION.getId(), xpathExpressionWrapper, new IdentifierImpl("xpathCategoryId1")));
 +//		mad.addAttributeValue(new StdAttributeValue<XPathExpressionWrapper>(DataTypes.DT_XPATHEXPRESSION.getId(), xpathExpressionWrapper, new IdentifierImpl("xpathCategoryId2")));
 +//		statusDetail.addMissingAttributeDetail(mad);
 +//		status.setStatusDetail(statusDetail);
 +//		result.setStatus(status);
 +//		result.setDecision(Decision.INDETERMINATE);
 +//		response.add(result);
 +//		try {
 +//			jsonResponse = JSONResponse.toString(response, false);
 +//			assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:missing-attribute\"},\"StatusDetail\":\"<AttributeValue>1111</AttributeValue><AttributeValue>2222</AttributeValue><Category>urn:oasis:names:tc:xacml:1.0:action</Category><AttributeId>mad</AttributeId><DataType>http://www.w3.org/2001/XMLSchema#string</DataType></MissingAttributeDetail>\"},\"Decision\":\"Indeterminate\"}]}", jsonResponse);
 +//		} catch (Exception e) {
 +//			fail("operation failed, e="+e);
 +//		}
 +
 +//TODO - try with other data types, esp XPathExpression
 +
 +        // Status with StatusDetail with array valid detail with value when SyntaxError
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_SYNTAX_ERROR);
 +        statusDetail = new StdMutableStatusDetail();
 +        mad = new StdMutableMissingAttributeDetail();
 +        mad.setAttributeId(new IdentifierImpl("mad"));
 +        mad.setCategory(XACML3.ID_ACTION);
 +        mad.setDataTypeId(DataTypes.DT_STRING.getId());
 +        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "meh"));
 +        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "nu?"));
 +        statusDetail.addMissingAttributeDetail(mad);
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
 +        // Status with StatusDetail with array valid detail with value when ProcessingError
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        status.setStatusCode(StdStatusCode.STATUS_CODE_PROCESSING_ERROR);
 +        statusDetail = new StdMutableStatusDetail();
 +        mad = new StdMutableMissingAttributeDetail();
 +        mad.setAttributeId(new IdentifierImpl("mad"));
 +        mad.setCategory(XACML3.ID_ACTION);
 +        mad.setDataTypeId(DataTypes.DT_STRING.getId());
 +        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "meh"));
 +        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "nu?"));
 +        statusDetail.addMissingAttributeDetail(mad);
 +        status.setStatusDetail(statusDetail);
 +        result.setStatus(status);
 +        result.setDecision(Decision.INDETERMINATE);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            fail("Operation should throw exception");
 +        } catch (JSONStructureException e) {
 +            // correct response
 +        } catch (Exception e) {
-             fail ("Failed convert from JSON to object: " + e);
++            fail("Failed convert from JSON to object: " + e);
 +        }
 +
- 
- 
 +        // Status with nested child StatusCodes (child status containing child status containing...)
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
 +        StdStatusCode child1StatusCode = new StdStatusCode(new IdentifierImpl("child1StatusCode"));
 +        StdStatusCode statusCode = new StdStatusCode(XACML3.ID_STATUS_OK, child1StatusCode);
 +        status = new StdMutableStatus(statusCode);
 +        status.setStatusMessage("I'm ok, you're ok");
 +        result.setStatus(status);
 +        result.setDecision(Decision.PERMIT);
 +        response.add(result);
 +        try {
 +            jsonResponse = JSONResponse.toString(response, false);
 +            String expectedJson = "{\"Response\":[{\"Status\":{\"StatusCode\":{\"StatusCode\":{\"Value\":\"child1StatusCode\"},\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"},\"StatusMessage\":\"I'm ok, you're ok\"},\"Decision\":\"Permit\"}]}";
 +            ObjectMapper mapper = new ObjectMapper();
 +            JsonNode tree = mapper.readTree(jsonResponse);
 +            JsonNode treeExpected = mapper.readTree(expectedJson);
 +            assertTrue(tree.equals(treeExpected));
- //           assertEquals("{\"Response\":[{\"Status\":{\"StatusCode\":{\"StatusCode\":{\"Value\":\"child1StatusCode\"},\"Value\":\"urn:oasis:names:tc:xacml:1.0:status:ok\"},\"StatusMessage\":\"I'm ok, you're ok\"},\"Decision\":\"Permit\"}]}", jsonResponse);
 +        } catch (Exception e) {
-             fail("operation failed, e="+e);
++            fail("operation failed, e=" + e);
 +        }
 +        response = new StdMutableResponse();
 +        result = new StdMutableResult();
 +        status = new StdMutableStatus();
-         StdStatusCode childChildChildStatusCode = new StdStatusCode(new IdentifierImpl("childChildChildStatusCode"));
-         StdStatusCode childChildStatusCode = new StdStatusCode(new IdentifierImpl("childChildStatusCode"), childChildChildStatusCode);
++        StdStatusCode child

<TRUNCATED>