diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/model/src/main/yang/NONRT-RIC-API.yang b/sdnc-a1-controller/northbound/nonrt-ric-api/model/src/main/yang/NONRT-RIC-API.yang
index b6a2869..806bdc1 100644
--- a/sdnc-a1-controller/northbound/nonrt-ric-api/model/src/main/yang/NONRT-RIC-API.yang
+++ b/sdnc-a1-controller/northbound/nonrt-ric-api/model/src/main/yang/NONRT-RIC-API.yang
@@ -15,8 +15,8 @@
 
 ///Flattend interface using RPC
 
-    //Get a comma separated list of near-rt rics, e.g. domain-name1:port1,domainname2:port2
-    //Each item in the returned list will be regarded as one near-rt-ric-id.
+    //Get an array of near-rt-ric IDs,
+    //Each item in the returned array will be regarded as one near-rt-ric-id.
     rpc getNearRT-RICs {
         output {
             leaf-list near-rt-ric-id-list {
@@ -37,11 +37,11 @@
             leaf health-status {
                 type boolean;
             }
-        }   
+        }
     }
 
-    //Get a comma separated list of integer policy type ids
-    //Each item in the returned list will be regarded as one policy-type-id.
+    //Get an array of integer policy type ids
+    //Each item in the returned array will be regarded as one policy-type-id.
     rpc getPolicyTypes {
         input {
             leaf near-rt-ric-id {
@@ -120,8 +120,8 @@
         }
     }
 
-    //Get a comma separeated list of string policy instance ids
-    //Each item in the returned list will be regarded as one policy-instance-id.
+    //Get an array of string policy instance ids
+    //Each item in the returned array will be regarded as one policy-instance-id.
     rpc getPolicyInstances {
         input {
             leaf near-rt-ric-id {
@@ -156,7 +156,7 @@
             }
         }
     }
-    
+
     ///Get a policy instance
     rpc getPolicyInstance {
         input {
@@ -176,7 +176,7 @@
             }
         }
     }
-    
+
     //Delete a policy instance
     rpc deletePolicyInstance {
         input {
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java
index 7f29fd1..66af597 100644
--- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java
+++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java
@@ -61,6 +61,7 @@
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetHealthCheckOutputBuilder;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetNearRTRICsInput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetNearRTRICsOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetNearRTRICsOutputBuilder;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetPolicyInstanceInput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetPolicyInstanceOutput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetPolicyInstanceOutputBuilder;
@@ -272,8 +273,13 @@
 
   @Override
   public ListenableFuture<RpcResult<GetNearRTRICsOutput>> getNearRTRICs(GetNearRTRICsInput input) {
-    // TODO Auto-generated method stub
-    return null;
+      log.info("Start of getNearRTRICs");
+      GetNearRTRICsOutputBuilder responseBuilder = new GetNearRTRICsOutputBuilder();
+      responseBuilder.setNearRtRicIdList(nearRicUrlProvider.getNearRTRicIdsList());
+      log.info("End of getNearRTRICs");
+      RpcResult<GetNearRTRICsOutput> rpcResult = RpcResultBuilder.<GetNearRTRICsOutput>status(true)
+          .withResult(responseBuilder.build()).build();
+      return Futures.immediateFuture(rpcResult);
   }
 
   @Override
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java
index 496b4bd..14c34e4 100644
--- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java
+++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java
@@ -20,6 +20,15 @@
 
 package org.onap.sdnc.northbound.restadpter;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Properties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.web.util.UriComponentsBuilder;
 
 /**
@@ -31,10 +40,42 @@
 
 public class NearRicUrlProvider {
 
-  private String baseUrl;
+  // nearRicMap provides mapping from nearRtRicId to domainname:port of nearRTRics
+  private HashMap<String, String> nearRicMap = new HashMap<>();
+  private static final String NEAR_RIC_LIST_FILE = "NearRtRicList.properties";
+  private final Logger log = LoggerFactory.getLogger(NearRicUrlProvider.class);
 
   public NearRicUrlProvider() {
-    // Near ric ip:port is passed in payload currently
+      try {
+        readNearRtRicConfigFile();
+      } catch (IOException ex) {
+        log.error("Exception while reading nearRtRicConfigFile: {}", ex);
+      }
+  }
+
+  private void readNearRtRicConfigFile() throws IOException {
+      InputStream inputStream = NearRicUrlProvider.class.getClassLoader().getResourceAsStream(NEAR_RIC_LIST_FILE);
+      if (inputStream == null) {
+          log.error("The file {} not found in classpath", NEAR_RIC_LIST_FILE);
+      } else {
+          Properties properties = new Properties();
+          properties.load(inputStream);
+          Enumeration<?> keys = properties.propertyNames();
+          while (keys.hasMoreElements()) {
+              String key = (String) keys.nextElement();
+              nearRicMap.put(key, properties.getProperty(key));
+          }
+          inputStream.close();
+      }
+  }
+
+  /**
+   * Retrieve the list of Near-RICs
+   *
+   * @return the list of Near-RICs
+   */
+  public List<String> getNearRTRicIdsList () {
+      return new ArrayList<>(nearRicMap.keySet());
   }
 
   /**
@@ -43,7 +84,7 @@
    * @return the base url
    */
   public String getBaseUrl(final String nearRtRicId) {
-    baseUrl = "http://" + nearRtRicId + "/a1-p/";
+    String baseUrl = "http://" + nearRicMap.get(nearRtRicId) + "/a1-p/";
     return UriComponentsBuilder.fromUriString(baseUrl).build().toString();
   }
 
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/NearRtRicList.properties b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/NearRtRicList.properties
new file mode 100644
index 0000000..948c2f7
--- /dev/null
+++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/NearRtRicList.properties
@@ -0,0 +1,23 @@
+# ========================LICENSE_START=================================
+# O-RAN-SC
+# %%
+# Copyright (C) 2019 Nordix Foundation
+# %%
+# Licensed 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.
+# ========================LICENSE_END===================================
+
+# Defines the list of nearRTRics that the SDNC can contact,
+# where key is nearRTRicId and value is domainname:port of a nearRTRic.
+
+NearRtRic1 = nearRtRic-sim1:8080
+NearRtRic2 = nearRtRic-sim2:8080
\ No newline at end of file
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/onap/sdnc/northbound/NonrtRicApiProviderTest.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/onap/sdnc/northbound/NonrtRicApiProviderTest.java
index 9c40a88..e67304c 100644
--- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/onap/sdnc/northbound/NonrtRicApiProviderTest.java
+++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/onap/sdnc/northbound/NonrtRicApiProviderTest.java
@@ -23,6 +23,8 @@
 import static org.mockito.Matchers.anyObject;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.when;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
@@ -40,14 +42,8 @@
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.CreatePolicyInstanceInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.CreatePolicyInstanceOutput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.CreatePolicyTypeInputBuilder;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.CreatePolicyTypeOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.DeletePolicyInstanceInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.DeletePolicyInstanceOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.DeletePolicyTypeInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.DeletePolicyTypeOutput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetHealthCheckInputBuilder;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetHealthCheckOutput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetPolicyInstanceInputBuilder;
@@ -61,15 +57,12 @@
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetStatusInputBuilder;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetStatusOutput;
 import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.oransc.ric.a1med.client.model.PolicyTypeSchema;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.ListenableFuture;
 
 /**
  * This class Tests all the methods in NonrtRicApiProvider
- * 
+ *
  * @author lathishbabu.ganesan@est.tech
  *
  */
@@ -87,6 +80,7 @@
   @Mock
   private RestAdapter restAdapter;
   private NearRicUrlProvider nearRicUrlProvider;
+  private static String nearRtRicId = "NearRtRic1";
   private static Long policyTypeId = 11L;
   private static String policyTypeInstanceId = "12";
 
@@ -102,10 +96,11 @@
   @Test
   public void testCreatePolicyType() throws InterruptedException, ExecutionException {
     CreatePolicyTypeInputBuilder inputBuilder = new CreatePolicyTypeInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     inputBuilder.setPolicyTypeId(policyTypeId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri =
-        nearRicUrlProvider.getPolicyTypeId(String.valueOf(inputBuilder.build().getPolicyTypeId()));
+    String uri = nearRicUrlProvider.getPolicyTypeId(inputBuilder.build().getNearRtRicId(),
+                String.valueOf(inputBuilder.build().getPolicyTypeId()));
     Optional<Object> createPolicyTyperesponse = null;
     when(restAdapter.put(eq(uri), anyObject())).thenReturn(createPolicyTyperesponse);
     ListenableFuture<RpcResult<CreatePolicyTypeOutput>> result =
@@ -116,127 +111,93 @@
   @Test
   public void testGetPolicyType() throws InterruptedException, ExecutionException {
     GetPolicyTypeInputBuilder inputBuilder = new GetPolicyTypeInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     inputBuilder.setPolicyTypeId(policyTypeId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri =
-        nearRicUrlProvider.getPolicyTypeId(String.valueOf(inputBuilder.build().getPolicyTypeId()));
-    PolicyTypeSchema policyTypeSchema = new PolicyTypeSchema();
-    policyTypeSchema.setName("AdmissionControlPolicy");
-    policyTypeSchema.setCreateSchema("{}");
-    when(restAdapter.get(eq(uri), anyObject())).thenReturn(Optional.of(policyTypeSchema));
+    String uri = nearRicUrlProvider.getPolicyTypeId(inputBuilder.build().getNearRtRicId(),
+            String.valueOf(inputBuilder.build().getPolicyTypeId()));
+    String policyType =
+            "{\"name\":\"Policy type 1\",\"description\":\"PT 1\",\"policy_type_id\":1,\"create_schema\":{}}";
+    when(restAdapter.get(eq(uri), anyObject())).thenReturn(Optional.of(policyType));
     ListenableFuture<RpcResult<GetPolicyTypeOutput>> result =
         nonrtRicApiProvider.getPolicyType(inputBuilder.build());
-    Assert.assertEquals(policyTypeSchema.getName(), result.get().getResult().getName());
+    Assert.assertEquals("Policy type 1", result.get().getResult().getName());
   }
 
   @Test
   public void testGetPolicyTypes() throws InterruptedException, ExecutionException {
     GetPolicyTypesInputBuilder inputBuilder = new GetPolicyTypesInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getPolicyTypes();
-    List<Long> policyTypes = new ArrayList<>();
-    policyTypes.add(20001L);
-    when(restAdapter.get(eq(uri), eq(List.class))).thenReturn(Optional.of(policyTypes));
+    String uri = nearRicUrlProvider.getPolicyTypes(inputBuilder.build().getNearRtRicId());
+    List<Integer> policyTypesInteger = new ArrayList<>();
+    policyTypesInteger.add(20001);
+    List<Long> policyTypesLong = new ArrayList<>();
+    policyTypesLong.add(20001L);
+    when(restAdapter.get(eq(uri), eq(List.class))).thenReturn(Optional.of(policyTypesInteger));
     ListenableFuture<RpcResult<GetPolicyTypesOutput>> result =
         nonrtRicApiProvider.getPolicyTypes(inputBuilder.build());
-    Assert.assertEquals(policyTypes, result.get().getResult().getPolicyTypeIdList());
-  }
-
-  @Test
-  public void testDeletePolicyType() throws InterruptedException, ExecutionException {
-    DeletePolicyTypeInputBuilder inputBuilder = new DeletePolicyTypeInputBuilder();
-    inputBuilder.setPolicyTypeId(policyTypeId);
-    Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri =
-        nearRicUrlProvider.getPolicyTypeId(String.valueOf(inputBuilder.build().getPolicyTypeId()));
-    Optional<Object> deletePolicyTyperesponse = null;
-    when(restAdapter.delete(uri)).thenReturn(deletePolicyTyperesponse);
-    ListenableFuture<RpcResult<DeletePolicyTypeOutput>> result =
-        nonrtRicApiProvider.deletePolicyType(inputBuilder.build());
-  }
-
-  @Test
-  public void testCreatePolicyInstance() throws InterruptedException, ExecutionException {
-    CreatePolicyInstanceInputBuilder inputBuilder = new CreatePolicyInstanceInputBuilder();
-    inputBuilder.setPolicyTypeId(policyTypeId);
-    inputBuilder.setPolicyInstanceId(policyTypeInstanceId);
-    Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getPolicyInstanceId(
-        String.valueOf(inputBuilder.build().getPolicyTypeId()), inputBuilder.getPolicyInstanceId());
-    Optional<Object> createPolicyInstanceresponse = null;
-    when(restAdapter.put(eq(uri), anyObject())).thenReturn(createPolicyInstanceresponse);
-    ListenableFuture<RpcResult<CreatePolicyInstanceOutput>> result =
-        nonrtRicApiProvider.createPolicyInstance(inputBuilder.build());
-  }
-
-  @Test
-  public void testDeletePolicyInstance() throws InterruptedException, ExecutionException {
-    DeletePolicyInstanceInputBuilder inputBuilder = new DeletePolicyInstanceInputBuilder();
-    inputBuilder.setPolicyTypeId(policyTypeId);
-    inputBuilder.setPolicyInstanceId(policyTypeInstanceId);
-    Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getPolicyInstanceId(
-        String.valueOf(inputBuilder.build().getPolicyTypeId()), inputBuilder.getPolicyInstanceId());
-    Optional<Object> deletePolicyInstanceresponse = null;
-    when(restAdapter.delete(uri)).thenReturn(deletePolicyInstanceresponse);
-    ListenableFuture<RpcResult<DeletePolicyInstanceOutput>> result =
-        nonrtRicApiProvider.deletePolicyInstance(inputBuilder.build());
+    Assert.assertEquals(policyTypesLong, result.get().getResult().getPolicyTypeIdList());
   }
 
   @Test
   public void testGetPolicyInstance() throws InterruptedException, ExecutionException {
     GetPolicyInstanceInputBuilder inputBuilder = new GetPolicyInstanceInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     inputBuilder.setPolicyTypeId(policyTypeId);
     inputBuilder.setPolicyInstanceId(policyTypeInstanceId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getPolicyInstanceId(
+    String uri = nearRicUrlProvider.getPolicyInstanceId(inputBuilder.build().getNearRtRicId(),
         String.valueOf(inputBuilder.build().getPolicyTypeId()), inputBuilder.getPolicyInstanceId());
-    String getPolicyInstanceresponse = "{}";
+    String policyInstance =
+            "{\"scope\":{\"ue_id\":\"2\"},\"statement\":{\"priority_level\":\"1\"},\"policy_id\":\"pi12\"}";
     when(restAdapter.get(eq(uri), eq(String.class)))
-        .thenReturn(Optional.of(getPolicyInstanceresponse));
+        .thenReturn(Optional.of(policyInstance));
     ListenableFuture<RpcResult<GetPolicyInstanceOutput>> result =
         nonrtRicApiProvider.getPolicyInstance(inputBuilder.build());
+    Assert.assertEquals(policyInstance, result.get().getResult().getPolicyInstance());
   }
 
   @Test
   public void testGetPolicyInstances() throws InterruptedException, ExecutionException {
     GetPolicyInstancesInputBuilder inputBuilder = new GetPolicyInstancesInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     inputBuilder.setPolicyTypeId(policyTypeId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider
-        .getPolicyInstances(String.valueOf(inputBuilder.build().getPolicyTypeId()));
-    List<String> getPolicyInstances = new ArrayList<>();
-    getPolicyInstances.add("3d2157af-6a8f-4a7c-810f-38c2f824bf12");
-    when(restAdapter.get(eq(uri), eq(List.class))).thenReturn(Optional.of(getPolicyInstances));
+    String uri = nearRicUrlProvider.getPolicyInstances(inputBuilder.build().getNearRtRicId(),
+            String.valueOf(inputBuilder.build().getPolicyTypeId()));
+    List<String> policyInstances = new ArrayList<>();
+    policyInstances.add("3d2157af-6a8f-4a7c-810f-38c2f824bf12");
+    when(restAdapter.get(eq(uri), eq(List.class))).thenReturn(Optional.of(policyInstances));
     ListenableFuture<RpcResult<GetPolicyInstancesOutput>> result =
         nonrtRicApiProvider.getPolicyInstances(inputBuilder.build());
+    Assert.assertEquals(policyInstances, result.get().getResult().getPolicyInstanceIdList());
   }
 
   @Test
   public void testGetStatus() throws InterruptedException, ExecutionException {
     GetStatusInputBuilder inputBuilder = new GetStatusInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     inputBuilder.setPolicyTypeId(policyTypeId);
     inputBuilder.setPolicyInstanceId(policyTypeInstanceId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getPolicyInstanceIdStatus(
+    String uri = nearRicUrlProvider.getPolicyInstanceIdStatus(inputBuilder.build().getNearRtRicId(),
         String.valueOf(inputBuilder.build().getPolicyTypeId()), inputBuilder.getPolicyInstanceId());
-    List<String> getPolicyInstanceIdStatus = new ArrayList<>();
-    getPolicyInstanceIdStatus.add("");
-    when(restAdapter.get(eq(uri), eq(List.class)))
-        .thenReturn(Optional.of(getPolicyInstanceIdStatus));
+    String policyInstanceStatus = "{\"status\":\"enforced\"}";
+    when(restAdapter.get(eq(uri), eq(String.class))).thenReturn(Optional.of(policyInstanceStatus));
     ListenableFuture<RpcResult<GetStatusOutput>> result =
         nonrtRicApiProvider.getStatus(inputBuilder.build());
-    // TODO: Define the proper response message for get policy instance status
-    Assert.assertEquals("Success", result.get().getResult().getStatus());
+    Assert.assertEquals("enforced", result.get().getResult().getStatus());
   }
 
   @Test
   public void testHealthCheck() throws InterruptedException, ExecutionException {
     GetHealthCheckInputBuilder inputBuilder = new GetHealthCheckInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getHealthCheck();
+    String uri = nearRicUrlProvider.getHealthCheck(inputBuilder.build().getNearRtRicId());
     String healthCheckStatus = "";
-    when(restAdapter.get(eq(uri), eq(String.class))).thenReturn(Optional.of(healthCheckStatus));
+    when(restAdapter.get(eq(uri), eq(String.class))).thenReturn(null);
     ListenableFuture<RpcResult<GetHealthCheckOutput>> result =
         nonrtRicApiProvider.getHealthCheck(inputBuilder.build());
     Assert.assertEquals(true, result.get().getResult().isHealthStatus());
