Add several JUnits for test coverage
[aaf/authz.git] / auth / auth-core / src / test / java / org / onap / aaf / auth / env / test / JU_AuthzEnv.java
index 1117fce..f02a9de 100644 (file)
@@ -7,9 +7,9 @@
  * * Licensed under the Apache License, Version 2.0 (the "License");
  * * you may not use this file except in compliance with the License.
  * * You may obtain a copy of the License at
- * * 
+ * *
  *  *      http://www.apache.org/licenses/LICENSE-2.0
- * * 
+ * *
  *  * Unless required by applicable law or agreed to in writing, software
  * * distributed under the License is distributed on an "AS IS" BASIS,
  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -46,7 +46,7 @@ public class JU_AuthzEnv {
        private static final org.onap.aaf.cadi.Access.Level DEBUG = null;
        AuthzEnv authzEnv;
        enum Level {DEBUG, INFO, AUDIT, INIT, WARN, ERROR};
-       
+
        @Before
        public void setUp(){
                PropAccess access = null;
@@ -61,49 +61,49 @@ public class JU_AuthzEnv {
        public void testTransRate() {
        Long Result =   authzEnv.transRate();
        System.out.println("value of result " +Result); //Expected 300000
-       assertNotNull(Result);          
+       assertNotNull(Result);
        }
-       
+
        @Test
        public void checkNewTransNoAvg() {
-               
+
                Assert.assertNotNull(authzEnv.newTransNoAvg());
        }
-       
+
        @Test
        public void checkNewTrans() {
                Assert.assertNotNull(authzEnv.newTrans());
        }
-       
+
        @Test
        public void checkPropAccess() {
                Assert.assertNotNull(authzEnv.access());
        }
-       
+
        @Test
        public void checkgetProperties() { //TODO:[GABE]No setter for this, add?
                Assert.assertNotNull(authzEnv.getProperties());
                Assert.assertNotNull(authzEnv.getProperties("test"));
        }
-       
+
        @Test(expected = APIException.class)
        public void checkSetLog4JNames() throws APIException {//TODO: Find better way to test instead of just seeing if strings pass
                authzEnv.setLog4JNames("path", "root","service","audit","init","trace");
                authzEnv.setLog4JNames("path", "root",null,"audit","init","trace");
        }
-       
+
        @Test
        public void checkPropertyGetters(){
                authzEnv.setProperty("key","value");
                Assert.assertEquals(authzEnv.getProperty("key"), "value");
                Assert.assertEquals(authzEnv.getProperty("key","value"), "value");
        }
-       
+
        @Test
        public void checkPropertySetters(){
                Assert.assertEquals(authzEnv.getProperty("key","value"), authzEnv.setProperty("key","value"));
        }
-       
+
        @Test(expected = IOException.class)
        public void testDecryptException() throws IOException{
                String encrypted = "enc:";
@@ -111,7 +111,7 @@ public class JU_AuthzEnv {
                authzEnv.decrypt(encrypted, true);
                authzEnv.decrypt("", false);
        }
-       
+
        @Test
        public void testDecrypt() throws IOException{
                String encrypted = "encrypted";
@@ -119,41 +119,41 @@ public class JU_AuthzEnv {
                System.out.println("value of res " +Result);
                assertEquals("encrypted",Result);
        }
-       
+
        @Test
        public void testClassLoader() {
                ClassLoader cLoad = mock(ClassLoader.class);
                cLoad = authzEnv.classLoader();
                Assert.assertNotNull(cLoad);
        }
-       
+
        @Test
        public void testLoad() throws IOException {
                InputStream is = mock(InputStream.class);
                authzEnv.load(is);
        }
-       
+
        @Test
        public void testLog() {
                Access.Level lvl = Access.Level.DEBUG;
                Object msgs = null;
                authzEnv.log(lvl, msgs);
        }
-       
+
        @Test
        public void testLog1() {
                Exception e = new Exception();
                Object msgs = null;
                authzEnv.log(e, msgs);
        }
-       
+
        @Test
        public void testPrintf() {
                Access.Level lvl = Access.Level.DEBUG;
                Object msgs = null;
                authzEnv.printf(lvl, "Test", msgs);
        }
-       
+
        @Test
        public void testWillLog() {
                Access.Level lvl = Access.Level.DEBUG;
@@ -162,9 +162,9 @@ public class JU_AuthzEnv {
                Assert.assertFalse(test);
                test = authzEnv.willLog(lvl1);
                Assert.assertTrue(test);
-               
+
        }
-       
+
        @Test
        public void testSetLogLevel() {
                Access.Level lvl = Access.Level.DEBUG;