Mass add newline package (Style Warnings)
[aaf/authz.git] / cadi / core / src / test / java / org / onap / aaf / cadi / lur / test / JU_NullLur.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,Z
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
23 package org.onap.aaf.cadi.lur.test;
24
25 import java.security.Principal;
26 import java.util.List;
27
28 import static org.hamcrest.CoreMatchers.*;
29 import static org.junit.Assert.*;
30 import org.junit.*;
31 import org.mockito.Mock;
32 import org.mockito.MockitoAnnotations;
33 import java.lang.reflect.*;
34
35 import org.onap.aaf.cadi.Permission;
36 import org.onap.aaf.cadi.lur.NullLur;
37
38 public class JU_NullLur {
39
40     @Mock
41     Principal p;
42
43     @Mock
44     Permission perm;
45
46     @Mock
47     List<Permission> perms;
48
49     private NullLur nullLur;
50
51     @Before
52     public void setup() {
53         MockitoAnnotations.initMocks(this);
54
55         nullLur = new NullLur();
56     }
57
58     @Test
59     public void coverageTests() throws Exception {
60
61         Field nullClass = NullLur.class.getDeclaredField("NULL");
62         nullClass.setAccessible(true);
63         assertThat(((Permission) nullClass.get(NullLur.class)).permType(), is(""));
64         assertThat(((Permission) nullClass.get(NullLur.class)).getKey(), is(""));
65         assertFalse(((Permission) nullClass.get(NullLur.class)).match(perm));
66
67         nullLur.fishAll(p, perms);
68         nullLur.destroy();
69
70         assertFalse(nullLur.fish(p, perm));
71         assertFalse(nullLur.handlesExclusively(perm));
72         assertFalse(nullLur.handles(p));
73         assertThat(nullLur.createPerm(""), is(nullClass.get(NullLur.class)));
74
75         StringBuilder sb = new StringBuilder();
76         nullLur.clear(p, sb);
77         assertThat(sb.toString(), is("NullLur\n"));
78         assertThat(nullLur.toString(), is("NullLur\n"));
79     }
80
81 }