4966f30c2b3f4c859be208e8c4045b1849dc8b83
[dmaap/messagerouter/dmaapclient.git] / src / test / java / org / onap / dmaap / mr / tools / AuthCommandTest.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.tools;
24
25 import com.att.nsa.cmdtool.CommandNotReadyException;
26 import org.junit.After;
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.junit.runner.RunWith;
30 import org.mockito.InjectMocks;
31 import org.mockito.Mock;
32 import org.mockito.MockitoAnnotations;
33 import org.powermock.core.classloader.annotations.PowerMockIgnore;
34 import org.powermock.modules.junit4.PowerMockRunner;
35
36 import java.io.PrintStream;
37
38 import static org.junit.Assert.assertTrue;
39
40 @RunWith(PowerMockRunner.class)
41 @PowerMockIgnore("jdk.internal.reflect.*")
42 public class AuthCommandTest {
43     @InjectMocks
44     private AuthCommand command = null;
45     @Mock
46     private PrintStream printStream;
47
48     @Before
49     public void setUp() throws Exception {
50         MockitoAnnotations.initMocks(this);
51
52     }
53
54     @After
55     public void tearDown() throws Exception {
56
57     }
58
59     @Test
60     public void testGetMatches() {
61
62         command.getMatches();
63         assertTrue(true);
64
65     }
66
67     @Test
68     public void testCheckReady() {
69
70         try {
71             command.checkReady(new MRCommandContext());
72         } catch (CommandNotReadyException e) {
73             // TODO Auto-generated catch block
74             e.printStackTrace();
75         }
76         assertTrue(true);
77
78     }
79
80     @Test
81     public void testExecute() {
82
83         try {
84             String[] parts = new String[5];
85             command.execute(parts, new MRCommandContext(), printStream);
86         } catch (CommandNotReadyException e) {
87             // TODO Auto-generated catch block
88             e.printStackTrace();
89         }
90         assertTrue(true);
91
92     }
93
94     @Test
95     public void testExecute1() {
96
97         try {
98             String[] parts = {"userName", "password"};
99             command.execute(parts, new MRCommandContext(), printStream);
100         } catch (CommandNotReadyException e) {
101             // TODO Auto-generated catch block
102             e.printStackTrace();
103         }
104         assertTrue(true);
105
106     }
107
108     @Test
109     public void testDisplayHelp() {
110
111         command.displayHelp(printStream);
112         assertTrue(true);
113
114     }
115
116 }