Mass removal of all Tabs (Style Warnings)
[aaf/authz.git] / cadi / core / src / test / java / org / onap / aaf / cadi / test / JU_Access.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,
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 package org.onap.aaf.cadi.test;
23
24 import static org.junit.Assert.*;
25 import static org.hamcrest.CoreMatchers.*;
26 import org.junit.*;
27
28 import java.io.IOException;
29
30 import org.onap.aaf.cadi.Access;
31 import org.onap.aaf.cadi.Access.Level;
32
33 public class JU_Access {
34
35     @Test
36     public void levelTests() {
37         assertTrue(Level.DEBUG.inMask(0x1));
38         for (int i = 2; i > 0; i <<= 1) {
39             assertFalse(Level.DEBUG.inMask(i));
40         }
41         assertFalse(Level.DEBUG.inMask(0x80000000));
42
43         assertThat(Level.DEBUG.addToMask(0x2), is(0x3));
44         assertThat(Level.DEBUG.delFromMask(0x1), is(0x0));
45         assertThat(Level.DEBUG.toggle(0x2), is(0x3));
46         assertThat(Level.DEBUG.toggle(0x1), is(0x0));
47         assertThat(Level.DEBUG.maskOf(), is(123153));
48         assertThat(Level.NONE.maskOf(), is(0));
49     }
50
51     @Test
52     public void nullTests() throws IOException {
53         // These are entirely for coverage
54         Access.NULL.log(Level.DEBUG);
55         Access.NULL.printf(Level.DEBUG, "");
56         Access.NULL.log(new Exception());
57         Access.NULL.classLoader();
58         assertThat(Access.NULL.getProperty("", ""), is(nullValue()));
59         Access.NULL.load(System.in);
60         Access.NULL.setLogLevel(Level.DEBUG);
61         assertThat(Access.NULL.decrypt("test", true), is("test"));
62         assertFalse(Access.NULL.willLog(Level.DEBUG));
63         assertThat(Access.NULL.getProperties(), is(not(nullValue())));
64     }
65
66 }