1 /*******************************************************************************
2 * ============LICENSE_START====================================================
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
11 * * http://www.apache.org/licenses/LICENSE-2.0
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====================================================
21 ******************************************************************************/
23 package org.onap.aaf.cadi.lur.test;
25 import java.security.Principal;
26 import java.util.List;
28 import static org.hamcrest.CoreMatchers.*;
29 import static org.junit.Assert.*;
31 import org.mockito.Mock;
32 import org.mockito.MockitoAnnotations;
33 import java.lang.reflect.*;
35 import org.onap.aaf.cadi.Permission;
36 import org.onap.aaf.cadi.lur.NullLur;
38 public class JU_NullLur {
47 List<Permission> perms;
49 private NullLur nullLur;
53 MockitoAnnotations.initMocks(this);
55 nullLur = new NullLur();
59 public void coverageTests() throws Exception {
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));
67 nullLur.fishAll(p, perms);
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)));
75 StringBuilder sb = new StringBuilder();
77 assertThat(sb.toString(), is("NullLur\n"));
78 assertThat(nullLur.toString(), is("NullLur\n"));