1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * ===========================================================================
\r
7 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * * you may not use this file except in compliance with the License.
\r
9 * * You may obtain a copy of the License at
\r
11 * * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * * Unless required by applicable law or agreed to in writing, software
\r
14 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * * See the License for the specific language governing permissions and
\r
17 * * limitations under the License.
\r
18 * * ============LICENSE_END====================================================
\r
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
22 ******************************************************************************/
\r
23 package org.onap.aaf.authz.cm.api;
\r
25 import static org.junit.Assert.*;
\r
26 import static org.mockito.Mockito.mock;
\r
28 import javax.servlet.http.HttpServletRequest;
\r
29 import javax.servlet.http.HttpServletResponse;
\r
31 import org.junit.BeforeClass;
\r
32 import org.junit.Rule;
\r
33 import org.junit.Test;
\r
34 import org.junit.rules.ExpectedException;
\r
35 import org.junit.runner.RunWith;
\r
36 import org.mockito.Mock;
\r
37 import org.mockito.runners.MockitoJUnitRunner;
\r
38 import org.onap.aaf.authz.cm.api.API_Artifact;
\r
39 import org.onap.aaf.authz.cm.service.CertManAPI;
\r
40 import org.onap.aaf.authz.env.AuthzTrans;
\r
43 @RunWith(MockitoJUnitRunner.class)
\r
44 public class JU_API_Artifact {
\r
47 private static API_Artifact api;
\r
50 private static CertManAPI certManApi;
\r
52 private static CertManAPI noMockAPI;
\r
53 private static API_Artifact api_1;
\r
55 private static HttpServletRequest req;
\r
56 private static HttpServletResponse res;
\r
59 public static void setUp() {
\r
60 AuthzTrans trans = mock(AuthzTrans.class);
\r
61 req = mock(HttpServletRequest.class);
\r
62 trans.setProperty("testTag", "UserValue");
\r
67 public ExpectedException thrown= ExpectedException.none();
\r
70 public void init_bothValued() {
\r
72 api.init(certManApi);
\r
73 } catch (Exception e) {
\r
74 thrown.expect(NullPointerException.class);
\r
75 e.printStackTrace();
\r
80 public void init_Null_() {
\r
83 } catch (Exception e) {
\r
84 //thrown.expect(Exception.class);
\r
85 e.printStackTrace();
\r
90 public void init_NMC_Null() {
\r
93 } catch (Exception e) {
\r
94 //thrown.expect(NullPointerException.class);
\r
95 e.printStackTrace();
\r
100 public void init_NMC() {
\r
102 api_1.init(noMockAPI);
\r
103 } catch (Exception e) {
\r
104 //thrown.expect(NullPointerException.class);
\r
105 e.printStackTrace();
\r