Mass removal of all Tabs (Style Warnings)
[aaf/authz.git] / auth / auth-certman / src / test / java / org / onap / aaf / auth / cm / api / JU_API_Cert.java
1 /*******************************************************************************
2  * ============LICENSE_START====================================================
3  * * org.onap.aaf
4  * * ===========================================================================
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * * ===========================================================================
7  * * Licensed under the Apache License, Version 2.0 (the "License");
8  * * you may not use this file except in compliance with the License.
9  * * You may obtain a copy of the License at
10  * * 
11  *  *      http://www.apache.org/licenses/LICENSE-2.0
12  * * 
13  *  * Unless required by applicable law or agreed to in writing, software
14  * * distributed under the License is distributed on an "AS IS" BASIS,
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * * See the License for the specific language governing permissions and
17  * * limitations under the License.
18  * * ============LICENSE_END====================================================
19  * *
20  * *
21  ******************************************************************************/
22 package org.onap.aaf.auth.cm.api;
23
24 import static org.junit.Assert.*;
25 import static org.mockito.Mockito.mock;
26
27 import javax.servlet.http.HttpServletRequest;
28 import javax.servlet.http.HttpServletResponse;
29
30 import org.junit.BeforeClass;
31 import org.junit.Rule;
32 import org.junit.Test;
33 import org.junit.rules.ExpectedException;
34 import org.junit.runner.RunWith;
35 import org.mockito.Mock;
36 import org.mockito.runners.MockitoJUnitRunner;
37 import org.onap.aaf.auth.cm.AAF_CM;
38 import org.onap.aaf.auth.cm.api.API_Cert;
39 import org.onap.aaf.auth.env.AuthzTrans;
40 ;
41
42 @RunWith(MockitoJUnitRunner.class)
43 public class JU_API_Cert {
44     
45     @Mock
46     private static API_Cert api;
47     
48     @Mock
49     private static AAF_CM certManApi;
50     
51     private static AAF_CM noMockAPI;
52     private static API_Cert api_1;
53     
54     private static HttpServletRequest req;
55     private static HttpServletResponse res;
56     
57     @BeforeClass
58     public static void setUp() {
59         AuthzTrans trans = mock(AuthzTrans.class);
60         req = mock(HttpServletRequest.class);
61         trans.setProperty("testTag", "UserValue");
62         trans.set(req);
63     }
64     
65     @Rule
66     public ExpectedException thrown= ExpectedException.none();
67     
68     @Test
69     public void init_bothValued() {
70         try {
71             api.init(certManApi);
72         } catch (Exception e) {
73             //thrown.expect(NullPointerException.class);
74             e.printStackTrace();
75         }
76     }
77     
78     @Test
79     public void init_Null_() {
80         try {
81             api.init(null);
82         } catch (Exception e) {
83             //thrown.expect(Exception.class);
84             e.printStackTrace();
85         }
86     }
87     
88     @Test
89     public void init_NMC_Null() {
90         try {
91             api_1.init(null);
92         } catch (Exception e) {
93             //thrown.expect(NullPointerException.class);
94             e.printStackTrace();
95         }
96     }
97     
98     @Test
99     public void init_NMC() {
100         try {
101             api_1.init(noMockAPI);
102         } catch (Exception e) {
103             //thrown.expect(NullPointerException.class);
104             e.printStackTrace();
105         }
106     }
107 }