diff --git a/pom.xml b/pom.xml
index 12c8e51..41f6f8c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -351,12 +351,16 @@
                 <goal>check</goal>
               </goals>
               <configuration>
+                <excludes>
+                  <exclude>**/Immutable*</exclude>
+                  <exclude>**/GsonAdapters*</exclude>
+                  <exclude>**/*ForUnitTest*</exclude>
+                </excludes>
                 <rules>
                   <rule>
                     <element>CLASS</element>
                     <limits>
                       <limit>
-                        <counter>LINE</counter>
                         <value>COVEREDRATIO</value>
                         <!--<minimum>0.70</minimum>-->
                       </limit>
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
index ece1621..6d24ade 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
@@ -84,7 +84,7 @@
         JsonParser parser = new JsonParser();
         JsonObject jsonObject;
         try (InputStream inputStream = getInputStream(filepath)) {
-            JsonElement rootElement = parser.parse(new InputStreamReader(inputStream));
+            JsonElement rootElement = getJsonElement(parser, inputStream);
             if (rootElement.isJsonObject()) {
                 jsonObject = rootElement.getAsJsonObject();
                 aaiClientConfiguration = deserializeType(gsonBuilder,
@@ -99,8 +99,6 @@
                     jsonObject.getAsJsonObject(CONFIG).getAsJsonObject(DMAAP).getAsJsonObject(DMAAP_PRODUCER),
                     DmaapPublisherConfiguration.class);
             }
-        } catch (FileNotFoundException e) {
-            logger.warn("File doesn't exist in filepath: {}", filepath, e);
         } catch (IOException e) {
             logger.warn("Problem with file loading, file: {}", filepath, e);
         } catch (JsonSyntaxException e) {
@@ -108,12 +106,16 @@
         }
     }
 
+    JsonElement getJsonElement(JsonParser parser, InputStream inputStream) {
+        return parser.parse(new InputStreamReader(inputStream));
+    }
+
     private <T> T deserializeType(@NotNull GsonBuilder gsonBuilder, @NotNull JsonObject jsonObject,
         @NotNull Class<T> type) {
         return gsonBuilder.create().fromJson(jsonObject, type);
     }
 
-    InputStream getInputStream(@NotNull String filepath) throws FileNotFoundException {
+    InputStream getInputStream(@NotNull String filepath) throws IOException {
         return new BufferedInputStream(new FileInputStream(filepath));
     }
 
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
index 2efffd8..8a1d0ec 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
@@ -22,12 +22,16 @@
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
 import java.io.ByteArrayInputStream;
-import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
 import java.util.Objects;
@@ -35,6 +39,7 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.function.Executable;
 import org.onap.dcaegen2.services.prh.IT.junit5.mockito.MockitoExtension;
 
 /**
@@ -74,7 +79,7 @@
 
     @Test
     public void whenTheConfigurationFits_GetAaiAndDmaapObjectRepresentationConfiguration()
-        throws FileNotFoundException {
+        throws IOException {
         //
         // Given
         //
@@ -107,7 +112,7 @@
     }
 
     @Test
-    public void whenFileIsNotExist_ThrowFileNotFoundException() {
+    public void whenFileIsNotExist_ThrowIOException() {
         //
         // Given
         //
@@ -129,7 +134,7 @@
     }
 
     @Test
-    public void whenFileIsExistsButJsonIsIncorrect() throws FileNotFoundException {
+    public void whenFileIsExistsButJsonIsIncorrect() throws IOException {
         //
         // Given
         //
@@ -151,6 +156,31 @@
         Assertions.assertNotNull(prhAppConfig.getDmaapConsumerConfiguration());
         Assertions.assertNull(prhAppConfig.getDmaapPublisherConfiguration());
 
+    }
 
+
+    @Test
+    public void whenTheConfigurationFits_ButRootElementIsNotAJsonObject()
+        throws IOException {
+        // Given
+        InputStream inputStream = new ByteArrayInputStream((jsonString.getBytes(
+            StandardCharsets.UTF_8)));
+        // When
+        prhAppConfig.setFilepath(filePath);
+        doReturn(inputStream).when(prhAppConfig).getInputStream(any());
+        JsonElement jsonElement = mock(JsonElement.class);
+        when(jsonElement.isJsonObject()).thenReturn(false);
+        doReturn(jsonElement).when(prhAppConfig).getJsonElement(any(JsonParser.class), any(InputStream.class));
+        prhAppConfig.initFileStreamReader();
+        appConfig.dmaapConsumerConfiguration = prhAppConfig.getDmaapConsumerConfiguration();
+        appConfig.dmaapPublisherConfiguration = prhAppConfig.getDmaapPublisherConfiguration();
+        appConfig.aaiClientConfiguration = prhAppConfig.getAAIClientConfiguration();
+
+        // Then
+        verify(prhAppConfig, times(1)).setFilepath(anyString());
+        verify(prhAppConfig, times(1)).initFileStreamReader();
+        Assertions.assertNull(prhAppConfig.getAAIClientConfiguration());
+        Assertions.assertNull(prhAppConfig.getDmaapConsumerConfiguration());
+        Assertions.assertNull(prhAppConfig.getDmaapPublisherConfiguration());
     }
 }
\ No newline at end of file
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java
index 2b46f51..3bae698 100644
--- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java
+++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java
@@ -20,6 +20,10 @@
 
 package org.onap.dcaegen2.services.prh.service.consumer;
 
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Optional;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.ResponseHandler;
 import org.apache.http.client.methods.HttpGet;
@@ -33,11 +37,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Optional;
-
 
 public class ExtendedDmaapConsumerHttpClientImpl {
 
@@ -66,60 +65,50 @@
 
     public Optional<String> getHttpConsumerResponse() {
 
-        Optional<String> extendedDetails = Optional.empty();
-        Optional<HttpRequestBase> request = createRequest();
-
         try {
-            extendedDetails = closeableHttpClient.execute(request.get(), dmaapConsumerResponseHandler());
-        } catch (IOException | NullPointerException e) {
-            logger.error("Exception while executing HTTP request: {}", e);
+            return createRequest()
+                .flatMap(this::executeHttpClient);
+        } catch (NullPointerException | URISyntaxException e) {
+            logger.warn("Exception while executing HTTP request: ", e);
         }
-
-        return extendedDetails;
+        return Optional.empty();
     }
 
-    private static HttpRequestBase createHttpRequest(URI extendedURI) {
-        if (isExtendedURINotNull(extendedURI)) {
-            return new HttpGet(extendedURI);
+    private Optional<String> executeHttpClient(HttpRequestBase httpRequestBase) {
+        try {
+            return closeableHttpClient.execute(httpRequestBase, getDmaapConsumerResponseHandler());
+        } catch (IOException e) {
+            logger.warn("Exception while executing HTTP request: ", e);
         }
-
-        return null;
+        return Optional.empty();
     }
 
-    private static Boolean isExtendedURINotNull(URI extendedURI) {
-        return extendedURI != null;
+    private Optional<HttpRequestBase> createRequest() throws URISyntaxException {
+        return "application/json".equals(dmaapContentType)
+            ? createDmaapConsumerExtendedURI().map(this::createHttpRequest)
+            : Optional.empty();
     }
 
-    private Optional<HttpRequestBase> createRequest() {
-
-        Optional<HttpRequestBase> request = Optional.empty();
-        final URI extendedURI = createDmaapConsumerExtendedURI();
-
-        if ("application/json".equals(dmaapContentType)) {
-            request = Optional.ofNullable(createHttpRequest(extendedURI));
-            request.get().addHeader("Content-type", dmaapContentType);
-        }
-
-        return request;
+    private HttpRequestBase createHttpRequest(URI extendedURI) {
+        HttpRequestBase httpRequestBase = new HttpGet(extendedURI);
+        httpRequestBase.addHeader("Content-type", dmaapContentType);
+        return httpRequestBase;
     }
 
+
     private String createRequestPath() {
         return dmaapTopicName + "/" + consumerGroup + "/" + consumerId;
     }
 
-    private URI createDmaapConsumerExtendedURI() {
-        try {
-            return new URIBuilder()
-                .setScheme(dmaapProtocol)
-                .setHost(dmaapHostName)
-                .setPort(dmaapPortNumber)
-                .setPath(createRequestPath()).build();
-        } catch (URISyntaxException e) {
-            throw new RuntimeException("Exception while building extended URI: {}", e);
-        }
+    private Optional<URI> createDmaapConsumerExtendedURI() throws URISyntaxException {
+        return Optional.ofNullable(new URIBuilder()
+            .setScheme(dmaapProtocol)
+            .setHost(dmaapHostName)
+            .setPort(dmaapPortNumber)
+            .setPath(createRequestPath()).build());
     }
 
-    private ResponseHandler<Optional<String>> dmaapConsumerResponseHandler() {
+    private ResponseHandler<Optional<String>> getDmaapConsumerResponseHandler() {
         return httpResponse -> {
             final int responseCode = httpResponse.getStatusLine().getStatusCode();
             logger.info("Status code of operation: {}", responseCode);
@@ -131,7 +120,7 @@
                 return Optional.of(dmaapResponse);
             } else {
                 String dmaapResponse = responseEntity != null ? EntityUtils.toString(responseEntity) : "";
-                logger.error("HTTP response not successful : {}", dmaapResponse);
+                logger.warn("HTTP response not successful : {}", dmaapResponse);
                 return Optional.of(String.valueOf(responseCode));
             }
         };
