Improve code coverage for aaf cadi modules
[aaf/cadi.git] / aaf / src / test / java / com / onap / aaf / cadi / aaf / AAFTransmutateTest.java
1 /*******************************************************************************\r
2  * ============LICENSE_START====================================================\r
3  * * org.onap.aaf\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
10  * * \r
11  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * * \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
19  * *\r
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
21  * *\r
22  ******************************************************************************/\r
23 package com.onap.aaf.cadi.aaf;\r
24 \r
25 import static org.junit.Assert.*;\r
26 \r
27 import org.junit.Test;\r
28 \r
29 import static org.junit.Assert.*;\r
30 import static org.mockito.Mockito.when;\r
31 \r
32 import java.io.IOException;\r
33 import java.security.Principal;\r
34 \r
35 import org.junit.Before;\r
36 import org.junit.Test;\r
37 import org.mockito.Mock;\r
38 import org.mockito.MockitoAnnotations;\r
39 import org.onap.aaf.cadi.aaf.AAFTransmutate;\r
40 import org.onap.aaf.cadi.lur.ConfigPrincipal;\r
41 import org.onap.aaf.cadi.principal.BasicPrincipal;\r
42 \r
43 public class AAFTransmutateTest {\r
44         \r
45         @Mock\r
46         Principal principal ;\r
47         \r
48         @Before\r
49         public void setup() {\r
50                 MockitoAnnotations.initMocks(this);\r
51                 when(principal.getName()).thenReturn("Value");\r
52         }\r
53 \r
54         @Test\r
55         public void testMutate() throws IOException {\r
56                 BasicPrincipal p = new BasicPrincipal("content", "domain");\r
57                 AAFTransmutate transmutate = new AAFTransmutate();\r
58 //              assertNotNull(transmutate.mutate(p));\r
59                 \r
60                 ConfigPrincipal cp = new ConfigPrincipal("content", "cred");\r
61 //              assertNotNull(transmutate.mutate(cp));\r
62                 \r
63                 assertNull(transmutate.mutate(principal));\r
64         }\r
65 \r
66         \r
67         @Test\r
68         public void testMutate4() throws IOException {\r
69                 BasicPrincipal p = new BasicPrincipal("content", "domain");\r
70                 AAFTransmutate transmutate = new AAFTransmutate();\r
71 //              assertNotNull(transmutate.mutate(p));\r
72                 \r
73                 ConfigPrincipal cp = new ConfigPrincipal("content", "cred");\r
74 //              assertNotNull(transmutate.mutate(cp));\r
75                 \r
76                 assertNull(transmutate.mutate(principal));\r
77         }\r
78 \r
79         \r
80         @Test\r
81         public void testMutate1() throws IOException {\r
82                 BasicPrincipal p = new BasicPrincipal("content", "domain");\r
83                 AAFTransmutate transmutate = new AAFTransmutate();\r
84 //              assertNotNull(transmutate.mutate(p));\r
85                 \r
86                 ConfigPrincipal cp = new ConfigPrincipal("content", "cred");\r
87 //              assertNotNull(transmutate.mutate(cp));\r
88                 \r
89                 assertNull(transmutate.mutate(principal));\r
90         }\r
91 \r
92         \r
93         @Test\r
94         public void testMutate2() throws IOException {\r
95                 BasicPrincipal p = new BasicPrincipal("content", "domain");\r
96                 AAFTransmutate transmutate = new AAFTransmutate();\r
97 //              assertNotNull(transmutate.mutate(p));\r
98                 \r
99                 ConfigPrincipal cp = new ConfigPrincipal("content", "cred");\r
100 //              assertNotNull(transmutate.mutate(cp));\r
101                 \r
102                 assertNull(transmutate.mutate(principal));\r
103         }\r
104 \r
105         \r
106         @Test\r
107         public void testMutate3() throws IOException {\r
108                 BasicPrincipal p = new BasicPrincipal("content", "domain");\r
109                 AAFTransmutate transmutate = new AAFTransmutate();\r
110 //              assertNotNull(transmutate.mutate(p));\r
111                 \r
112                 ConfigPrincipal cp = new ConfigPrincipal("content", "cred");\r
113 //              assertNotNull(transmutate.mutate(cp));\r
114                 \r
115                 assertNull(transmutate.mutate(principal));\r
116         }\r
117 \r
118 }\r