diff options
author | Ram Koya <rk541m@att.com> | 2018-05-21 23:15:47 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-05-21 23:15:47 +0000 |
commit | 21cf6bed993d82fc2c27c742d5b4d274710f58d8 (patch) | |
tree | 87935384bd82f60f5168e1c58055f891f91959ab /src/test/java/com/att | |
parent | 3eb61ef09941761cf454da990d1b91650c1cc7c3 (diff) | |
parent | 79f026709bde8b26fd9b5f31535ee429497b951d (diff) |
Merge "Updated the testcases"
Diffstat (limited to 'src/test/java/com/att')
-rw-r--r-- | src/test/java/com/att/nsa/dmaapMMAgent/TestMirrorMakerAgent.java | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/test/java/com/att/nsa/dmaapMMAgent/TestMirrorMakerAgent.java b/src/test/java/com/att/nsa/dmaapMMAgent/TestMirrorMakerAgent.java index 8768962..1dcd6c8 100644 --- a/src/test/java/com/att/nsa/dmaapMMAgent/TestMirrorMakerAgent.java +++ b/src/test/java/com/att/nsa/dmaapMMAgent/TestMirrorMakerAgent.java @@ -24,13 +24,14 @@ package com.att.nsa.dmaapMMAgent; import static org.junit.Assert.*; import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; import java.util.ArrayList; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.powermock.modules.junit4.PowerMockRunner; @@ -48,7 +49,10 @@ public class TestMirrorMakerAgent { MirrorMaker mirrorMaker2 = new MirrorMaker(); ArrayList<MirrorMaker> listsMirrorMaker = new ArrayList<MirrorMaker>(); Gson g = new Gson(); - MirrorMakerAgent agent = spy(new MirrorMakerAgent()); + @InjectMocks + private MirrorMakerAgent agent = spy(new MirrorMakerAgent()); + @Mock + private TopicUtil topicUtil; @Before public void setUp() { @@ -69,16 +73,12 @@ public class TestMirrorMakerAgent { @Test public void testReadAgentTopics() { - when(agent.subscribeTopic("60000")).thenReturn(null); agent.exitLoop = true; agent.readAgentTopic(); } @Test public void testReadCreateMirrorMaker() { - when(agent.publishTopic( - "{\"messageID\":\"test\",\"listMirrorMaker\":[{\"name\":\"test\",\"consumer\":\"test\",\"producer\":\"test\",\"status\":\"STOPPED\"}]}")) - .thenReturn(null); String topicMessage = "{ messageID:\"test\", createMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\"}}"; LinkedTreeMap<?, ?> object = g.fromJson(topicMessage, LinkedTreeMap.class); agent.readAgent(object, topicMessage); @@ -87,9 +87,6 @@ public class TestMirrorMakerAgent { @Test public void testReadUpdateMirrorMaker() { - when(agent.publishTopic( - "{\"messageID\":\"test\",\"listMirrorMaker\":[{\"name\":\"test\",\"consumer\":\"test\",\"producer\":\"test\",\"status\":\"STOPPED\"}]}")) - .thenReturn(null); String topicMessage = "{ messageID:\"test\", updateMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\"}}"; LinkedTreeMap<?, ?> object = g.fromJson(topicMessage, LinkedTreeMap.class); testReadCreateMirrorMaker(); @@ -99,9 +96,6 @@ public class TestMirrorMakerAgent { @Test public void testReadDeleteMirrorMaker() { - when(agent.publishTopic( - "{\"messageID\":\"test\",\"listMirrorMaker\":[{\"name\":\"test\",\"consumer\":\"test\",\"producer\":\"test\",\"status\":\"STOPPED\"}]}")) - .thenReturn(null); String topicMessage = "{ messageID:\"test\", deleteMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\", whitelist:\"test\",status:\"test\" }}"; LinkedTreeMap<?, ?> object = g.fromJson(topicMessage, LinkedTreeMap.class); testReadCreateMirrorMaker(); @@ -111,9 +105,6 @@ public class TestMirrorMakerAgent { @Test public void testReadListMirrorMaker() { - when(agent.publishTopic( - "{\"messageID\":\"test\",\"listMirrorMaker\":[{\"name\":\"test\",\"consumer\":\"test\",\"producer\":\"test\",\"status\":\"STOPPED\"}]}")) - .thenReturn(null); String topicMessage = "{ messageID:\"test\", listAllMirrorMaker: { name:\"test\", consumer:\"test\", producer:\"test\", whitelist:\"test\",status:\"test\" }}"; LinkedTreeMap<?, ?> object = g.fromJson(topicMessage, LinkedTreeMap.class); testReadCreateMirrorMaker(); @@ -123,9 +114,6 @@ public class TestMirrorMakerAgent { @Test public void testReadWhitelistMirrorMaker() { - when(agent.publishTopic( - "{\"messageID\":\"test\",\"listMirrorMaker\":[{\"name\":\"test\",\"consumer\":\"test\",\"producer\":\"test\",\"status\":\"STOPPED\"}]}")) - .thenReturn(null); String topicMessage = "{ messageID:\"test\", updateWhiteList: { name:\"test\", consumer:\"test\", producer:\"test\", whitelist:\"test\",status:\"test\" }}"; LinkedTreeMap<?, ?> object = g.fromJson(topicMessage, LinkedTreeMap.class); testReadCreateMirrorMaker(); |