[DMAAP-CLIENT] First sonar issues review part2
[dmaap/messagerouter/dmaapclient.git] / src / test / java / org / onap / dmaap / mr / test / support / MRConsumerMockTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP Policy Engine
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Modifications Copyright © 2021 Orange.
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.dmaap.mr.test.support;
24
25 import org.junit.After;
26 import org.junit.Before;
27 import org.junit.Test;
28
29 import java.io.IOException;
30 import java.util.ArrayList;
31
32 import static org.junit.Assert.assertTrue;
33
34 public class MRConsumerMockTest {
35     private MRConsumerMock cons = null;
36     private MRConsumerMock.Entry entry = null;
37
38     @Before
39     public void setUp() throws Exception {
40         cons = new MRConsumerMock();
41         entry = cons.new Entry(100, 200, "statusMsg");
42
43     }
44
45     @After
46     public void tearDown() throws Exception {
47
48     }
49
50     @Test
51     public void testClose() {
52
53         cons.close();
54         assertTrue(true);
55
56     }
57
58     @Test
59     public void testRun() {
60         try {
61             entry.run();
62         } catch (IOException e) {
63             // TODO Auto-generated catch block
64             e.printStackTrace();
65         }
66
67         assertTrue(true);
68
69     }
70
71     @Test
72     public void testSetApiCredentials() {
73         cons.setApiCredentials("apikey", "apisecret");
74         assertTrue(true);
75
76     }
77
78     @Test
79     public void testClearApiCredentials() {
80         cons.clearApiCredentials();
81         assertTrue(true);
82
83     }
84
85     @Test
86     public void testAdd() {
87         cons.add(entry);
88         assertTrue(true);
89
90     }
91
92     @Test
93     public void testAddImmediateMsg() {
94         cons.addImmediateMsg("ImmediateMsg");
95         assertTrue(true);
96
97     }
98
99     @Test
100     public void testAddDelayedMsg() {
101         cons.addDelayedMsg(100, "msg");
102         assertTrue(true);
103
104     }
105
106     @Test
107     public void testAddImmediateMsgGroup() {
108         cons.addImmediateMsgGroup(new ArrayList<String>());
109         assertTrue(true);
110
111     }
112
113     @Test
114     public void testAddDelayedMsgGroup() {
115         cons.addDelayedMsgGroup(100, new ArrayList<String>());
116         assertTrue(true);
117
118     }
119
120     @Test
121     public void testAddImmediateError() {
122         cons.addImmediateError(200, "OK");
123         assertTrue(true);
124
125     }
126
127     @Test
128     public void testFetch() {
129         try {
130             cons.fetch();
131         } catch (IOException e) {
132             // TODO Auto-generated catch block
133             e.printStackTrace();
134         }
135         assertTrue(true);
136
137     }
138
139     @Test
140     public void testFetch2() {
141         try {
142             cons.fetch(100, 200);
143         } catch (IOException e) {
144             // TODO Auto-generated catch block
145             e.printStackTrace();
146         }
147         assertTrue(true);
148
149     }
150
151     @Test
152     public void testLogTo() {
153         cons.logTo(null);
154         assertTrue(true);
155
156     }
157
158     @Test
159     public void testFetchWithReturnConsumerResponse() {
160         cons.fetchWithReturnConsumerResponse();
161         assertTrue(true);
162
163     }
164
165     @Test
166     public void testGetchWithReturnConsumerResponse() {
167         cons.fetchWithReturnConsumerResponse(100, 200);
168         assertTrue(true);
169
170     }
171 }