summaryrefslogtreecommitdiffstats
path: root/src/test/java/com/att
diff options
context:
space:
mode:
authorsunil unnava <su622b@att.com>2018-05-21 19:11:22 -0400
committersunil unnava <su622b@att.com>2018-05-21 19:11:32 -0400
commit79f026709bde8b26fd9b5f31535ee429497b951d (patch)
tree4cad025cbdeeaa95f0a6885c255ab946d8799a5a /src/test/java/com/att
parent187e90c38e53cf155d13c7ed115350d14f98a112 (diff)
Updated the testcases
Issue-ID: DMAAP-500 Change-Id: I3dfce37a18d3568a3663aeb3fe83e1672b949464 Signed-off-by: sunil unnava <su622b@att.com>
Diffstat (limited to 'src/test/java/com/att')
-rw-r--r--src/test/java/com/att/nsa/dmaapMMAgent/TestMirrorMakerAgent.java24
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();