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 com.att.cmd.user;
\r
25 import static org.junit.Assert.assertEquals;
\r
26 import static org.junit.Assert.assertNotNull;
\r
27 import static org.mockito.Mockito.mock;
\r
28 import static org.mockito.Mockito.when;
\r
30 import org.junit.BeforeClass;
\r
31 import org.junit.Test;
\r
32 import org.junit.runner.RunWith;
\r
33 import org.mockito.runners.MockitoJUnitRunner;
\r
35 import com.att.cadi.CadiException;
\r
36 import com.att.cadi.LocatorException;
\r
37 import com.att.inno.env.APIException;
\r
39 @RunWith(MockitoJUnitRunner.class)
\r
40 public class JU_Cred {
\r
42 private static Cred testCred;
\r
43 private static User testUser;
\r
47 public static void setUp() {
\r
48 testCred = mock(Cred.class);
\r
49 testUser = mock(User.class);
\r
51 when(testCred._exec(4, "String1","String2","String3","String4")).thenReturn(10);
\r
52 } catch (CadiException e) {
\r
53 // TODO Auto-generated catch block
\r
54 e.printStackTrace();
\r
55 } catch (APIException e) {
\r
56 // TODO Auto-generated catch block
\r
57 e.printStackTrace();
\r
58 } catch (LocatorException e) {
\r
59 // TODO Auto-generated catch block
\r
60 e.printStackTrace();
\r
65 public void exec() throws CadiException, APIException, LocatorException {
\r
66 assertEquals(testCred._exec(4, "String1","String2","String3","String4"), 10);
\r
71 public void exec_add() {
\r
73 assertNotNull(testCred._exec(0, "zeroed","add","del","reset","extend"));
\r
74 } catch (CadiException | APIException | LocatorException e) {
\r
75 // TODO Auto-generated catch block
\r
76 e.printStackTrace();
\r
82 public void exec_del() {
\r
84 assertNotNull(testCred._exec(1, "zeroed","add","del","reset","extend"));
\r
85 } catch (CadiException | APIException | LocatorException e) {
\r
86 // TODO Auto-generated catch block
\r
87 e.printStackTrace();
\r
93 public void exec_reset() {
\r
95 assertNotNull(testCred._exec(2, "zeroed","add","del","reset","extend"));
\r
96 } catch (CadiException | APIException | LocatorException e) {
\r
97 // TODO Auto-generated catch block
\r
98 e.printStackTrace();
\r
104 public void exec_extend() {
\r
106 assertNotNull(testCred._exec(3, "zeroed","add","del","reset","extend"));
\r
107 } catch (CadiException | APIException | LocatorException e) {
\r
108 // TODO Auto-generated catch block
\r
109 e.printStackTrace();
\r