Add unit test cases
[dmaap/messagerouter/messageservice.git] / src / test / java / com / att / nsa / dmaap / service / MMRestServiceTest.java
index fbd9376..6fa5592 100644 (file)
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;\r
 import static org.mockito.Matchers.anyString;\r
 \r
+import java.io.ByteArrayInputStream;\r
 import java.io.FileInputStream;\r
 \r
 //import static org.mockito.Matchers.anyString;\r
@@ -162,6 +163,9 @@ public class MMRestServiceTest {
        public void testCallCreateMirrorMaker() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, JSONException, ConfigDbException {\r
                prepareForTestCommon();\r
+               \r
+               String sampleJson = "{\"test\":\"test\"}";\r
+               InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());\r
                mmRestService.callCreateMirrorMaker(iStream);\r
                assertTrue(true);\r
        }\r
@@ -170,13 +174,18 @@ public class MMRestServiceTest {
        public void testCallListAllMirrorMaker() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
                        TopicExistsException, JSONException, ConfigDbException {\r
                prepareForTestCommon();\r
-               mmRestService.callListAllMirrorMaker(iStream);\r
+               \r
+               String sampleJson = "{\"test\":\"test\"}";\r
+               InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());\r
+               mmRestService.callListAllMirrorMaker(inputSteam);\r
                assertTrue(true);\r
        }\r
 \r
        @Test\r
        public void testCallUpdateMirrorMaker() throws ConfigDbException, CambriaApiException {\r
                prepareForTestCommon();\r
+               \r
+               \r
                mmRestService.callUpdateMirrorMaker(iStream);\r
                assertTrue(true);\r
        }\r
@@ -191,24 +200,33 @@ public class MMRestServiceTest {
        @Test\r
        public void testListWhiteList() throws ConfigDbException {\r
                prepareForTestCommon();\r
-               mmRestService.listWhiteList(iStream);\r
+               \r
+               String sampleJson = "{\"test\":\"test\"}";\r
+               InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());\r
+               mmRestService.listWhiteList(inputSteam);\r
                assertTrue(true);\r
        }\r
 \r
        @Test\r
        public void testCreateWhiteList() throws ConfigDbException {\r
                prepareForTestCommon();\r
-               mmRestService.createWhiteList(iStream);\r
+               String sampleJson = "{\"test\":\"test\"}";\r
+               InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());\r
+               \r
+               mmRestService.createWhiteList(inputSteam);\r
                assertTrue(true);\r
        }\r
 \r
        @Test\r
        public void testDeleteWhiteList() throws ConfigDbException {\r
                prepareForTestCommon();\r
-               mmRestService.deleteWhiteList(iStream);\r
+               \r
+               String sampleJson = "{\"test\":\"test\"}";\r
+               InputStream inputSteam = new ByteArrayInputStream(sampleJson.getBytes());\r
+               mmRestService.deleteWhiteList(inputSteam);\r
                assertTrue(true);\r
        }\r
-\r
+       \r
        private void prepareForTestCommon() throws ConfigDbException {\r
                Assert.assertNotNull(mmRestService);\r
                PowerMockito.when(dmaapContext.getRequest()).thenReturn(httpServReq);\r