diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
index ca0b0f6..c706d2c 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
@@ -93,15 +93,13 @@
     private static final String POLICYTYPES = "policytypes";
     private static final String POLICYTYPES_TCA = "policytypes/onap.policies.monitoring.tcagen2";
     private static final String POLICYTYPES_COLLECTOR =
-        "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server";
-    private static final String POLICYTYPES_TCA_VERSION =
-        "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0";
-    private static final String POLICYTYPES_TCA_LATEST =
-        "policytypes/onap.policies.monitoring.tcagen2/versions/latest";
+            "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server";
+    private static final String POLICYTYPES_TCA_VERSION = "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0";
+    private static final String POLICYTYPES_TCA_LATEST = "policytypes/onap.policies.monitoring.tcagen2/versions/latest";
     private static final String POLICYTYPES_COLLECTOR_VERSION =
-        "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server/versions/1.0.0";
+            "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server/versions/1.0.0";
     private static final String POLICYTYPES_COLLECTOR_LATEST =
-        "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server/versions/latest";
+            "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server/versions/latest";
 
     private static final String POLICYTYPES_DROOLS = "policytypes/onap.policies.controlloop.operational.common.Drools";
     private static final String POLICYTYPES_DROOLS_VERSION = POLICYTYPES_DROOLS + "/versions/1.0.0";
@@ -110,16 +108,16 @@
     private static final String POLICYTYPES_NAMING_VERSION = POLICYTYPES + "/onap.policies.Naming/versions/1.0.0";
 
     private static final String POLICYTYPES_TCA_POLICIES =
-        "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies";
+            "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies";
     private static final String POLICYTYPES_TCA_POLICIES_VCPE =
-        "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca";
-    private static final String POLICYTYPES_TCA_POLICIES_VCPE_VERSION1 = "policytypes/"
-        + "onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0";
+            "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca";
+    private static final String POLICYTYPES_TCA_POLICIES_VCPE_VERSION1 =
+            "policytypes/" + "onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0";
     private static final String POLICYTYPES_TCA_POLICIES_VCPE_LATEST = "policytypes/"
-        + "onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/latest";
+            + "onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/latest";
 
     private static final String POLICYTYPES_DROOLS_POLICIES_VCPE_VERSION =
-        POLICYTYPES_DROOLS_VERSION + "/policies/" + OP_POLICY_NAME_VCPE + "/versions/1.0.0";
+            POLICYTYPES_DROOLS_VERSION + "/policies/" + OP_POLICY_NAME_VCPE + "/versions/1.0.0";
 
     private static final String POLICIES = "policies";
 
@@ -181,7 +179,7 @@
      * Initializes parameters and set up test environment.
      *
      * @throws PfModelException the PfModel parsing exception
-     * @throws IOException      on I/O exceptions
+     * @throws IOException on I/O exceptions
      */
     @BeforeClass
     public static void setupParameters() throws PfModelException, IOException {
@@ -193,7 +191,7 @@
         providerParams.setDatabasePassword("P01icY");
         providerParams.setPersistenceUnit("ToscaConceptTest");
         apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList(),
-            Collections.emptyList());
+                Collections.emptyList());
         ParameterService.register(apiParamGroup, true);
 
         policyTypeProvider = new PolicyTypeProvider();
@@ -207,7 +205,7 @@
         systemProps.put("javax.net.ssl.keyStorePassword", "Pol1cy_0nap");
         System.setProperties(systemProps);
         new CommonTestData().makeParameters("src/test/resources/parameters/ApiConfigParameters_Https.json",
-            "src/test/resources/parameters/ApiConfigParameters_HttpsXXX.json", apiPort);
+                "src/test/resources/parameters/ApiConfigParameters_HttpsXXX.json", apiPort);
         apiConfigParameters[0] = "-c";
         apiConfigParameters[1] = "src/test/resources/parameters/ApiConfigParameters_HttpsXXX.json";
 
@@ -274,17 +272,17 @@
 
         // Send a policy with no policy type trigger an error
         String toscaPolicy = ResourceUtils
-            .getResourceAsString(TOSCA_POLICY_RESOURCE_NAMES[TOSCA_POLICIES_RESOURCE_NAMES.length - 1]);
+                .getResourceAsString(TOSCA_POLICY_RESOURCE_NAMES[TOSCA_POLICIES_RESOURCE_NAMES.length - 1]);
 
         toscaPolicy = toscaPolicy.replaceAll("onap.policies.monitoring.tcagen2", "IDontExist");
         TextFileUtils.putStringAsTextFile(toscaPolicy, "src/test/resources/policies/BadTestPolicy.yaml");
 
-        Response rawResponse2 = createResource(POLICYTYPES_TCA_POLICIES,
-            "src/test/resources/policies/BadTestPolicy.yaml");
+        Response rawResponse2 =
+                createResource(POLICYTYPES_TCA_POLICIES, "src/test/resources/policies/BadTestPolicy.yaml");
         assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), rawResponse2.getStatus());
         ErrorResponse errorResponse = rawResponse2.readEntity(ErrorResponse.class);
         assertThat(errorResponse.getErrorMessage())
-            .contains("entity in incoming fragment does not equal existing entity");
+                .contains("item \"entity\" value \"onap.restart.tca:1.0.0\" INVALID, does not equal existing entity");
     }
 
     @Test
@@ -298,7 +296,7 @@
 
         // Send a policy with no policy type trigger an error
         String toscaPolicy = ResourceUtils
-            .getResourceAsString(TOSCA_POLICY_RESOURCE_NAMES[TOSCA_POLICIES_RESOURCE_NAMES.length - 1]);
+                .getResourceAsString(TOSCA_POLICY_RESOURCE_NAMES[TOSCA_POLICIES_RESOURCE_NAMES.length - 1]);
 
         toscaPolicy = toscaPolicy.replaceAll("onap.policies.monitoring.tcagen2", "IDontExist");
         toscaPolicy = toscaPolicy.replaceAll("onap.restart.tca", "onap.restart.tca.IDontExist");
@@ -308,7 +306,7 @@
         ErrorResponse errorResponse = rawResponse2.readEntity(ErrorResponse.class);
         assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), rawResponse2.getStatus());
         assertThat(errorResponse.getErrorMessage())
-            .contains("policy type IDontExist:1.0.0 referenced in policy not found");
+                .contains("item \"policy type\" value \"IDontExist:1.0.0\" INVALID, not found");
     }
 
     @SuppressWarnings("unchecked")
@@ -344,18 +342,18 @@
         ToscaServiceTemplate toscaVcpeSt = rawResponse.readEntity(ToscaServiceTemplate.class);
         assertEquals(1, toscaVcpeSt.getToscaTopologyTemplate().getPolicies().size());
         assertEquals(OP_POLICY_NAME_VCPE,
-            toscaVcpeSt.getToscaTopologyTemplate().getPolicies().get(0).get(OP_POLICY_NAME_VCPE).getName());
+                toscaVcpeSt.getToscaTopologyTemplate().getPolicies().get(0).get(OP_POLICY_NAME_VCPE).getName());
 
-        Map<String, Object> props = toscaVcpeSt.getToscaTopologyTemplate().getPolicies().get(0).get(OP_POLICY_NAME_VCPE)
-            .getProperties();
+        Map<String, Object> props =
+                toscaVcpeSt.getToscaTopologyTemplate().getPolicies().get(0).get(OP_POLICY_NAME_VCPE).getProperties();
         assertNotNull(props);
 
         List<Object> operations = (List<Object>) props.get("operations");
         assertEquals(1, operations.size());
         assertEquals(props.get("trigger"), ((Map<String, Object>) operations.get(0)).get("id"));
 
-        Map<String, Object> operation = (Map<String, Object>) ((Map<String, Object>) operations.get(0))
-            .get("operation");
+        Map<String, Object> operation =
+                (Map<String, Object>) ((Map<String, Object>) operations.get(0)).get("operation");
         assertEquals("APPC", operation.get("actor"));
         assertEquals("Restart", operation.get("operation"));
 
@@ -518,11 +516,11 @@
     public void testNamingPolicyGet() throws Exception {
 
         Response rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
-            + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0", APP_JSON);
+                + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0", APP_JSON);
         assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
 
         rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
-            + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0?mode=referenced", APP_JSON);
+                + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0?mode=referenced", APP_JSON);
         assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
 
         ToscaServiceTemplate namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -531,7 +529,7 @@
         assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size());
 
         rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
-            + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/latest?mode=referenced", APP_JSON);
+                + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/latest?mode=referenced", APP_JSON);
         assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
 
         namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -539,8 +537,8 @@
         assertEquals(1, namingServiceTemplate.getPolicyTypesAsMap().size());
         assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size());
 
-        rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/policies?mode=referenced",
-            APP_JSON);
+        rawResponse =
+                readResource("policytypes/onap.policies.Naming/versions/1.0.0/policies?mode=referenced", APP_JSON);
         assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
 
         namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -549,7 +547,7 @@
         assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size());
 
         rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
-            + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0", APP_JSON);
+                + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0", APP_JSON);
         assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
 
         namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -559,7 +557,7 @@
         assertNull(namingServiceTemplate.getDataTypes());
 
         rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
-            + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/latest", APP_JSON);
+                + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/latest", APP_JSON);
         assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
 
         namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -752,12 +750,12 @@
         String mediaType = APP_JSON; // default media type
         ToscaServiceTemplate rawServiceTemplate = new ToscaServiceTemplate();
         if (resourceName.endsWith(".json")) {
-            rawServiceTemplate = standardCoder
-                .decode(ResourceUtils.getResourceAsString(resourceName), ToscaServiceTemplate.class);
+            rawServiceTemplate =
+                    standardCoder.decode(ResourceUtils.getResourceAsString(resourceName), ToscaServiceTemplate.class);
         } else if (resourceName.endsWith(".yaml") || resourceName.endsWith(".yml")) {
             mediaType = APP_YAML;
-            rawServiceTemplate = standardYamlCoder
-                .decode(ResourceUtils.getResourceAsString(resourceName), ToscaServiceTemplate.class);
+            rawServiceTemplate = standardYamlCoder.decode(ResourceUtils.getResourceAsString(resourceName),
+                    ToscaServiceTemplate.class);
         }
 
         final Invocation.Builder invocationBuilder;
@@ -793,8 +791,8 @@
 
         final SSLContext sc = SSLContext.getInstance("TLSv1.2");
         sc.init(null, noopTrustManager, new SecureRandom());
-        final ClientBuilder clientBuilder = ClientBuilder.newBuilder().sslContext(sc)
-            .hostnameVerifier((host, session) -> true);
+        final ClientBuilder clientBuilder =
+                ClientBuilder.newBuilder().sslContext(sc).hostnameVerifier((host, session) -> true);
         final Client client = clientBuilder.build();
         final HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
         client.register(feature);
@@ -841,7 +839,7 @@
     }
 
     private void validateHealthCheckReport(final String name, final String url, final boolean healthy, final int code,
-        final String message, final HealthCheckReport report) {
+            final String message, final HealthCheckReport report) {
 
         assertEquals(name, report.getName());
         assertEquals(url, report.getUrl());
@@ -849,4 +847,4 @@
         assertEquals(code, report.getCode());
         assertEquals(message, report.getMessage());
     }
-}
\ No newline at end of file
+}
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
index 8d99179..e71cfc5 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
@@ -76,16 +76,16 @@
     private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.monitoring.tcagen2.yaml";
     private static final String POLICY_RESOURCE_WITH_BAD_POLICYTYPE_ID = "policies/vCPE.policy.bad.policytypeid.json";
     private static final String POLICY_RESOURCE_WITH_BAD_POLICYTYPE_VERSION =
-        "policies/vCPE.policy.bad.policytypeversion.json";
+            "policies/vCPE.policy.bad.policytypeversion.json";
     private static final String POLICY_RESOURCE_WITH_NO_POLICY_VERSION = "policies/vCPE.policy.no.policyversion.json";
     private static final String POLICY_RESOURCE_WITH_DIFFERENT_FIELDS =
-        "policies/vCPE.policy.different.policy.fields.json";
+            "policies/vCPE.policy.different.policy.fields.json";
     private static final String MULTIPLE_POLICIES_RESOURCE = "policies/vCPE.policies.optimization.input.tosca.json";
 
     public static final String POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON =
-        "policytypes/onap.policies.controlloop.operational.Common.yaml";
+            "policytypes/onap.policies.controlloop.operational.Common.yaml";
     public static final String POLICY_TYPE_RESOURCE_OPERATIONAL_DROOLS =
-        "policytypes/onap.policies.controlloop.operational.common.Drools.yaml";
+            "policytypes/onap.policies.controlloop.operational.common.Drools.yaml";
     private static final String POLICY_RESOURCE_OPERATIONAL = "policies/vCPE.policy.operational.input.tosca.json";
     public static final String POLICY_TYPE_OPERATIONAL_DROOLS = "onap.policies.controlloop.operational.common.Drools";
 
@@ -105,8 +105,8 @@
         providerParams.setDatabaseUser("policy");
         providerParams.setDatabasePassword("P01icY");
         providerParams.setPersistenceUnit("ToscaConceptTest");
-        apiParamGroup =
-            new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList(), Collections.emptyList());
+        apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList(),
+                Collections.emptyList());
         ParameterService.register(apiParamGroup, true);
         policyTypeProvider = new PolicyTypeProvider();
         policyProvider = new PolicyProvider();
@@ -161,7 +161,7 @@
         String policyTypeId = "onap.policies.monitoring.cdap.tca.hi.lo.app";
 
         try (PolicyModelsProvider databaseProvider =
-            new PolicyModelsProviderFactory().createPolicyModelsProvider(providerParams)) {
+                new PolicyModelsProviderFactory().createPolicyModelsProvider(providerParams)) {
             assertEquals(0, databaseProvider.getPdpGroups("name").size());
             assertEquals(0, databaseProvider.getFilteredPdpGroups(PdpGroupFilter.builder().build()).size());
 
@@ -192,14 +192,14 @@
             pdpSubGroup.getPdpInstances().add(pdp);
 
             // Create Pdp Groups
-            assertEquals(123,
-                databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getDesiredInstanceCount());
+            assertEquals(123, databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0)
+                    .getDesiredInstanceCount());
             assertEquals(1, databaseProvider.getPdpGroups("group").size());
 
             // Create Policy Type
             assertThatCode(() -> {
                 ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
-                    .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+                        .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
                 policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
             }).doesNotThrowAnyException();
 
@@ -207,9 +207,9 @@
             assertThatCode(() -> {
                 String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
                 ToscaServiceTemplate policyServiceTemplate =
-                    standardCoder.decode(policyString, ToscaServiceTemplate.class);
+                        standardCoder.decode(policyString, ToscaServiceTemplate.class);
                 ToscaServiceTemplate serviceTemplate =
-                    policyProvider.createPolicy(policyTypeId, policyTypeVersion, policyServiceTemplate);
+                        policyProvider.createPolicy(policyTypeId, policyTypeVersion, policyServiceTemplate);
                 assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
             }).doesNotThrowAnyException();
 
@@ -217,12 +217,12 @@
             pdpSubGroup.setPolicies(new ArrayList<>());
             pdpSubGroup.getPolicies().add(new ToscaPolicyIdentifier(policyId, policyVersion));
             assertEquals(1,
-                databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getPolicies().size());
+                    databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getPolicies().size());
 
             // Test validateDeleteEligibility exception path(!pdpGroups.isEmpty())
             assertThatThrownBy(() -> {
                 policyProvider.deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca",
-                    "1.0.0");
+                        "1.0.0");
             }).hasMessageContaining("policy is in use, it is deployed in PDP group group subgroup type");
         } catch (Exception exc) {
             fail("Test should not throw an exception");
@@ -237,7 +237,7 @@
         }).hasMessage("topology template not specified on service template");
 
         ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
-            .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+                .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         assertThatCode(() -> policyTypeProvider.createPolicyType(policyTypeServiceTemplate)).doesNotThrowAnyException();
@@ -245,60 +245,61 @@
         assertThatThrownBy(() -> {
             String badPolicyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE_WITH_BAD_POLICYTYPE_ID);
             ToscaServiceTemplate badPolicyServiceTemplate =
-                standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
+                    standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
             policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0",
-                badPolicyServiceTemplate);
+                    badPolicyServiceTemplate);
         }).hasMessage(
-            "PolicyType version not specified, the version of the PolicyType for this policy must be specified in the "
-                + "type_version field");
+                "PolicyType version not specified, the version of the PolicyType for this policy must be specified in "
+                        + "the type_version field");
 
         assertThatThrownBy(() -> {
             String badPolicyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE_WITH_BAD_POLICYTYPE_VERSION);
             ToscaServiceTemplate badPolicyServiceTemplate =
-                standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
+                    standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
             policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0",
-                badPolicyServiceTemplate);
+                    badPolicyServiceTemplate);
         }).hasMessageContaining(
-            "policy type onap.policies.monitoring.cdap.tca.hi.lo.app:2.0.0 referenced in policy not found");
+                "item \"policy type\" value \"onap.policies.monitoring.cdap.tca.hi.lo.app:2.0.0\" INVALID, not found");
 
         assertThatThrownBy(() -> {
             String badPolicyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE_WITH_NO_POLICY_VERSION);
             ToscaServiceTemplate badPolicyServiceTemplate =
-                standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
+                    standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
             policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0",
-                badPolicyServiceTemplate);
-        }).hasMessageContaining("key version is a null version");
+                    badPolicyServiceTemplate);
+        }).hasMessageContaining("item \"version\" value \"0.0.0\" INVALID, is null");
 
         String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
         ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
-        ToscaServiceTemplate serviceTemplate =
-            policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+        ToscaServiceTemplate serviceTemplate = policyProvider
+                .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
         assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
 
         assertThatThrownBy(() -> {
             String badPolicyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE_WITH_DIFFERENT_FIELDS);
             ToscaServiceTemplate badPolicyServiceTemplate =
-                standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
+                    standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
             policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0",
-                badPolicyServiceTemplate);
-        }).hasMessageContaining("entity in incoming fragment does not equal existing entity");
+                    badPolicyServiceTemplate);
+        }).hasMessageContaining(
+                "item \"entity\" value \"onap.restart.tca:1.0.0\" INVALID, " + "does not equal existing entity");
     }
 
     @Test
     public void testCreateOperationalDroolsPolicy() throws CoderException, PfModelException {
         ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON), ToscaServiceTemplate.class);
+                ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON), ToscaServiceTemplate.class);
 
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_DROOLS), ToscaServiceTemplate.class);
+                ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_DROOLS), ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE_OPERATIONAL);
         ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
         ToscaServiceTemplate serviceTemplate =
-            policyProvider.createPolicy(POLICY_TYPE_OPERATIONAL_DROOLS, "1.0.0", policyServiceTemplate);
+                policyProvider.createPolicy(POLICY_TYPE_OPERATIONAL_DROOLS, "1.0.0", policyServiceTemplate);
         assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
     }
 
@@ -308,71 +309,74 @@
         assertThatThrownBy(() -> {
             String multiPoliciesString = ResourceUtils.getResourceAsString(MULTIPLE_POLICIES_RESOURCE);
             ToscaServiceTemplate multiPoliciesServiceTemplate =
-                standardCoder.decode(multiPoliciesString, ToscaServiceTemplate.class);
+                    standardCoder.decode(multiPoliciesString, ToscaServiceTemplate.class);
             policyProvider.createPolicies(multiPoliciesServiceTemplate);
         }).hasMessageContaining(
-            "no policy types are defined on the service template for the policies in the topology template");
+                "no policy types are defined on the service template for the policies in the topology template");
 
         // Create required policy types
-        ToscaServiceTemplate policyTypeServiceTemplate =
-            standardYamlCoder.decode(ResourceUtils.getResourceAsString("policytypes/onap.policies.Optimization.yaml"),
+        ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder.decode(
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.Optimization.yaml"),
                 ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.Resource.yaml"),
-            ToscaServiceTemplate.class);
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.Resource.yaml"),
+                ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml"),
-            ToscaServiceTemplate.class);
+                ResourceUtils
+                        .getResourceAsString("policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml"),
+                ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.DistancePolicy.yaml"),
-            ToscaServiceTemplate.class);
+                ResourceUtils
+                        .getResourceAsString("policytypes/onap.policies.optimization.resource.DistancePolicy.yaml"),
+                ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.Vim_fit.yaml"),
-            ToscaServiceTemplate.class);
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.Vim_fit.yaml"),
+                ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.HpaPolicy.yaml"),
-            ToscaServiceTemplate.class);
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.HpaPolicy.yaml"),
+                ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.VnfPolicy.yaml"),
-            ToscaServiceTemplate.class);
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.VnfPolicy.yaml"),
+                ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.Service.yaml"),
-            ToscaServiceTemplate.class);
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.Service.yaml"),
+                ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml"),
-            ToscaServiceTemplate.class);
+                ResourceUtils
+                        .getResourceAsString("policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml"),
+                ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.service.QueryPolicy.yaml"),
-            ToscaServiceTemplate.class);
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.service.QueryPolicy.yaml"),
+                ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         policyTypeServiceTemplate = standardYamlCoder.decode(
-            ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.tcagen2.yaml"),
-            ToscaServiceTemplate.class);
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.tcagen2.yaml"),
+                ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         // Create multiple policies in one call
         String multiPoliciesString = ResourceUtils.getResourceAsString(MULTIPLE_POLICIES_RESOURCE);
         ToscaServiceTemplate multiPoliciesServiceTemplate =
-            standardCoder.decode(multiPoliciesString, ToscaServiceTemplate.class);
+                standardCoder.decode(multiPoliciesString, ToscaServiceTemplate.class);
 
         assertThatCode(() -> {
             policyProvider.createPolicies(multiPoliciesServiceTemplate);
@@ -389,7 +393,7 @@
 
         assertThatCode(() -> {
             ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
-                .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+                    .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
             policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
         }).doesNotThrowAnyException();
 
@@ -397,19 +401,19 @@
             String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
             ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
             ToscaServiceTemplate serviceTemplate = policyProvider
-                .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+                    .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
             assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
         }).doesNotThrowAnyException();
 
         assertThatCode(() -> {
             ToscaServiceTemplate serviceTemplate = policyProvider
-                .deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca", "1.0.0");
+                    .deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca", "1.0.0");
             assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
         }).doesNotThrowAnyException();
 
         assertThatThrownBy(() -> {
             policyProvider.deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca",
-                "1.0.0");
+                    "1.0.0");
         }).hasMessageContaining("no policies found");
     }
 
@@ -417,21 +421,19 @@
     public void testFetchAllPolicies() throws Exception {
         // Create Policy Type
         ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
-            .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+                .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         // Create Policy
         String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
-        ToscaServiceTemplate policyServiceTemplate =
-            standardCoder.decode(policyString, ToscaServiceTemplate.class);
-        ToscaServiceTemplate serviceTemplate = policyProvider.createPolicy(
-            "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+        ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
+        ToscaServiceTemplate serviceTemplate = policyProvider
+                .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
 
         assertThat(serviceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
 
         // Test fetch all policies
-        policyTypeServiceTemplate = policyProvider
-            .fetchPolicies(null,  null, null, null, null);
+        policyTypeServiceTemplate = policyProvider.fetchPolicies(null, null, null, null, null);
 
         assertThat(policyTypeServiceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
     }
@@ -440,80 +442,74 @@
     public void testFetchSpecificPolicy_availablePolicy() throws Exception {
         // Create Policy Type
         ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
-            .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+                .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         // Create Policy
         String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
-        ToscaServiceTemplate policyServiceTemplate =
-            standardCoder.decode(policyString, ToscaServiceTemplate.class);
-        ToscaServiceTemplate serviceTemplate = policyProvider.createPolicy(
-            "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+        ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
+        ToscaServiceTemplate serviceTemplate = policyProvider
+                .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
 
         assertThat(serviceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
 
         // Test fetch specific policy
-        assertThat(policyProvider.fetchPolicies(null,  null, "onap.restart.tca",
-            "1.0.0", null).getToscaTopologyTemplate().getPolicies()).hasSize(1);
+        assertThat(policyProvider.fetchPolicies(null, null, "onap.restart.tca", "1.0.0", null)
+                .getToscaTopologyTemplate().getPolicies()).hasSize(1);
     }
 
     @Test
     public void testFetchSpecificPolicy_unavailablePolicy() throws Exception {
         // Create Policy Type
         ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
-            .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+                .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         // Create Policy
         String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
-        ToscaServiceTemplate policyServiceTemplate =
-            standardCoder.decode(policyString, ToscaServiceTemplate.class);
-        ToscaServiceTemplate serviceTemplate = policyProvider.createPolicy(
-            "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+        ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
+        ToscaServiceTemplate serviceTemplate = policyProvider
+                .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
         assertNotNull(serviceTemplate.getToscaTopologyTemplate().getPolicies());
         assertThat(serviceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
 
         // Test fetch specific policy
-        assertThatThrownBy(() -> policyProvider.fetchPolicies(
-            null,  null, "onap.restart.tca", "2.0.0", null))
-            .hasMessageContaining("policies for onap.restart.tca:2.0.0 do not exist");
+        assertThatThrownBy(() -> policyProvider.fetchPolicies(null, null, "onap.restart.tca", "2.0.0", null))
+                .hasMessageContaining("policies for onap.restart.tca:2.0.0 do not exist");
     }
 
     @Test
     public void testDeleteSpecificPolicy_availablePolicy() throws Exception {
         ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
-            .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+                .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
         ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
-        ToscaServiceTemplate serviceTemplate = policyProvider.createPolicy(
-            "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+        ToscaServiceTemplate serviceTemplate = policyProvider
+                .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
         assertThat(serviceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
 
-        ToscaServiceTemplate svcTemplate = policyProvider
-            .deletePolicy(null, null, "onap.restart.tca", "1.0.0");
+        ToscaServiceTemplate svcTemplate = policyProvider.deletePolicy(null, null, "onap.restart.tca", "1.0.0");
         assertThat(svcTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
     }
 
     @Test
     public void testDeleteSpecificPolicy_unavailablePolicy() throws Exception {
         ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
-            .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+                .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
         policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
 
         String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
         ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
-        ToscaServiceTemplate serviceTemplate = policyProvider.createPolicy(
-            "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+        ToscaServiceTemplate serviceTemplate = policyProvider
+                .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
         assertThat(serviceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
 
-        assertThatThrownBy(() -> policyProvider
-            .deletePolicy(null, null, "onap.restart.tca", "2.0.0"))
-            .hasMessageContaining("not found");
+        assertThatThrownBy(() -> policyProvider.deletePolicy(null, null, "onap.restart.tca", "2.0.0"))
+                .hasMessageContaining("not found");
 
-        assertThatThrownBy(() -> policyProvider.deletePolicy(
-            null, null, "onap.restart.tca.unavailable", "1.0.0"))
-            .hasMessageContaining("not found");
+        assertThatThrownBy(() -> policyProvider.deletePolicy(null, null, "onap.restart.tca.unavailable", "1.0.0"))
+                .hasMessageContaining("not found");
     }
 }
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
index 5c7c25a..9b2f3b8 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
@@ -59,8 +59,7 @@
     private static final String POLICY_TYPE_VERSION = "1.0.0";
 
     private static final String POLICY_RESOURCE_MONITORING = "policies/vCPE.policy.monitoring.input.tosca.yaml";
-    private static final String POLICY_TYPE_RESOURCE_MONITORING =
-            "policytypes/onap.policies.monitoring.tcagen2.yaml";
+    private static final String POLICY_TYPE_RESOURCE_MONITORING = "policytypes/onap.policies.monitoring.tcagen2.yaml";
     private static final String POLICY_TYPE_RESOURCE_WITH_NO_VERSION =
             "policytypes/onap.policies.optimization.Resource.no.version.yaml";
     private static final String POLICY_TYPE_NAME_MONITORING = "onap.policies.monitoring.tcagen2";
@@ -90,8 +89,8 @@
         providerParams.setDatabaseUser("policy");
         providerParams.setDatabasePassword("P01icY");
         providerParams.setPersistenceUnit("ToscaConceptTest");
-        apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams,
-                Collections.emptyList(), Collections.emptyList());
+        apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList(),
+                Collections.emptyList());
         ParameterService.register(apiParamGroup, true);
         policyTypeProvider = new PolicyTypeProvider();
         policyProvider = new PolicyProvider();
@@ -145,20 +144,20 @@
             policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
         }).doesNotThrowAnyException();
 
-        ToscaPolicyType policyType =
-                policyTypeServiceTemplate.getPolicyTypes().get("onap.policies.monitoring.tcagen2");
+        ToscaPolicyType policyType = policyTypeServiceTemplate.getPolicyTypes().get("onap.policies.monitoring.tcagen2");
         policyType.setDescription("Some other description");
 
         assertThatThrownBy(() -> {
             policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
-        }).hasMessageContaining("entity in incoming fragment does not equal existing entity");
+        }).hasMessageContaining("item \"entity\" value \"onap.policies.monitoring.tcagen2:1.0.0\" INVALID, "
+                + "does not equal existing entity");
 
         assertThatThrownBy(() -> {
             ToscaServiceTemplate badPolicyType =
                     standardYamlCoder.decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_WITH_NO_VERSION),
                             ToscaServiceTemplate.class);
             policyTypeProvider.createPolicyType(badPolicyType);
-        }).hasMessageContaining("INVALID:key version is a null version");
+        }).hasMessageContaining("item \"version\" value \"0.0.0\" INVALID, is null");
 
         policyTypeProvider.deletePolicyType(POLICY_TYPE_NAME_MONITORING, POLICY_TYPE_VERSION);
     }
@@ -210,8 +209,8 @@
             policyTypeProvider.deletePolicyType("onap.policies.monitoring.tcagen2", "1.0.0");
         }).hasMessage(exceptionMessage);
 
-        serviceTemplate = policyProvider.deletePolicy("onap.policies.monitoring.tcagen2", "1.0.0",
-                "onap.restart.tca", "1.0.0");
+        serviceTemplate =
+                policyProvider.deletePolicy("onap.policies.monitoring.tcagen2", "1.0.0", "onap.restart.tca", "1.0.0");
         assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
 
         serviceTemplate = policyTypeProvider.deletePolicyType("onap.policies.monitoring.tcagen2", "1.0.0");
