diff --git a/policy-agent/pom.xml b/policy-agent/pom.xml
index 78ff193..b8dcbc4 100644
--- a/policy-agent/pom.xml
+++ b/policy-agent/pom.xml
@@ -48,7 +48,7 @@
     <properties>
         <java.version>11</java.version>
         <springfox.version>2.9.2</springfox.version>
-        <immutable.version>2.7.1</immutable.version>
+        <immutable.version>2.7.4</immutable.version>
         <sdk.version>1.1.6</sdk.version>
         <swagger.version>2.0.0</swagger.version>
         <json.version>20180130</json.version>
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/OscA1Client.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/OscA1Client.java
index d03dbb4..0efe14d 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/clients/OscA1Client.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/OscA1Client.java
@@ -23,7 +23,6 @@
 import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -38,7 +37,7 @@
 public class OscA1Client implements A1Client {
     private static final String URL_PREFIX = "/a1-p";
 
-    private static final String POLICYTYPES = "/policytypes";
+    private static final String POLICY_TYPES = "/policytypes";
     private static final String CREATE_SCHEMA = "create_schema";
     private static final String TITLE = "title";
 
@@ -74,16 +73,14 @@
 
     @Override
     public Mono<List<String>> getPolicyTypeIdentities() {
-        return restClient.get(POLICYTYPES) //
-            .flatMap(this::parseJsonArrayOfString);
+        return getPolicyTypeIds() //
+            .collectList();
     }
 
     @Override
     public Mono<List<String>> getPolicyIdentities() {
-        return getPolicyTypeIdentities() //
-            .flatMapMany(types -> Flux.fromIterable(types)) //
-            .flatMap(type -> getPolicyIdentitiesById(type)) //
-            .flatMap(policyIds -> Flux.fromIterable(policyIds)) //
+        return getPolicyTypeIds() //
+            .flatMap(this::getPolicyIdentitiesByType) //
             .collectList();
     }
 
@@ -108,14 +105,13 @@
     @Override
     public Mono<A1ProtocolType> getProtocolVersion() {
         return restClient.get(HEALTHCHECK) //
-            .flatMap(resp -> Mono.just(A1ProtocolType.OSC_V1));
+            .flatMap(notUsed -> Mono.just(A1ProtocolType.OSC_V1));
     }
 
     @Override
     public Flux<String> deleteAllPolicies() {
-        return getPolicyTypeIdentities() //
-            .flatMapMany(types -> Flux.fromIterable(types)) //
-            .flatMap(typeId -> deletePoliciesForType(typeId)); //
+        return getPolicyTypeIds() //
+            .flatMap(this::deletePoliciesForType);
     }
 
     @Override
@@ -125,10 +121,14 @@
 
     }
 
-    private Mono<List<String>> getPolicyIdentitiesById(String typeId) {
-        String uri = POLICY_IDS_URI.buildAndExpand(typeId).toUriString();
-        return restClient.get(uri) //
-            .flatMap(this::parseJsonArrayOfString);
+    private Flux<String> getPolicyTypeIds() {
+        return restClient.get(POLICY_TYPES) //
+            .flatMapMany(this::parseJsonArrayOfString);
+    }
+
+    private Flux<String> getPolicyIdentitiesByType(String typeId) {
+        return restClient.get(POLICY_IDS_URI.buildAndExpand(typeId).toUriString()) //
+            .flatMapMany(this::parseJsonArrayOfString);
     }
 
     private Mono<String> getCreateSchema(String policyTypeResponse, String policyTypeId) {
@@ -149,12 +149,11 @@
     }
 
     private Flux<String> deletePoliciesForType(String typeId) {
-        return getPolicyIdentitiesById(typeId) //
-            .flatMapMany(policyIds -> Flux.fromIterable(policyIds)) //
-            .flatMap(policyId -> deletePolicyById(typeId, policyId)); //
+        return getPolicyIdentitiesByType(typeId) //
+            .flatMap(policyId -> deletePolicyById(typeId, policyId));
     }
 
-    private Mono<List<String>> parseJsonArrayOfString(String inputString) {
+    private Flux<String> parseJsonArrayOfString(String inputString) {
         try {
             List<String> arrayList = new ArrayList<>();
             JSONArray jsonArray = new JSONArray(inputString);
@@ -162,9 +161,9 @@
                 arrayList.add(jsonArray.getString(i));
             }
             logger.debug("A1 client: received list = {}", arrayList);
-            return Mono.just(arrayList);
+            return Flux.fromIterable(arrayList);
         } catch (JSONException ex) { // invalid json
-            return Mono.error(ex);
+            return Flux.error(ex);
         }
     }
 }
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOnapA1Client.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOnapA1Client.java
index d39c211..44799c8 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOnapA1Client.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOnapA1Client.java
@@ -27,7 +27,6 @@
 import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -35,7 +34,6 @@
 import org.oransc.policyagent.repository.Policy;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
 
@@ -51,7 +49,7 @@
 
     private static Gson gson = new GsonBuilder() //
         .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES) //
-        .create(); //
+        .create();
 
     public SdncOnapA1Client(RicConfig ricConfig, String baseUrl, String username, String password) {
         this(ricConfig, username, password, new AsyncRestClient(baseUrl + "/restconf/operations"));
@@ -69,43 +67,17 @@
 
     @Override
     public Mono<List<String>> getPolicyTypeIdentities() {
-        SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
-            .nearRtRicId(ricConfig.baseUrl()) //
-            .build();
-        String inputJsonString = createInputJsonString(inputParams);
-        logger.debug("POST getPolicyTypeIdentities inputJsonString = {}", inputJsonString);
-
-        return restClient
-            .postWithAuthHeader(URL_PREFIX + "getPolicyTypes", inputJsonString, a1ControllerUsername,
-                a1ControllerPassword) //
-            .flatMap(response -> getValueFromResponse(response, "policy-type-id-list")) //
-            .flatMap(this::parseJsonArrayOfString);
+        return getPolicyTypeIds() //
+            .collectList();
     }
 
     @Override
     public Mono<List<String>> getPolicyIdentities() {
-        return getPolicyTypeIdentities() //
-            .flatMapMany(types -> Flux.fromIterable(types)) //
-            .flatMap(type -> getPolicyIdentities(type)) //
-            .flatMap(policyIds -> Flux.fromIterable(policyIds)) //
+        return getPolicyTypeIds() //
+            .flatMap(this::getPolicyIdentitiesByType) //
             .collectList();
     }
 
-    public Mono<List<String>> getPolicyIdentities(String policyTypeId) {
-        SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
-            .nearRtRicId(ricConfig.baseUrl()) //
-            .policyTypeId(policyTypeId) //
-            .build();
-        String inputJsonString = createInputJsonString(inputParams);
-        logger.debug("POST getPolicyIdentities inputJsonString = {}", inputJsonString);
-
-        return restClient
-            .postWithAuthHeader(URL_PREFIX + "getPolicyInstances", inputJsonString, a1ControllerUsername,
-                a1ControllerPassword) //
-            .flatMap(response -> getValueFromResponse(response, "policy-instance-id-list")) //
-            .flatMap(this::parseJsonArrayOfString);
-    }
-
     @Override
     public Mono<String> getPolicyTypeSchema(String policyTypeId) {
         SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
@@ -131,6 +103,7 @@
             .policyInstance(policy.json()) //
             .properties(new ArrayList<String>()) //
             .build();
+
         String inputJsonString = createInputJsonString(inputParams);
         logger.debug("POST putPolicy inputJsonString = {}", inputJsonString);
 
@@ -138,35 +111,21 @@
             a1ControllerUsername, a1ControllerPassword);
     }
 
-    public Mono<String> deletePolicyByIds(String policyTypeId, String policyId) {
-        SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
-            .nearRtRicId(ricConfig.baseUrl()) //
-            .policyTypeId(policyTypeId) //
-            .policyInstanceId(policyId) //
-            .build();
-        String inputJsonString = createInputJsonString(inputParams);
-        logger.debug("POST deletePolicy inputJsonString = {}", inputJsonString);
-
-        return restClient.postWithAuthHeader(URL_PREFIX + "deletePolicyInstance", inputJsonString,
-            a1ControllerUsername, a1ControllerPassword);
-    }
-
     @Override
     public Mono<String> deletePolicy(Policy policy) {
-        return deletePolicyByIds(policy.type().name(), policy.id());
+        return deletePolicyByTypeId(policy.type().name(), policy.id());
     }
 
     @Override
     public Flux<String> deleteAllPolicies() {
-        return getPolicyTypeIdentities() //
-            .flatMapMany(types -> Flux.fromIterable(types)) //
-            .flatMap(typeId -> deletePoliciesForType(typeId)); //
+        return getPolicyTypeIds() //
+            .flatMap(this::deletePoliciesForType); //
     }
 
     @Override
     public Mono<A1ProtocolType> getProtocolVersion() {
         return getPolicyTypeIdentities() //
-            .flatMap(x -> Mono.just(A1ProtocolType.SDNC_ONAP));
+            .flatMap(notUsed -> Mono.just(A1ProtocolType.SDNC_ONAP));
     }
 
     @Override
@@ -174,6 +133,35 @@
         return Mono.error(new Exception("Status not implemented in the controller"));
     }
 
+    private Flux<String> getPolicyTypeIds() {
+        SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
+            .nearRtRicId(ricConfig.baseUrl()) //
+            .build();
+        String inputJsonString = createInputJsonString(inputParams);
+        logger.debug("POST getPolicyTypeIdentities inputJsonString = {}", inputJsonString);
+
+        return restClient
+            .postWithAuthHeader("/A1-ADAPTER-API:getPolicyTypes", inputJsonString, a1ControllerUsername,
+                a1ControllerPassword) //
+            .flatMap(response -> getValueFromResponse(response, "policy-type-id-list")) //
+            .flatMapMany(this::parseJsonArrayOfString);
+    }
+
+    private Flux<String> getPolicyIdentitiesByType(String policyTypeId) {
+        SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
+            .nearRtRicId(ricConfig.baseUrl()) //
+            .policyTypeId(policyTypeId) //
+            .build();
+        String inputJsonString = createInputJsonString(inputParams);
+        logger.debug("POST getPolicyIdentities inputJsonString = {}", inputJsonString);
+
+        return restClient
+            .postWithAuthHeader("/A1-ADAPTER-API:getPolicyInstances", inputJsonString, a1ControllerUsername,
+                a1ControllerPassword) //
+            .flatMap(response -> getValueFromResponse(response, "policy-instance-id-list")) //
+            .flatMapMany(this::parseJsonArrayOfString);
+    }
+
     private Mono<String> getValueFromResponse(String response, String key) {
         logger.debug("A1 client: response = {}", response);
         try {
@@ -189,20 +177,19 @@
         }
     }
 
-    private Mono<List<String>> parseJsonArrayOfString(String inputString) {
+    private Flux<String> parseJsonArrayOfString(String inputString) {
         try {
             List<String> arrayList = new ArrayList<>();
-            if (inputString.isEmpty()) {
-                return Mono.just(arrayList);
-            }
-            JSONArray jsonArray = new JSONArray(inputString);
-            for (int i = 0; i < jsonArray.length(); i++) {
-                arrayList.add(jsonArray.getString(i));
+            if (!inputString.isEmpty()) {
+                JSONArray jsonArray = new JSONArray(inputString);
+                for (int i = 0; i < jsonArray.length(); i++) {
+                    arrayList.add(jsonArray.getString(i));
+                }
             }
             logger.debug("A1 client: received list = {}", arrayList);
-            return Mono.just(arrayList);
+            return Flux.fromIterable(arrayList);
         } catch (JSONException ex) { // invalid json
-            return Mono.error(ex);
+            return Flux.error(ex);
         }
     }
 
@@ -218,14 +205,26 @@
     }
 
     private Flux<String> deletePoliciesForType(String typeId) {
-        return getPolicyIdentities(typeId) //
-            .flatMapMany(policyIds -> Flux.fromIterable(policyIds)) //
-            .flatMap(policyId -> deletePolicyByIds(typeId, policyId)); //
+        return getPolicyIdentitiesByType(typeId) //
+            .flatMap(policyId -> deletePolicyByTypeId(typeId, policyId)); //
     }
 
-    private String createInputJsonString(SdncOnapAdapterInput inputParams) {
+    private Mono<String> deletePolicyByTypeId(String policyTypeId, String policyId) {
+        SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
+            .nearRtRicId(ricConfig.baseUrl()) //
+            .policyTypeId(policyTypeId) //
+            .policyInstanceId(policyId) //
+            .build();
+        String inputJsonString = createInputJsonString(inputParams);
+        logger.debug("POST deletePolicy inputJsonString = {}", inputJsonString);
+
+        return restClient.postWithAuthHeader("/A1-ADAPTER-API:deletePolicyInstance", inputJsonString,
+            a1ControllerUsername, a1ControllerPassword);
+    }
+
+    private String createInputJsonString(SdncOnapAdapterInput params) {
         JSONObject inputJson = new JSONObject();
-        inputJson.put("input", new JSONObject(gson.toJson(inputParams)));
+        inputJson.put("input", new JSONObject(gson.toJson(params)));
         return inputJson.toString();
     }
 }
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java
index 4000b36..bbb3121 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java
@@ -26,7 +26,6 @@
 import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -34,7 +33,6 @@
 import org.oransc.policyagent.repository.Policy;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
 
@@ -78,22 +76,14 @@
             .postWithAuthHeader(URL_PREFIX + "getPolicyTypeIdentities", inputJsonString, a1ControllerUsername,
                 a1ControllerPassword) //
             .flatMap(response -> getValueFromResponse(response, "policy-type-id-list")) //
-            .flatMap(this::parseJsonArrayOfString);
+            .flatMapMany(this::parseJsonArrayOfString) //
+            .collectList();
     }
 
     @Override
     public Mono<List<String>> getPolicyIdentities() {
-        SdncOscAdapterInput inputParams = ImmutableSdncOscAdapterInput.builder() //
-            .nearRtRicUrl(ricConfig.baseUrl()) //
-            .build();
-        String inputJsonString = createInputJsonString(inputParams);
-        logger.debug("POST getPolicyIdentities inputJsonString = {}", inputJsonString);
-
-        return restClient
-            .postWithAuthHeader(URL_PREFIX + "getPolicyIdentities", inputJsonString, a1ControllerUsername,
-                a1ControllerPassword) //
-            .flatMap(response -> getValueFromResponse(response, "policy-id-list")) //
-            .flatMap(this::parseJsonArrayOfString);
+        return getPolicyIds() //
+            .collectList();
     }
 
     @Override
@@ -136,9 +126,8 @@
 
     @Override
     public Flux<String> deleteAllPolicies() {
-        return getPolicyIdentities() //
-            .flatMapMany(policyIds -> Flux.fromIterable(policyIds)) // )
-            .flatMap(policyId -> deletePolicyById(policyId)); //
+        return getPolicyIds() //
+            .flatMap(this::deletePolicyById); //
     }
 
     @Override
@@ -152,6 +141,20 @@
         return Mono.error(new Exception("Status not implemented in the SDNC controller"));
     }
 
+    private Flux<String> getPolicyIds() {
+        SdncOscAdapterInput inputParams = ImmutableSdncOscAdapterInput.builder() //
+            .nearRtRicUrl(ricConfig.baseUrl()) //
+            .build();
+        String inputJsonString = createInputJsonString(inputParams);
+        logger.debug("POST getPolicyIdentities inputJsonString = {}", inputJsonString);
+
+        return restClient
+            .postWithAuthHeader("/A1-ADAPTER-API:getPolicyIdentities", inputJsonString, a1ControllerUsername,
+                a1ControllerPassword) //
+            .flatMap(response -> getValueFromResponse(response, "policy-id-list")) //
+            .flatMapMany(this::parseJsonArrayOfString);
+    }
+
     private Mono<String> getValueFromResponse(String response, String key) {
         logger.debug("A1 client: response = {}", response);
         try {
@@ -167,20 +170,19 @@
         }
     }
 
-    private Mono<List<String>> parseJsonArrayOfString(String inputString) {
+    private Flux<String> parseJsonArrayOfString(String inputString) {
         try {
             List<String> arrayList = new ArrayList<>();
-            if (inputString.isEmpty()) {
-                return Mono.just(arrayList);
-            }
-            JSONArray jsonArray = new JSONArray(inputString);
-            for (int i = 0; i < jsonArray.length(); i++) {
-                arrayList.add(jsonArray.getString(i));
+            if (!inputString.isEmpty()) {
+                JSONArray jsonArray = new JSONArray(inputString);
+                for (int i = 0; i < jsonArray.length(); i++) {
+                    arrayList.add(jsonArray.getString(i));
+                }
             }
             logger.debug("A1 client: received list = {}", arrayList);
-            return Mono.just(arrayList);
+            return Flux.fromIterable(arrayList);
         } catch (JSONException ex) { // invalid json
-            return Mono.error(ex);
+            return Flux.error(ex);
         }
     }
 
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/StdA1Client.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/StdA1Client.java
index 7a43f3c..8f4334c 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/clients/StdA1Client.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/StdA1Client.java
@@ -37,7 +37,7 @@
 public class StdA1Client implements A1Client {
     private static final String URL_PREFIX = "/A1-P/v1";
 
-    private static final String POLICYTYPES_URI = "/policytypes";
+    private static final String POLICY_TYPES_URI = "/policytypes";
     private static final String POLICY_TYPE_ID = "policyTypeId";
 
     private static final String POLICIES_URI = "/policies";
@@ -70,8 +70,8 @@
 
     @Override
     public Mono<List<String>> getPolicyIdentities() {
-        return restClient.get(POLICIES_URI) //
-            .flatMap(this::parseJsonArrayOfString);
+        return getPolicyIds() //
+            .collectList();
     }
 
     @Override
@@ -83,8 +83,9 @@
 
     @Override
     public Mono<List<String>> getPolicyTypeIdentities() {
-        return restClient.get(POLICYTYPES_URI) //
-            .flatMap(this::parseJsonArrayOfString);
+        return restClient.get(POLICY_TYPES_URI) //
+            .flatMapMany(this::parseJsonArrayOfString) //
+            .collectList();
     }
 
     @Override
@@ -101,9 +102,8 @@
 
     @Override
     public Flux<String> deleteAllPolicies() {
-        return getPolicyIdentities() //
-            .flatMapMany(policyIds -> Flux.fromIterable(policyIds)) // )
-            .flatMap(policyId -> deletePolicyById(policyId)); //
+        return getPolicyIds() //
+            .flatMap(this::deletePolicyById); //
     }
 
     @Override
@@ -118,12 +118,17 @@
         return restClient.get(uri);
     }
 
+    private Flux<String> getPolicyIds() {
+        return restClient.get(POLICIES_URI) //
+            .flatMapMany(this::parseJsonArrayOfString);
+    }
+
     private Mono<String> deletePolicyById(String policyId) {
         String uri = POLICY_DELETE_URI.buildAndExpand(policyId).toUriString();
         return restClient.delete(uri);
     }
 
-    private Mono<List<String>> parseJsonArrayOfString(String inputString) {
+    private Flux<String> parseJsonArrayOfString(String inputString) {
         try {
             List<String> arrayList = new ArrayList<>();
             JSONArray jsonArray = new JSONArray(inputString);
@@ -131,9 +136,9 @@
                 arrayList.add(jsonArray.getString(i));
             }
             logger.debug("A1 client: received list = {}", arrayList);
-            return Mono.just(arrayList);
+            return Flux.fromIterable(arrayList);
         } catch (JSONException ex) { // invalid json
-            return Mono.error(ex);
+            return Flux.error(ex);
         }
     }
 
diff --git a/policy-agent/src/test/java/org/oransc/policyagent/clients/SdncOscA1ClientTest.java b/policy-agent/src/test/java/org/oransc/policyagent/clients/SdncOscA1ClientTest.java
index b451a0a..f5b3b25 100644
--- a/policy-agent/src/test/java/org/oransc/policyagent/clients/SdncOscA1ClientTest.java
+++ b/policy-agent/src/test/java/org/oransc/policyagent/clients/SdncOscA1ClientTest.java
@@ -44,9 +44,9 @@
     private static final String CONTROLLER_USERNAME = "username";
     private static final String CONTROLLER_PASSWORD = "password";
     private static final String RIC_1_URL = "RicUrl";
-    private static final String POLICYTYPES_IDENTITIES_URL = "/A1-ADAPTER-API:getPolicyTypeIdentities";
-    private static final String POLICIES_IDENTITIES_URL = "/A1-ADAPTER-API:getPolicyIdentities";
-    private static final String POLICYTYPES_URL = "/A1-ADAPTER-API:getPolicyType";
+    private static final String POLICY_TYPES_IDENTITIES_URL = "/A1-ADAPTER-API:getPolicyTypeIdentities";
+    private static final String POLICY_IDENTITIES_URL = "/A1-ADAPTER-API:getPolicyIdentities";
+    private static final String POLICY_TYPES_URL = "/A1-ADAPTER-API:getPolicyType";
     private static final String PUT_POLICY_URL = "/A1-ADAPTER-API:putPolicy";
     private static final String DELETE_POLICY_URL = "/A1-ADAPTER-API:deletePolicy";
 
@@ -84,8 +84,8 @@
 
         Mono<List<String>> returnedMono = clientUnderTest.getPolicyTypeIdentities();
 
-        verify(asyncRestClientMock).postWithAuthHeader(POLICYTYPES_IDENTITIES_URL, inputJsonString, CONTROLLER_USERNAME,
-            CONTROLLER_PASSWORD);
+        verify(asyncRestClientMock).postWithAuthHeader(POLICY_TYPES_IDENTITIES_URL, inputJsonString,
+            CONTROLLER_USERNAME, CONTROLLER_PASSWORD);
         StepVerifier.create(returnedMono).expectNext(policyTypeIds).expectComplete().verify();
     }
 
@@ -102,7 +102,7 @@
 
         Mono<List<String>> returnedMono = clientUnderTest.getPolicyIdentities();
 
-        verify(asyncRestClientMock).postWithAuthHeader(POLICIES_IDENTITIES_URL, inputJsonString, CONTROLLER_USERNAME,
+        verify(asyncRestClientMock).postWithAuthHeader(POLICY_IDENTITIES_URL, inputJsonString, CONTROLLER_USERNAME,
             CONTROLLER_PASSWORD);
         StepVerifier.create(returnedMono).expectNext(policyIds).expectComplete().verify();
     }
@@ -121,7 +121,7 @@
 
         Mono<String> returnedMono = clientUnderTest.getPolicyTypeSchema(POLICY_TYPE_1_ID);
 
-        verify(asyncRestClientMock).postWithAuthHeader(POLICYTYPES_URL, inputJsonString, CONTROLLER_USERNAME,
+        verify(asyncRestClientMock).postWithAuthHeader(POLICY_TYPES_URL, inputJsonString, CONTROLLER_USERNAME,
             CONTROLLER_PASSWORD);
         StepVerifier.create(returnedMono).expectNext(POLICY_TYPE_SCHEMA_VALID).expectComplete().verify();
     }
@@ -140,7 +140,7 @@
 
         Mono<String> returnedMono = clientUnderTest.getPolicyTypeSchema(POLICY_TYPE_1_ID);
 
-        verify(asyncRestClientMock).postWithAuthHeader(POLICYTYPES_URL, inputJsonString, CONTROLLER_USERNAME,
+        verify(asyncRestClientMock).postWithAuthHeader(POLICY_TYPES_URL, inputJsonString, CONTROLLER_USERNAME,
             CONTROLLER_PASSWORD);
         StepVerifier.create(returnedMono).expectErrorMatches(throwable -> throwable instanceof JSONException).verify();
     }
@@ -229,7 +229,7 @@
         Flux<String> returnedFlux = clientUnderTest.deleteAllPolicies();
 
         StepVerifier.create(returnedFlux).expectComplete().verify();
-        verify(asyncRestClientMock).postWithAuthHeader(POLICIES_IDENTITIES_URL, inputJsonStringGetIds,
+        verify(asyncRestClientMock).postWithAuthHeader(POLICY_IDENTITIES_URL, inputJsonStringGetIds,
             CONTROLLER_USERNAME, CONTROLLER_PASSWORD);
         verify(asyncRestClientMock).postWithAuthHeader(DELETE_POLICY_URL, inputJsonStringDeletePolicy1,
             CONTROLLER_USERNAME, CONTROLLER_PASSWORD);
diff --git a/policy-agent/src/test/java/org/oransc/policyagent/clients/StdA1ClientTest.java b/policy-agent/src/test/java/org/oransc/policyagent/clients/StdA1ClientTest.java
index 40f09b9..f4e6821 100644
--- a/policy-agent/src/test/java/org/oransc/policyagent/clients/StdA1ClientTest.java
+++ b/policy-agent/src/test/java/org/oransc/policyagent/clients/StdA1ClientTest.java
@@ -21,7 +21,6 @@
 package org.oransc.policyagent.clients;
 
 import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -41,9 +40,9 @@
 @ExtendWith(MockitoExtension.class)
 public class StdA1ClientTest {
     private static final String RIC_URL = "RicUrl";
-    private static final String POLICYTYPES_IDENTITIES_URL = "/policytypes";
+    private static final String POLICY_TYPES_IDENTITIES_URL = "/policytypes";
     private static final String POLICIES_IDENTITIES_URL = "/policies";
-    private static final String POLICYTYPES_URL = "/policytypes/";
+    private static final String POLICY_TYPES_URL = "/policytypes/";
     private static final String POLICIES_URL = "/policies/";
 
     private static final String POLICY_TYPE_1_NAME = "type1";
@@ -69,42 +68,45 @@
     @Test
     public void testGetPolicyTypeIdentities() {
         Mono<String> policyTypeIds = Mono.just(Arrays.asList(POLICY_TYPE_1_NAME, POLICY_TYPE_2_NAME).toString());
-        when(asyncRestClientMock.get(POLICYTYPES_IDENTITIES_URL)).thenReturn(policyTypeIds);
+        when(asyncRestClientMock.get(anyString())).thenReturn(policyTypeIds);
 
         Mono<?> policyTypeIdsFlux = clientUnderTest.getPolicyTypeIdentities();
-        verify(asyncRestClientMock).get(POLICYTYPES_IDENTITIES_URL);
+
+        verify(asyncRestClientMock).get(POLICY_TYPES_IDENTITIES_URL);
         StepVerifier.create(policyTypeIdsFlux).expectNextCount(1).expectComplete().verify();
     }
 
     @Test
     public void testGetPolicyIdentities() {
         Mono<String> policyIds = Mono.just(Arrays.asList(POLICY_1_ID, POLICY_2_ID).toString());
-        when(asyncRestClientMock.get(POLICIES_IDENTITIES_URL)).thenReturn(policyIds);
+        when(asyncRestClientMock.get(anyString())).thenReturn(policyIds);
 
         Mono<?> policyIdsFlux = clientUnderTest.getPolicyIdentities();
+
         verify(asyncRestClientMock).get(POLICIES_IDENTITIES_URL);
         StepVerifier.create(policyIdsFlux).expectNextCount(1).expectComplete().verify();
     }
 
     @Test
     public void testGetValidPolicyType() {
-        Mono<?> policyTypeResp =
+        Mono<String> policyTypeResp =
             Mono.just("{\"policySchema\": " + POLICY_TYPE_SCHEMA_VALID + ", \"statusSchema\": {} }");
 
-        doReturn(policyTypeResp).when(asyncRestClientMock).get(POLICYTYPES_URL + POLICY_TYPE_1_NAME);
+        when(asyncRestClientMock.get(anyString())).thenReturn(policyTypeResp);
 
         Mono<String> policyTypeMono = clientUnderTest.getPolicyTypeSchema(POLICY_TYPE_1_NAME);
-        verify(asyncRestClientMock).get(POLICYTYPES_URL + POLICY_TYPE_1_NAME);
+
+        verify(asyncRestClientMock).get(POLICY_TYPES_URL + POLICY_TYPE_1_NAME);
         StepVerifier.create(policyTypeMono).expectNext(POLICY_TYPE_SCHEMA_VALID).expectComplete().verify();
     }
 
     @Test
     public void testGetInvalidPolicyType() {
-        when(asyncRestClientMock.get(POLICYTYPES_URL + POLICY_TYPE_1_NAME))
-            .thenReturn(Mono.just(POLICY_TYPE_SCHEMA_INVALID));
+        when(asyncRestClientMock.get(anyString())).thenReturn(Mono.just(POLICY_TYPE_SCHEMA_INVALID));
 
         Mono<String> policyTypeMono = clientUnderTest.getPolicyTypeSchema(POLICY_TYPE_1_NAME);
-        verify(asyncRestClientMock).get(POLICYTYPES_URL + POLICY_TYPE_1_NAME);
+
+        verify(asyncRestClientMock).get(POLICY_TYPES_URL + POLICY_TYPE_1_NAME);
         StepVerifier.create(policyTypeMono).expectErrorMatches(throwable -> throwable instanceof JSONException)
             .verify();
     }
@@ -115,6 +117,7 @@
 
         Mono<String> policyMono = clientUnderTest
             .putPolicy(A1ClientHelper.createPolicy(RIC_URL, POLICY_1_ID, POLICY_JSON_VALID, POLICY_TYPE));
+
         verify(asyncRestClientMock).put(POLICIES_URL + POLICY_1_ID + "?policyTypeId=" + POLICY_TYPE, POLICY_JSON_VALID);
         StepVerifier.create(policyMono).expectNext(POLICY_JSON_VALID).expectComplete().verify();
     }
@@ -125,6 +128,7 @@
 
         Mono<String> policyMono = clientUnderTest
             .putPolicy(A1ClientHelper.createPolicy(RIC_URL, POLICY_1_ID, POLICY_JSON_VALID, POLICY_TYPE));
+
         StepVerifier.create(policyMono).expectErrorMatches(throwable -> throwable instanceof JSONException).verify();
     }
 
