diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java
index 686bb07..3045520 100644
--- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java
+++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java
@@ -8,6 +8,8 @@
  * ================================================================================
  * Modifications Copyright (C) 2018 IBM
  * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
+ * ================================================================================
  * 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
@@ -53,7 +55,7 @@
 public class DmaapConsumerImpl implements Consumer {
 
     private static final EELFLogger LOG                = EELFManager.getInstance().getLogger(DmaapConsumerImpl.class);
-    private final Configuration     configuration      = ConfigurationFactory.getConfiguration();
+    private Configuration           configuration      = ConfigurationFactory.getConfiguration();
     // Default values
     private static final int        DEFAULT_TIMEOUT_MS = 60000;
     private static final int        DEFAULT_LIMIT      = 1000;
@@ -93,7 +95,7 @@
 
     private void initMetric() {
         LOG.debug("Metric getting initialized");
-        MetricService metricService = getMetricservice();
+        MetricService metricService = getMetricService();
         if (metricService != null) {
             metricRegistry = metricService.createRegistry("APPC");
 
@@ -108,7 +110,10 @@
                 logPublishers[0] = logPublisher;
 
                 PublishingPolicy manuallyScheduledPublishingPolicy = metricRegistry.policyBuilderFactory()
-                        .scheduledPolicyBuilder().withPublishers(logPublishers).withMetrics(metrics).build();
+                        .scheduledPolicyBuilder()
+                        .withPublishers(logPublishers)
+                        .withMetrics(metrics)
+                        .build();
 
                 LOG.debug("Policy getting initialized");
                 manuallyScheduledPublishingPolicy.init();
@@ -215,7 +220,7 @@
         useHttps = yes;
     }
 
-    private MetricService getMetricservice() {
+    protected MetricService getMetricService() {
         BundleContext bctx = FrameworkUtil.getBundle(MetricService.class).getBundleContext();
         ServiceReference sref = bctx.getServiceReference(MetricService.class.getName());
         if (sref != null) {
diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestConsumerProducerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestConsumerProducerImpl.java
index 1832c76..9df2f07 100644
--- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestConsumerProducerImpl.java
+++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestConsumerProducerImpl.java
@@ -5,6 +5,8 @@
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
  * =============================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,19 +29,20 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-
-import java.util.*;
-
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.onap.appc.adapter.message.Consumer;
 import org.onap.appc.adapter.message.Producer;
-import org.onap.appc.adapter.messaging.dmaap.impl.DmaapConsumerImpl;
-import org.onap.appc.adapter.messaging.dmaap.impl.DmaapProducerImpl;
 import org.onap.appc.configuration.Configuration;
 import org.onap.appc.configuration.ConfigurationFactory;
 
+
 public class TestConsumerProducerImpl {
 
     private Collection<String> urls;
@@ -52,17 +55,17 @@
 
     @Before
     public void setup() {
-    	System.out.println("setup entry...");
-//        urls = new HashSet<String>();
-//        urls.add("dmaaphost1");
-//        urls.add("dmaaphost2");
-//        //remove unavailable dmaap instance for build
-//        //urls.add("dmaaphost3");
-//
-//        topicRead = "APPC-UNIT-TEST";
-//        topicWrite = "APPC-UNIT-TEST";
-//        group = "APPC-CLIENT";
-//        groupId = "0";
+        System.out.println("setup entry...");
+        //        urls = new HashSet<String>();
+        //        urls.add("dmaaphost1");
+        //        urls.add("dmaaphost2");
+        //        //remove unavailable dmaap instance for build
+        //        //urls.add("dmaaphost3");
+        //
+        //        topicRead = "APPC-UNIT-TEST";
+        //        topicWrite = "APPC-UNIT-TEST";
+        //        group = "APPC-CLIENT";
+        //        groupId = "0";
         Configuration configuration = ConfigurationFactory.getConfiguration();
         List<String> hosts = Arrays.asList(configuration.getProperty("poolMembers").split(","));
         urls = new HashSet<String>(hosts);
@@ -83,18 +86,18 @@
     @Ignore
     @Test
     public void testWriteRead() {
-    	System.out.println("testWriteRead entry...");
+        System.out.println("testWriteRead entry...");
         Producer p = new DmaapProducerImpl(urls, topicWrite,user,password);
 
         String s1 = UUID.randomUUID().toString();
         String s2 = UUID.randomUUID().toString();
         if (p.post("TEST", s1) == false) {
-        	// try again - 2nd attempt may succeed if cambria client failed over
-        	p.post("TEST", s1);
+            // try again - 2nd attempt may succeed if cambria client failed over
+            p.post("TEST", s1);
         }
         if (p.post("TEST", s2) == false) {
-        	// try again - 2nd attempt may succeed if cambria client failed over
-        	p.post("TEST", s2);
+            // try again - 2nd attempt may succeed if cambria client failed over
+            p.post("TEST", s2);
         }
 
         Consumer c = new DmaapConsumerImpl(urls, topicRead, group, groupId,user,password);
@@ -102,7 +105,7 @@
         // if fetch is empty, try again - a 2nd attempt may succeed if
         // cambria client has failed over
         if ((out == null) || out.isEmpty()) {
-        	out = c.fetch();
+            out = c.fetch();
         }
 
         assertNotNull(out);
@@ -118,19 +121,19 @@
     @Test
     @Ignore // Https Not support on jenkins server
     public void testWriteReadHttps() {
-    	System.out.println("testWriteReadHttps entry...");
+        System.out.println("testWriteReadHttps entry...");
         Producer p = new DmaapProducerImpl(urls, topicWrite,user,password);
         p.useHttps(true);
 
         String s1 = UUID.randomUUID().toString();
         String s2 = UUID.randomUUID().toString();
         if (p.post("TEST", s1) == false) {
-        	// try again - 2nd attempt may succeed if cambria client failed over
-        	p.post("TEST", s1);
+            // try again - 2nd attempt may succeed if cambria client failed over
+            p.post("TEST", s1);
         }
         if (p.post("TEST", s2) == false) {
-        	// try again - 2nd attempt may succeed if cambria client failed over
-        	p.post("TEST", s2);
+            // try again - 2nd attempt may succeed if cambria client failed over
+            p.post("TEST", s2);
         }
 
         Consumer c = new DmaapConsumerImpl(urls, topicRead, group, groupId,user,password);
@@ -140,7 +143,7 @@
         // if fetch is empty, try again - a 2nd attempt may succeed if
         // cambria client has failed over
         if ((out == null) || out.isEmpty()) {
-        	out = c.fetch();
+            out = c.fetch();
         }
 
         assertNotNull(out);
@@ -153,7 +156,7 @@
     @Test
     @Ignore // requires connection to a live DMaaP server
     public void testBadUrl() {
-    	System.out.println("testBadUrl entry...");
+        System.out.println("testBadUrl entry...");
         urls.clear();
         urls.add("something.local");
 
@@ -168,7 +171,7 @@
     @Test
     @Ignore // requires connection to a live DMaaP server
     public void testAuth() {
-    	System.out.println("testAuth entry...");
+        System.out.println("testAuth entry...");
         Producer p = new DmaapProducerImpl(urls, topicWrite,user,password);
         Consumer c = new DmaapConsumerImpl(urls, topicRead, group, groupId,user,password);
 
@@ -185,34 +188,34 @@
     @Ignore
     @Test
     public void testFailover() {
-    	System.out.println("testFailover entry...");
-    	urls.clear();
+        System.out.println("testFailover entry...");
+        urls.clear();
         urls.add("openecomp2.org");  // bad url
         urls.add("dmaaphost2");
         Producer p = new DmaapProducerImpl(urls, topicWrite,user,password);
 
         String s1 = UUID.randomUUID().toString();
         if (p.post("TEST", s1) == false) {
-        	// try again - cambria client should have failed over
-        	p.post("TEST", s1);
+            // try again - cambria client should have failed over
+            p.post("TEST", s1);
         }
 
         urls.clear();
         urls.add("openecomp3.org");  // bad url
         urls.add("dmaaphost3");
-        
+
         Consumer c = new DmaapConsumerImpl(urls, topicRead, group, groupId,user,password);
         List<String> out = c.fetch(1000, 1000);
         // if fetch is empty, try again - cambria client should have failed over
         if ((out == null) || out.isEmpty()) {
-        	out = c.fetch();
+            out = c.fetch();
         }
 
         assertNotNull(out);
         assertEquals(1, out.size());
         assertEquals(s1, out.get(0));
     }
-    
+
     /**
      * Reads through the entire topic so it is clean for testing. WARNING - ONLY USE ON TOPICS WHERE YOU ARE THE ONLY
      * WRITER. Could end in an infinite loop otherwise.
@@ -228,7 +231,7 @@
     @Test
     @Ignore
     public void testFilter() {
-    	System.out.println("testFilter entry...");
+        System.out.println("testFilter entry...");
         List<String> res;
         String filter = "{\"class\":\"Assigned\",\"field\":\"request\"}";
         Consumer c = new DmaapConsumerImpl(urls, "DCAE-CLOSED-LOOP-EVENTS-DEV1510SIM", group, groupId,user,password,filter);
diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapConsumerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapConsumerImpl.java
index c7f3837..0d48636 100644
--- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapConsumerImpl.java
+++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/java/org/onap/appc/adapter/messaging/dmaap/impl/TestDmaapConsumerImpl.java
@@ -6,6 +6,8 @@
  * ================================================================================
  * Modifications Copyright (C) 2018 IBM
  * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
+ * ================================================================================
  * 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 
@@ -23,18 +25,42 @@
 package org.onap.appc.adapter.messaging.dmaap.impl;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Properties;
-
 import org.junit.Ignore;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.appc.configuration.Configuration;
+import org.onap.appc.configuration.ConfigurationFactory;
+import org.onap.appc.metricservice.MetricRegistry;
+import org.onap.appc.metricservice.MetricService;
+import org.onap.appc.metricservice.metric.DmaapRequestCounterBuilder;
+import org.onap.appc.metricservice.metric.DmaapRequestCounterMetric;
+import org.onap.appc.metricservice.metric.MetricBuilderFactory;
+import org.onap.appc.metricservice.metric.impl.MetricBuilderFactoryImpl;
+import org.onap.appc.metricservice.policy.PolicyBuilderFactory;
+import org.onap.appc.metricservice.policy.PublishingPolicy;
+import org.onap.appc.metricservice.policy.ScheduledPolicyBuilder;
+import org.osgi.framework.FrameworkUtil;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.powermock.reflect.Whitebox;
+import com.att.nsa.mr.client.MRClientFactory;
+import com.att.nsa.mr.client.MRConsumer;
 
-
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ConfigurationFactory.class, FrameworkUtil.class, MRClientFactory.class})
 public class TestDmaapConsumerImpl {
     String[]           hostList = { "192.168.1.1" };
     Collection<String> hosts    = new HashSet<String>(Arrays.asList(hostList));
@@ -111,7 +137,7 @@
     	DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret);
 
         assertNotNull(consumer);
-        
+
         consumer.fetch(5000,500);
     }
 
@@ -159,23 +185,69 @@
         assertEquals(true, consumer.isHttps());
 
     }
-    
+
     @Test
-    public void testGetClient() 
+    public void testGetClient() throws FileNotFoundException, IOException 
     {
-    	DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret);
-    	assertNotNull(consumer);    
-    	consumer.getClient(1000,5);
-    	Properties props= consumer.getProperties();
-    	assertEquals("1000", props.getProperty("timeout"));
-    	assertEquals("5", props.getProperty("limit"));
+        DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret);
+        assertNotNull(consumer);
+        PowerMockito.mockStatic(MRClientFactory.class);
+        PowerMockito.when(MRClientFactory.createConsumer(Mockito.anyString())).thenReturn(Mockito.mock(MRConsumer.class));
+        assertTrue(consumer.getClient(1000,5) instanceof MRConsumer);
+        Properties props= consumer.getProperties();
+        assertEquals("1000", props.getProperty("timeout"));
+        assertEquals("5", props.getProperty("limit"));
     }
-    
+
     @Test
-    public void testInitMetric() 
+    public void testGetClientExceptionFlow() throws FileNotFoundException, IOException 
     {
-    	DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret);
-    	assertNotNull(consumer); 
-    	
+        DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret);
+        assertNotNull(consumer);
+        PowerMockito.mockStatic(MRClientFactory.class);
+        PowerMockito.when(MRClientFactory.createConsumer(Mockito.anyString())).thenThrow(new IOException());
+        assertFalse(consumer.getClient(1000,5) instanceof MRConsumer);
+        Properties props= consumer.getProperties();
+        assertEquals("1000", props.getProperty("timeout"));
+        assertEquals("5", props.getProperty("limit"));
     }
+
+    @Test
+    public void testInitMetric() throws FileNotFoundException, IOException 
+    {
+        Configuration configuration = Mockito.mock(Configuration.class);
+        Properties properties = new Properties();
+        properties.put("metric.enabled", "true");
+        Mockito.when(configuration.getProperties()).thenReturn(properties);
+        PowerMockito.mockStatic(MRClientFactory.class);
+        PowerMockito.when(MRClientFactory.createConsumer(Mockito.anyString())).thenThrow(new IOException());        
+        DmaapConsumerImpl consumer = Mockito.spy(new DmaapConsumerImpl(hosts, topic, group, id, key, secret));
+        Whitebox.setInternalState(consumer, "configuration", configuration);
+        MetricService metricService = Mockito.mock(MetricService.class);
+        MetricRegistry metricRegistry = Mockito.mock(MetricRegistry.class);
+        MetricBuilderFactory metricBuilderFactory = Mockito.spy(new MetricBuilderFactoryImpl());
+        DmaapRequestCounterBuilder builder = Mockito.mock(DmaapRequestCounterBuilder.class);
+        DmaapRequestCounterMetric metric = Mockito.mock(DmaapRequestCounterMetric.class);
+        Mockito.when(builder.withName(Mockito.anyString())).thenReturn(builder);
+        Mockito.when(builder.withType(Mockito.any())).thenReturn(builder);
+        Mockito.when(builder.withPublishedMessage(Mockito.anyLong())).thenReturn(builder);
+        Mockito.when(builder.withRecievedMessage(Mockito.anyLong())).thenReturn(builder);
+        Mockito.when(builder.build()).thenReturn(metric);
+        Mockito.when(metricBuilderFactory.dmaapRequestCounterBuilder()).thenReturn(builder);
+        Mockito.when(metricRegistry.register(Mockito.any())).thenReturn(true);
+        PublishingPolicy policy = Mockito.mock(PublishingPolicy.class);
+        PolicyBuilderFactory policyFactory = Mockito.mock(PolicyBuilderFactory.class);
+        Mockito.when(metricRegistry.policyBuilderFactory()).thenReturn(policyFactory);
+        ScheduledPolicyBuilder policyBuilder = Mockito.mock(ScheduledPolicyBuilder.class);
+        Mockito.when(policyBuilder.withPublishers(Mockito.any())).thenReturn(policyBuilder);
+        Mockito.when(policyBuilder.withMetrics(Mockito.any())).thenReturn(policyBuilder);
+        Mockito.when(policyBuilder.build()).thenReturn(policy);
+        Mockito.when(policyFactory.scheduledPolicyBuilder()).thenReturn(policyBuilder);
+        Mockito.when(metricRegistry.metricBuilderFactory()).thenReturn(metricBuilderFactory);
+        Mockito.when(metricService.createRegistry("APPC")).thenReturn(metricRegistry);
+        Mockito.doReturn(metricService).when(consumer).getMetricService();
+        consumer.fetch(1, 1);
+        Mockito.verify(policy).init();
+    }
+
 }
