TCA: Replace any openecomp reference by onap
[dcaegen2/analytics/tca.git] / dcae-analytics-dmaap / src / test / java / org / onap / dcae / apod / analytics / dmaap / service / BaseDMaaPMRComponentTest.java
-/*\r
- * ===============================LICENSE_START======================================\r
- *  dcae-analytics\r
- * ================================================================================\r
- *    Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- *  Licensed under the Apache License, Version 2.0 (the "License");\r
- *  you may not use this file except in compliance with the License.\r
- *   You may obtain a copy of the License at\r
- *\r
- *          http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- *  ============================LICENSE_END===========================================\r
- */\r
-\r
-package org.openecomp.dcae.apod.analytics.dmaap.service;\r
-\r
-import com.fasterxml.jackson.core.JsonProcessingException;\r
-import com.google.common.base.Optional;\r
-import org.apache.commons.lang3.tuple.Pair;\r
-import org.apache.http.HttpEntity;\r
-import org.apache.http.HttpResponse;\r
-import org.apache.http.StatusLine;\r
-import org.apache.http.client.ResponseHandler;\r
-import org.junit.Rule;\r
-import org.junit.Test;\r
-import org.junit.rules.ExpectedException;\r
-import org.mockito.Mockito;\r
-import org.openecomp.dcae.apod.analytics.common.exception.DCAEAnalyticsRuntimeException;\r
-import org.openecomp.dcae.apod.analytics.dmaap.BaseAnalyticsDMaaPUnitTest;\r
-import org.openecomp.dcae.apod.analytics.dmaap.domain.config.DMaaPMRPublisherConfig;\r
-import org.openecomp.dcae.apod.analytics.dmaap.domain.config.DMaaPMRSubscriberConfig;\r
-import org.openecomp.dcae.apod.analytics.dmaap.domain.response.DMaaPMRSubscriberResponse;\r
-import org.openecomp.dcae.apod.analytics.dmaap.service.publisher.DMaaPMRPublisherQueue;\r
-\r
-import java.io.IOException;\r
-import java.net.URI;\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.List;\r
-\r
-import static org.hamcrest.Matchers.containsInAnyOrder;\r
-import static org.hamcrest.Matchers.hasSize;\r
-import static org.hamcrest.Matchers.is;\r
-import static org.hamcrest.Matchers.isA;\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertFalse;\r
-import static org.junit.Assert.assertThat;\r
-import static org.junit.Assert.assertTrue;\r
-import static org.mockito.BDDMockito.given;\r
-import static org.mockito.Mockito.mock;\r
-\r
-/**\r
- * @author Manjesh Gowda. Creation Date: 11/4/2016.\r
- */\r
-public class BaseDMaaPMRComponentTest extends BaseAnalyticsDMaaPUnitTest {\r
-\r
-    @Test\r
-    public void testGetAuthHeaderWithGoodValues() {\r
-        String expectedEncodedString = "Basic bTAwNTAyQHRjYS5hZi5kY2FlLmNvbTpUZTUwMjFhYmM=";\r
-        Optional<String> actualOutput = BaseDMaaPMRComponent.getAuthHeader("USER", "PASSWORD");\r
-        assertTrue(" Authentication Header has value ", actualOutput.isPresent());\r
-//        assertEquals(" Authentication Header has value ", expectedEncodedString, actualOutput.get());\r
-    }\r
-\r
-    @Test\r
-    public void testGetAuthHeaderWithNullValues() {\r
-        Optional<String> actualOutput = BaseDMaaPMRComponent.getAuthHeader(null, null);\r
-        assertFalse(" Authentication Header has value ", actualOutput.isPresent());\r
-    }\r
-\r
-    @Test\r
-    public void testGetAuthHeaderWithUserNullValue() {\r
-        Optional<String> actualOutput = BaseDMaaPMRComponent.getAuthHeader("USER", null);\r
-        assertFalse(" Authentication Header has value ", actualOutput.isPresent());\r
-    }\r
-\r
-    @Test\r
-    public void testGetAuthHeaderWithPasswordNullValue() {\r
-        Optional<String> actualOutput = BaseDMaaPMRComponent.getAuthHeader(null, "PASSWORD");\r
-        assertFalse(" Authentication Header has value ", actualOutput.isPresent());\r
-    }\r
-\r
-    @Test\r
-    public void testCreatePublishURIWithGoodValues() {\r
-        URI actualURI = BaseDMaaPMRComponent.createPublisherURI(getPublisherConfig());\r
-        String test = actualURI.toString();\r
-        assertEquals("Generated Publisher URL is correct",\r
-                "https://testHostName:8080/events/testTopicName", actualURI.toString());\r
-    }\r
-\r
-    @Test(expected = DCAEAnalyticsRuntimeException.class)\r
-    public void testCreatePublishURIWithURISyntaxException() {\r
-        DMaaPMRPublisherConfig badPublisherConfig = new DMaaPMRPublisherConfig\r
-                .Builder(" dav /gh. ss/ asd ", "///@$%#-htps:<>!##")\r
-                .setPortNumber(0)\r
-                .setProtocol("https").build();\r
-\r
-      BaseDMaaPMRComponent.createPublisherURI(badPublisherConfig);\r
-    }\r
-\r
-    @Test\r
-    public void testCreateSubscribeURIWithGoodValues() {\r
-        URI actualURI = BaseDMaaPMRComponent.createSubscriberURI(\r
-                getSubscriberConfig("test-consumer-group", "test-consumer-id"));\r
-        assertEquals("Generated Subscriber URL is correct",\r
-                "https://testHostName:8080/events/testTopicName/" +\r
-                        "test-consumer-id/test-consumer-group?timeout=2000&limit=20",\r
-                actualURI.toString());\r
-    }\r
-\r
-    @Test(expected = DCAEAnalyticsRuntimeException.class)\r
-    public void testCreateSubscribeURIWithURISyntaxException() {\r
-        DMaaPMRSubscriberConfig badSubscriberConfig = new DMaaPMRSubscriberConfig\r
-                .Builder(" dav /gh. ss/ asd ", "")\r
-                .setPortNumber(PORT_NUMBER)\r
-                .setProtocol(HTTP_PROTOCOL)\r
-                .setContentType(CONTENT_TYPE).build();\r
-\r
-        URI actualURI = BaseDMaaPMRComponent.createSubscriberURI(badSubscriberConfig);\r
-    }\r
-\r
-    @Test\r
-    public void testConvertToJsonStringGoodJsonStringList() {\r
-        List<String> jsonMessage = Arrays.asList(\r
-                "{\"message\":\"I'm Object 1 Message\"}",\r
-                "{\"message\":\"I'm Object 2 Message\"}");\r
-\r
-        String actualJSONMsg = BaseDMaaPMRComponent.convertToJsonString(jsonMessage);\r
-\r
-        String expectedJSONMsg = "[{\"message\":\"I'm Object 1 Message\"}," +\r
-                "{\"message\":\"I'm Object 2 Message\"}]";\r
-        assertEquals("Convert a List of Strings to JSON is working fine", expectedJSONMsg, actualJSONMsg);\r
-\r
-    }\r
-\r
-    @Rule\r
-    public ExpectedException expectedJsonProcessingException = ExpectedException.none();\r
-\r
-    @Test\r
-    public void testConvertToJsonStringBadJsonStringList() {\r
-        expectedJsonProcessingException.expect(DCAEAnalyticsRuntimeException.class);\r
-        expectedJsonProcessingException.expectCause(isA(JsonProcessingException.class));\r
-\r
-        List<String> jsonMessage = Arrays.asList(\r
-                "{\"message\":\"I'm Object 1 Message\"",\r
-                "\"message\":\"I'm Object 2 Message\"");\r
-\r
-        BaseDMaaPMRComponent.convertToJsonString(jsonMessage);\r
-    }\r
-\r
-    @Test\r
-    public void testConvertToJsonStringWithEmptyList() {\r
-        List<String> jsonMessage = Arrays.asList();\r
-        String actualJSONMsg = BaseDMaaPMRComponent.convertToJsonString(jsonMessage);\r
-        String expectedJSONMsg = "[]";\r
-        assertEquals("Convert a List of Strings to JSON is working fine", expectedJSONMsg, actualJSONMsg);\r
-    }\r
-\r
-    @Test\r
-    public void testConvertToJsonStringWithNullList() {\r
-        String actualJSONMsg = BaseDMaaPMRComponent.convertToJsonString(null);\r
-        String expectedJSONMsg = "[]";\r
-        assertEquals("Convert a List of Strings to JSON is working fine", expectedJSONMsg, actualJSONMsg);\r
-    }\r
-\r
-\r
-    @Test\r
-    public void testConvertJsonToStringMessagesGoodValues() {\r
-        String inputJSONMsg = "[{\"message\":\"I'm Object 1 Message\"}," +\r
-                "{\"message\":\"I'm Object 2 Message\"}]";\r
-        List<String> actualList = BaseDMaaPMRComponent.convertJsonToStringMessages(inputJSONMsg);\r
-        assertThat(actualList, hasSize(2));\r
-        assertThat(actualList, containsInAnyOrder(\r
-                "{\"message\":\"I'm Object 1 Message\"}",\r
-                "{\"message\":\"I'm Object 2 Message\"}"\r
-        ));\r
-    }\r
-\r
-    @Test\r
-    public void testConvertJsonToStringMessagesNoValues() {\r
-        String inputJSONMsg = "[]";\r
-        List<String> actualList = BaseDMaaPMRComponent.convertJsonToStringMessages(inputJSONMsg);\r
-        assertThat(actualList, hasSize(0));\r
-    }\r
-\r
-    @Test\r
-    public void testConvertJsonToStringMessagesNullValues() {\r
-        List<String> actualList = BaseDMaaPMRComponent.convertJsonToStringMessages(null);\r
-        assertThat(actualList, hasSize(0));\r
-    }\r
-\r
-    @Test\r
-    public void testConvertJsonToStringMessagesEmptyValues() {\r
-        List<String> actualList = BaseDMaaPMRComponent.convertJsonToStringMessages("  ");\r
-        assertThat(actualList, hasSize(0));\r
-    }\r
-\r
-    @Rule\r
-    public ExpectedException convertToJSONIOException = ExpectedException.none();\r
-\r
-    @Test\r
-    public void testConvertJsonToStringMessagesException() {\r
-        convertToJSONIOException.expect(DCAEAnalyticsRuntimeException.class);\r
-        convertToJSONIOException.expectCause(isA(IOException.class));\r
-\r
-        String inputJSONMsg = "[\"{\"message\":\"I'm Object 1 Message\"}\"," +\r
-                "\"{\"message\":\"I'm Object 2 Message\"}\"]";\r
-        List<String> actualList = BaseDMaaPMRComponent.convertJsonToStringMessages(inputJSONMsg);\r
-        assertThat(actualList, hasSize(2));\r
-        assertThat(actualList, containsInAnyOrder(\r
-                "{\"message\":\"I'm Object 1 Message\"}",\r
-                "{\"message\":\"I'm Object 2 Message\"}"\r
-        ));\r
-    }\r
-\r
-    @Test\r
-    public void testAddMessagesToRecoveryQueueAllGood() {\r
-        DMaaPMRPublisherQueue dmaapMRPublisherQueue = mock(DMaaPMRPublisherQueue.class);\r
-        given(dmaapMRPublisherQueue.addRecoverableMessages(Mockito.<String>anyList())).willReturn(0);\r
-        given(dmaapMRPublisherQueue.getBatchQueueRemainingSize()).willReturn(0);\r
-        List<String> messages = new ArrayList<String>();\r
-        BaseDMaaPMRComponent.addMessagesToRecoveryQueue(dmaapMRPublisherQueue, messages);\r
-    }\r
-\r
-    @Rule\r
-    public ExpectedException addQueueIllegalException = ExpectedException.none();\r
-\r
-    @Test\r
-    public void testAddMessagesToRecoveryQueueException() {\r
-        addQueueIllegalException.expect(isA(DCAEAnalyticsRuntimeException.class));\r
-        addQueueIllegalException.expectCause(isA(IllegalStateException.class));\r
-\r
-        DMaaPMRPublisherQueue dmaapMRPublisherQueue = mock(DMaaPMRPublisherQueue.class);\r
-\r
-        given(dmaapMRPublisherQueue.addRecoverableMessages(Mockito.<String>anyList()))\r
-                .willThrow(IllegalStateException.class);\r
-        List<String> messages = new ArrayList<String>();\r
-\r
-        BaseDMaaPMRComponent.addMessagesToRecoveryQueue(dmaapMRPublisherQueue, messages);\r
-    }\r
-\r
-\r
-    @Test\r
-    public void testResponseHandler() {\r
-        HttpResponse mockHttpResponse = mock(HttpResponse.class);\r
-        StatusLine mockStatusLine = mock(StatusLine.class);\r
-        HttpEntity mockHttpEntity = mock(HttpEntity.class);\r
-        // Could not mock EntityUtils as it's final class\r
-        //EntityUtils mockEntityUtils = mock(EntityUtils.class);\r
-\r
-        given(mockHttpResponse.getStatusLine()).willReturn(mockStatusLine);\r
-        given(mockStatusLine.getStatusCode()).willReturn(200);\r
-        given(mockHttpResponse.getEntity()).willReturn(null);\r
-        //given(mockEntityUtils.toString()).willReturn("Test value");\r
-\r
-        ResponseHandler<Pair<Integer, String>> responseHandler = BaseDMaaPMRComponent.responseHandler();\r
-        try {\r
-            Pair<Integer, String> mappedResponse = responseHandler.handleResponse(mockHttpResponse);\r
-            assertTrue("Http response code returned properly ", mappedResponse.getLeft().equals(200));\r
-            assertTrue("Http response body returned properly ", mappedResponse.getRight().equals(""));\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
-\r
-    @Test\r
-    public void testCreateSubscriberResponse() {\r
-        DMaaPMRSubscriberResponse dmaapMRSubscriberResponse =\r
-                BaseDMaaPMRComponent.createSubscriberResponse(200, "Test Message", getTwoSampleMessages());\r
-\r
-        assertThat(dmaapMRSubscriberResponse.getResponseCode(), is(200));\r
-        assertEquals(dmaapMRSubscriberResponse.getResponseMessage(), "Test Message");\r
-        assertThat(dmaapMRSubscriberResponse.getFetchedMessages().size(), is(2));\r
-\r
-    }\r
-\r
-    @Test\r
-    public void testCreateSubscriberResponse_no_message() {\r
-        DMaaPMRSubscriberResponse dmaapMRSubscriberResponse =\r
-                BaseDMaaPMRComponent.createSubscriberResponse(200, "Test Message", null);\r
-\r
-        assertThat(dmaapMRSubscriberResponse.getResponseCode(), is(200));\r
-        assertEquals(dmaapMRSubscriberResponse.getResponseMessage(), "Test Message");\r
-        assertThat(dmaapMRSubscriberResponse.getFetchedMessages().size(), is(0));\r
-\r
-    }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
+/*
+ * ===============================LICENSE_START======================================
+ *  dcae-analytics
+ * ================================================================================
+ *    Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ *  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===========================================
+ */
+
+package org.onap.dcae.apod.analytics.dmaap.service;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.google.common.base.Optional;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.StatusLine;
+import org.apache.http.client.ResponseHandler;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.Mockito;
+import org.onap.dcae.apod.analytics.common.exception.DCAEAnalyticsRuntimeException;
+import org.onap.dcae.apod.analytics.dmaap.BaseAnalyticsDMaaPUnitTest;
+import org.onap.dcae.apod.analytics.dmaap.domain.config.DMaaPMRPublisherConfig;
+import org.onap.dcae.apod.analytics.dmaap.domain.config.DMaaPMRSubscriberConfig;
+import org.onap.dcae.apod.analytics.dmaap.domain.response.DMaaPMRSubscriberResponse;
+import org.onap.dcae.apod.analytics.dmaap.service.publisher.DMaaPMRPublisherQueue;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.isA;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.mock;
+
+/**
+ * @author Manjesh Gowda. Creation Date: 11/4/2016.
+ */
+public class BaseDMaaPMRComponentTest extends BaseAnalyticsDMaaPUnitTest {
+
+    @Test
+    public void testGetAuthHeaderWithGoodValues() {
+        String expectedEncodedString = "Basic bTAwNTAyQHRjYS5hZi5kY2FlLmNvbTpUZTUwMjFhYmM=";
+        Optional<String> actualOutput = BaseDMaaPMRComponent.getAuthHeader("USER", "PASSWORD");
+        assertTrue(" Authentication Header has value ", actualOutput.isPresent());
+//        assertEquals(" Authentication Header has value ", expectedEncodedString, actualOutput.get());
+    }
+
+    @Test
+    public void testGetAuthHeaderWithNullValues() {
+        Optional<String> actualOutput = BaseDMaaPMRComponent.getAuthHeader(null, null);
+        assertFalse(" Authentication Header has value ", actualOutput.isPresent());
+    }
+
+    @Test
+    public void testGetAuthHeaderWithUserNullValue() {
+        Optional<String> actualOutput = BaseDMaaPMRComponent.getAuthHeader("USER", null);
+        assertFalse(" Authentication Header has value ", actualOutput.isPresent());
+    }
+
+    @Test
+    public void testGetAuthHeaderWithPasswordNullValue() {
+        Optional<String> actualOutput = BaseDMaaPMRComponent.getAuthHeader(null, "PASSWORD");
+        assertFalse(" Authentication Header has value ", actualOutput.isPresent());
+    }
+
+    @Test
+    public void testCreatePublishURIWithGoodValues() {
+        URI actualURI = BaseDMaaPMRComponent.createPublisherURI(getPublisherConfig());
+        String test = actualURI.toString();
+        assertEquals("Generated Publisher URL is correct",
+                "https://testHostName:8080/events/testTopicName", actualURI.toString());
+    }
+
+    @Test(expected = DCAEAnalyticsRuntimeException.class)
+    public void testCreatePublishURIWithURISyntaxException() {
+        DMaaPMRPublisherConfig badPublisherConfig = new DMaaPMRPublisherConfig
+                .Builder(" dav /gh. ss/ asd ", "///@$%#-htps:<>!##")
+                .setPortNumber(0)
+                .setProtocol("https").build();
+
+      BaseDMaaPMRComponent.createPublisherURI(badPublisherConfig);
+    }
+
+    @Test
+    public void testCreateSubscribeURIWithGoodValues() {
+        URI actualURI = BaseDMaaPMRComponent.createSubscriberURI(
+                getSubscriberConfig("test-consumer-group", "test-consumer-id"));
+        assertEquals("Generated Subscriber URL is correct",
+                "https://testHostName:8080/events/testTopicName/" +
+                        "test-consumer-id/test-consumer-group?timeout=2000&limit=20",
+                actualURI.toString());
+    }
+
+    @Test(expected = DCAEAnalyticsRuntimeException.class)
+    public void testCreateSubscribeURIWithURISyntaxException() {
+        DMaaPMRSubscriberConfig badSubscriberConfig = new DMaaPMRSubscriberConfig
+                .Builder(" dav /gh. ss/ asd ", "")
+                .setPortNumber(PORT_NUMBER)
+                .setProtocol(HTTP_PROTOCOL)
+                .setContentType(CONTENT_TYPE).build();
+
+        URI actualURI = BaseDMaaPMRComponent.createSubscriberURI(badSubscriberConfig);
+    }
+
+    @Test
+    public void testConvertToJsonStringGoodJsonStringList() {
+        List<String> jsonMessage = Arrays.asList(
+                "{\"message\":\"I'm Object 1 Message\"}",
+                "{\"message\":\"I'm Object 2 Message\"}");
+
+        String actualJSONMsg = BaseDMaaPMRComponent.convertToJsonString(jsonMessage);
+
+        String expectedJSONMsg = "[{\"message\":\"I'm Object 1 Message\"}," +
+                "{\"message\":\"I'm Object 2 Message\"}]";
+        assertEquals("Convert a List of Strings to JSON is working fine", expectedJSONMsg, actualJSONMsg);
+
+    }
+
+    @Rule
+    public ExpectedException expectedJsonProcessingException = ExpectedException.none();
+
+    @Test
+    public void testConvertToJsonStringBadJsonStringList() {
+        expectedJsonProcessingException.expect(DCAEAnalyticsRuntimeException.class);
+        expectedJsonProcessingException.expectCause(isA(JsonProcessingException.class));
+
+        List<String> jsonMessage = Arrays.asList(
+                "{\"message\":\"I'm Object 1 Message\"",
+                "\"message\":\"I'm Object 2 Message\"");
+
+        BaseDMaaPMRComponent.convertToJsonString(jsonMessage);
+    }
+
+    @Test
+    public void testConvertToJsonStringWithEmptyList() {
+        List<String> jsonMessage = Arrays.asList();
+        String actualJSONMsg = BaseDMaaPMRComponent.convertToJsonString(jsonMessage);
+        String expectedJSONMsg = "[]";
+        assertEquals("Convert a List of Strings to JSON is working fine", expectedJSONMsg, actualJSONMsg);
+    }
+
+    @Test
+    public void testConvertToJsonStringWithNullList() {
+        String actualJSONMsg = BaseDMaaPMRComponent.convertToJsonString(null);
+        String expectedJSONMsg = "[]";
+        assertEquals("Convert a List of Strings to JSON is working fine", expectedJSONMsg, actualJSONMsg);
+    }
+
+
+    @Test
+    public void testConvertJsonToStringMessagesGoodValues() {
+        String inputJSONMsg = "[{\"message\":\"I'm Object 1 Message\"}," +
+                "{\"message\":\"I'm Object 2 Message\"}]";
+        List<String> actualList = BaseDMaaPMRComponent.convertJsonToStringMessages(inputJSONMsg);
+        assertThat(actualList, hasSize(2));
+        assertThat(actualList, containsInAnyOrder(
+                "{\"message\":\"I'm Object 1 Message\"}",
+                "{\"message\":\"I'm Object 2 Message\"}"
+        ));
+    }
+
+    @Test
+    public void testConvertJsonToStringMessagesNoValues() {
+        String inputJSONMsg = "[]";
+        List<String> actualList = BaseDMaaPMRComponent.convertJsonToStringMessages(inputJSONMsg);
+        assertThat(actualList, hasSize(0));
+    }
+
+    @Test
+    public void testConvertJsonToStringMessagesNullValues() {
+        List<String> actualList = BaseDMaaPMRComponent.convertJsonToStringMessages(null);
+        assertThat(actualList, hasSize(0));
+    }
+
+    @Test
+    public void testConvertJsonToStringMessagesEmptyValues() {
+        List<String> actualList = BaseDMaaPMRComponent.convertJsonToStringMessages("  ");
+        assertThat(actualList, hasSize(0));
+    }
+
+    @Rule
+    public ExpectedException convertToJSONIOException = ExpectedException.none();
+
+    @Test
+    public void testConvertJsonToStringMessagesException() {
+        convertToJSONIOException.expect(DCAEAnalyticsRuntimeException.class);
+        convertToJSONIOException.expectCause(isA(IOException.class));
+
+        String inputJSONMsg = "[\"{\"message\":\"I'm Object 1 Message\"}\"," +
+                "\"{\"message\":\"I'm Object 2 Message\"}\"]";
+        List<String> actualList = BaseDMaaPMRComponent.convertJsonToStringMessages(inputJSONMsg);
+        assertThat(actualList, hasSize(2));
+        assertThat(actualList, containsInAnyOrder(
+                "{\"message\":\"I'm Object 1 Message\"}",
+                "{\"message\":\"I'm Object 2 Message\"}"
+        ));
+    }
+
+    @Test
+    public void testAddMessagesToRecoveryQueueAllGood() {
+        DMaaPMRPublisherQueue dmaapMRPublisherQueue = mock(DMaaPMRPublisherQueue.class);
+        given(dmaapMRPublisherQueue.addRecoverableMessages(Mockito.<String>anyList())).willReturn(0);
+        given(dmaapMRPublisherQueue.getBatchQueueRemainingSize()).willReturn(0);
+        List<String> messages = new ArrayList<String>();
+        BaseDMaaPMRComponent.addMessagesToRecoveryQueue(dmaapMRPublisherQueue, messages);
+    }
+
+    @Rule
+    public ExpectedException addQueueIllegalException = ExpectedException.none();
+
+    @Test
+    public void testAddMessagesToRecoveryQueueException() {
+        addQueueIllegalException.expect(isA(DCAEAnalyticsRuntimeException.class));
+        addQueueIllegalException.expectCause(isA(IllegalStateException.class));
+
+        DMaaPMRPublisherQueue dmaapMRPublisherQueue = mock(DMaaPMRPublisherQueue.class);
+
+        given(dmaapMRPublisherQueue.addRecoverableMessages(Mockito.<String>anyList()))
+                .willThrow(IllegalStateException.class);
+        List<String> messages = new ArrayList<String>();
+
+        BaseDMaaPMRComponent.addMessagesToRecoveryQueue(dmaapMRPublisherQueue, messages);
+    }
+
+
+    @Test
+    public void testResponseHandler() {
+        HttpResponse mockHttpResponse = mock(HttpResponse.class);
+        StatusLine mockStatusLine = mock(StatusLine.class);
+        HttpEntity mockHttpEntity = mock(HttpEntity.class);
+        // Could not mock EntityUtils as it's final class
+        //EntityUtils mockEntityUtils = mock(EntityUtils.class);
+
+        given(mockHttpResponse.getStatusLine()).willReturn(mockStatusLine);
+        given(mockStatusLine.getStatusCode()).willReturn(200);
+        given(mockHttpResponse.getEntity()).willReturn(null);
+        //given(mockEntityUtils.toString()).willReturn("Test value");
+
+        ResponseHandler<Pair<Integer, String>> responseHandler = BaseDMaaPMRComponent.responseHandler();
+        try {
+            Pair<Integer, String> mappedResponse = responseHandler.handleResponse(mockHttpResponse);
+            assertTrue("Http response code returned properly ", mappedResponse.getLeft().equals(200));
+            assertTrue("Http response body returned properly ", mappedResponse.getRight().equals(""));
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    @Test
+    public void testCreateSubscriberResponse() {
+        DMaaPMRSubscriberResponse dmaapMRSubscriberResponse =
+                BaseDMaaPMRComponent.createSubscriberResponse(200, "Test Message", getTwoSampleMessages());
+
+        assertThat(dmaapMRSubscriberResponse.getResponseCode(), is(200));
+        assertEquals(dmaapMRSubscriberResponse.getResponseMessage(), "Test Message");
+        assertThat(dmaapMRSubscriberResponse.getFetchedMessages().size(), is(2));
+
+    }
+
+    @Test
+    public void testCreateSubscriberResponse_no_message() {
+        DMaaPMRSubscriberResponse dmaapMRSubscriberResponse =
+                BaseDMaaPMRComponent.createSubscriberResponse(200, "Test Message", null);
+
+        assertThat(dmaapMRSubscriberResponse.getResponseCode(), is(200));
+        assertEquals(dmaapMRSubscriberResponse.getResponseMessage(), "Test Message");
+        assertThat(dmaapMRSubscriberResponse.getFetchedMessages().size(), is(0));
+
+    }
+
+}
+
+
+
+
+