diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
index 4a30769..a513da0 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
@@ -132,9 +132,9 @@
 
     public final HistoryDAO historyDAO;
     public final CachedNSDAO nsDAO;
-    public final CachedRoleDAO roleDAO;
+    public  CachedRoleDAO roleDAO;
     public final CachedPermDAO permDAO;
-    public final CachedUserRoleDAO userRoleDAO;
+    public CachedUserRoleDAO userRoleDAO;
     public final CachedCredDAO credDAO;
     public final CachedCertDAO certDAO;
     public final DelegateDAO delegateDAO;
@@ -145,6 +145,7 @@
 
     public Question(AuthzTrans trans, Cluster cluster, String keyspace, boolean startClean) throws APIException, IOException {
         PERMS = trans.slot("USER_PERMS");
+        System.out.println(trans.init());
         trans.init().log("Instantiating DAOs");
         long expiresIn = Long.parseLong(trans.getProperty(Config.AAF_USER_EXPIRES, Config.AAF_USER_EXPIRES_DEF));
         historyDAO = new HistoryDAO(trans, cluster, keyspace);
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedPermDAOTest.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedPermDAOTest.java
new file mode 100644
index 0000000..66c32a7
--- /dev/null
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedPermDAOTest.java
@@ -0,0 +1,166 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.auth.dao.cached;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.dao.CIDAO;
+import org.onap.aaf.auth.dao.cass.PermDAO;
+import org.onap.aaf.auth.dao.cass.PermDAO.Data;
+import org.onap.aaf.auth.dao.cass.RoleDAO;
+import org.onap.aaf.auth.dao.cass.Status;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.auth.env.AuthzTransImpl;
+import org.onap.aaf.auth.layer.Result;
+import org.onap.aaf.misc.env.LogTarget;
+
+public class JU_CachedPermDAOTest {
+
+	@Mock
+	private CIDAO<AuthzTrans> info;
+	@Mock
+	private PermDAO dao;
+	
+	@Mock
+	RoleDAO.Data role;
+	
+	@Mock
+	private PermDAO.Data perm;
+	
+	@Mock
+	private AuthzTrans trans;
+	@Mock
+	private Result<List<PermDAO.Data>> value;
+
+	@Before
+	public void setUp() throws Exception {
+		initMocks(this);
+
+		when(dao.readNS(trans, "ns")).thenReturn(value);
+		when(trans.debug()).thenReturn(new LogTarget() {
+            
+            @Override
+            public void printf(String fmt, Object... vars) {}
+            
+            @Override
+            public void log(Throwable e, Object... msgs) {
+                e.getMessage();
+                e.printStackTrace();
+                msgs.toString();
+                
+            }
+            
+            @Override
+            public void log(Object... msgs) {
+            }
+            
+            @Override
+            public boolean isLoggable() {
+                
+                return true;
+            }
+        });
+	}
+
+	@Test
+	public void testReadNS() {
+		when(value.isOKhasData()).thenReturn(true);
+		when(value.isOK()).thenReturn(false);
+		CachedPermDAO ccDao = new CachedPermDAO(dao, info, 100l);
+
+		Result<List<Data>> result = ccDao.readNS(trans, "ns");
+
+		assertEquals(result, value);
+
+		when(value.isOKhasData()).thenReturn(false);
+
+		result = ccDao.readNS(trans, "ns");
+
+		assertEquals(result.status, Status.ERR_PermissionNotFound);
+
+		ccDao.readChildren(trans, "ns", "type");
+
+		verify(dao).readChildren(trans, "ns", "type");
+	}
+	
+	@Test
+	public void testReadByTypeSuccess() {
+		CachedPermDAO roleDaoObj =new CachedPermDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
+		Result<List<Data>> retVal1 = new Result<List<Data>>(null,1,"test4",new String[0]);
+		Mockito.doReturn(retVal1).when(dao).readByType(trans, "test4","");
+		Result<List<Data>> retVal = roleDaoObj.readByType(trans, "test4","");
+//		System.out.println(retVal.status);
+		//retVal.status = 0;
+		assertEquals("1", Integer.toString(retVal.status));
+	}	
+	
+	@Test
+	public void testReadByTypeFailure() {
+		CachedPermDAO roleDaoObj =new CachedPermDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
+		Result<List<Data>> retVal1 = new Result<List<Data>>(null,0,"test3123",new String[0]);
+		Mockito.doReturn(retVal1).when(dao).readByType(trans, "test3","");
+		Result<List<Data>> retVal = roleDaoObj.readByType(trans, "test3","");
+		//System.out.println(retVal.status);
+		assertEquals("23", Integer.toString(retVal.status));
+	}
+	
+	@Test
+	public void testAddRole() {
+		CachedPermDAO roleDaoObj =new CachedPermDAO(dao,info, 10);
+		Result<Void> retVal1 = new Result<Void>(null,0,"testAddRole",new String[0]);
+		Mockito.doReturn(retVal1).when(info).touch(trans, null,null);
+		Mockito.doReturn(retVal1).when(dao).addRole(trans, perm,null);
+		Result<Void> retVal = roleDaoObj.addRole(trans, perm, role);
+//		System.out.println("ret value is::"+retVal);
+		assertEquals("testAddRole", retVal.toString());
+	}
+	
+	@Test
+	public void testDelRole() {
+		CachedPermDAO roleDaoObj =new CachedPermDAO(dao,info, 10);
+		Result<Void> retVal1 = new Result<Void>(null,0,"testAddRole",new String[0]);
+		Mockito.doReturn(retVal1).when(info).touch(trans, null,null);
+		Mockito.doReturn(retVal1).when(dao).delRole(trans, perm,null);
+		Result<Void> retVal = roleDaoObj.delRole(trans, perm, role);
+//		System.out.println(retVal);
+		assertEquals("testAddRole", retVal.toString());
+	}
+
+	@Test
+	public void testAddDescription() {
+		CachedPermDAO roleDaoObj =new CachedPermDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
+		Result<Void> retVal1 = new Result<Void>(null,0,"test1",new String[0]);
+		Mockito.doReturn(retVal1).when(dao).addDescription(trans, "","","","","");
+		Result<Void> retVal = roleDaoObj.addDescription(trans, "", "","","","");
+		//System.out.println(retVal.status);
+		assertEquals("0", Integer.toString(retVal.status));
+	}
+
+}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedRoleDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedRoleDAO.java
deleted file mode 100644
index 2e27bfd..0000000
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedRoleDAO.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/**
- * ============LICENSE_START====================================================
- * org.onap.aaf
- * ===========================================================================
- * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
- * ===========================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END====================================================
- *
- */
-package org.onap.aaf.auth.dao.cached;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.aaf.auth.dao.CIDAO;
-import org.onap.aaf.auth.dao.cass.PermDAO;
-import org.onap.aaf.auth.dao.cass.RoleDAO;
-import org.onap.aaf.auth.dao.cass.RoleDAO.Data;
-import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.env.AuthzTransImpl;
-import org.onap.aaf.auth.layer.Result;
-import org.onap.aaf.misc.env.LogTarget;
-
-
-@RunWith(MockitoJUnitRunner.class) 
-public class JU_CachedRoleDAO {
-
-	@Mock
-	RoleDAO dao;
-	
-	@Mock
-	CIDAO<AuthzTrans> info;
-	
-	@Mock
-	AuthzTransImpl trans;
-	
-	@Mock
-	RoleDAO.Data data;
-	
-	@Mock
-	PermDAO.Data permData;
-	
-	@Before
-	public void setUp() throws Exception {
-		initMocks(this);
-		when(trans.debug()).thenReturn(new LogTarget() {
-            
-            @Override
-            public void printf(String fmt, Object... vars) {}
-            
-            @Override
-            public void log(Throwable e, Object... msgs) {
-                e.getMessage();
-                e.printStackTrace();
-                msgs.toString();
-                
-            }
-            
-            @Override
-            public void log(Object... msgs) {
-            }
-            
-            @Override
-            public boolean isLoggable() {
-                
-                return true;
-            }
-        });
-	}
-	
-	@Test
-	public void testReadNameSuccess() {
-		CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
-		Result<List<Data>> retVal1 = new Result<List<Data>>(null,1,"test4",new String[0]);
-		Mockito.doReturn(retVal1).when(dao).readName(trans, "test4");
-//		Mockito.when(roleDaoObj.get(Mockito.any(), Mockito.any(String.class), Mockito.any())).thenReturn(retVal1);
-		Result<List<Data>> retVal = roleDaoObj.readName(trans, "test4");
-//		System.out.println(retVal.status);
-		//retVal.status = 0;
-		assertEquals("1", Integer.toString(retVal.status));
-	}	
-	
-	@Test
-	public void testReadNameFailure() {
-		CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
-		Result<List<Data>> retVal1 = new Result<List<Data>>(null,0,"test3123",new String[0]);
-		Mockito.doReturn(retVal1).when(dao).readName(trans, "test3");
-//		Mockito.when(roleDaoObj.get(Mockito.any(), Mockito.any(String.class), Mockito.any())).thenReturn(retVal1);
-		Result<List<Data>> retVal = roleDaoObj.readName(trans, "test3");
-//		System.out.println(retVal.status);
-		assertEquals("22", Integer.toString(retVal.status));
-	}
-	@Test
-	public void testReadNSSuccess() {
-		CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
-		Result<List<Data>> retVal1 = new Result<List<Data>>(null,1,"test",new String[0]);
-		Mockito.doReturn(retVal1).when(dao).readNS(trans, "");
-//		Mockito.when(roleDaoObj.get(Mockito.any(), Mockito.any(String.class), Mockito.any())).thenReturn(retVal1);
-		Result<List<Data>> retVal = roleDaoObj.readNS(trans, "");
-//		System.out.println(retVal.status);
-		assertEquals("1", Integer.toString(retVal.status));
-	}	
-	@Test
-	public void testReadNSFailure() {
-		CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
-		Result<List<Data>> retVal1 = new Result<List<Data>>(null,0,"test1",new String[0]);
-		Mockito.doReturn(retVal1).when(dao).readNS(trans, "");
-//		Mockito.when(roleDaoObj.get(Mockito.any(), Mockito.any(String.class), Mockito.any())).thenReturn(retVal1);
-		Result<List<Data>> retVal = roleDaoObj.readNS(trans, "");
-//		System.out.println(retVal.status);
-		assertEquals("22", Integer.toString(retVal.status));
-	}
-	
-	@Test
-	public void testReadChildren() {
-		CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
-		Result<List<Data>> retVal1 = new Result<List<Data>>(null,0,"test1",new String[0]);
-		Mockito.doReturn(retVal1).when(dao).readChildren(trans, "","");
-		Result<List<Data>> retVal = roleDaoObj.readChildren(trans, "", "");
-		//System.out.println(retVal.status);
-		assertEquals("0", Integer.toString(retVal.status));
-	}
-	
-	@Test
-	public void testAddPerm() {
-		CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);
-		Result<Void> retVal1 = new Result<Void>(null,0,"testAddPerm",new String[0]);
-		Mockito.doReturn(retVal1).when(info).touch(trans, null,null);
-		Mockito.doReturn(retVal1).when(dao).addPerm(trans, data,permData);
-		Result<Void> retVal = roleDaoObj.addPerm(trans, data, permData);
-		assertEquals("testAddPerm", retVal.toString());
-	}
-	
-	@Test
-	public void testDelPerm() {
-		CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);
-		Result<Void> retVal1 = new Result<Void>(null,0,"testAddPerm",new String[0]);
-		Mockito.doReturn(retVal1).when(info).touch(trans, null,null);
-		Mockito.doReturn(retVal1).when(dao).delPerm(trans, data,permData);
-		Result<Void> retVal = roleDaoObj.delPerm(trans, data, permData);
-		System.out.println(retVal);
-		assertEquals("testAddPerm", retVal.toString());
-	}
-
-	@Test
-	public void testAddDescription() {
-		CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
-		Result<Void> retVal1 = new Result<Void>(null,0,"test1",new String[0]);
-		Mockito.doReturn(retVal1).when(dao).addDescription(trans, "","","");
-		Result<Void> retVal = roleDaoObj.addDescription(trans, "", "","");
-		//System.out.println(retVal.status);
-		assertEquals("0", Integer.toString(retVal.status));
-	}
-}
\ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedUserRoleDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedUserRoleDAO.java
new file mode 100644
index 0000000..8dcf8e4
--- /dev/null
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedUserRoleDAO.java
@@ -0,0 +1,180 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.auth.dao.cached;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.dao.CIDAO;
+import org.onap.aaf.auth.dao.cass.PermDAO;
+import org.onap.aaf.auth.dao.cass.RoleDAO;
+import org.onap.aaf.auth.dao.cass.UserRoleDAO;
+import org.onap.aaf.auth.dao.cass.UserRoleDAO.Data;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.auth.env.AuthzTransImpl;
+import org.onap.aaf.auth.layer.Result;
+import org.onap.aaf.cadi.principal.TaggedPrincipal;
+import org.onap.aaf.misc.env.LogTarget;
+import org.onap.aaf.misc.env.Slot;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class JU_CachedUserRoleDAO {
+
+	@Mock
+	UserRoleDAO dao;
+	
+	@Mock
+	CIDAO<AuthzTrans> info;
+	
+	@Mock
+	AuthzTransImpl trans;
+	
+	@Mock
+	RoleDAO.Data data;
+	
+	@Mock
+	PermDAO.Data permData;
+	
+	@Before
+	public void setUp() throws Exception {
+		initMocks(this);
+		when(trans.debug()).thenReturn(new LogTarget() {
+            
+            @Override
+            public void printf(String fmt, Object... vars) {}
+            
+            @Override
+            public void log(Throwable e, Object... msgs) {
+                e.getMessage();
+                e.printStackTrace();
+                msgs.toString();
+                
+            }
+            
+            @Override
+            public void log(Object... msgs) {
+            }
+            
+            @Override
+            public boolean isLoggable() {
+                
+                return true;
+            }
+        });
+	}
+	
+	private class TaggedPrincipalStub extends TaggedPrincipal {
+		String name="TaggedPrincipalStub";
+        public TaggedPrincipalStub() { super(); }
+        public TaggedPrincipalStub(final TagLookup tl) { super(tl); }
+        @Override public String getName() { return name; }
+        @Override public String tag() { return null; }
+    }
+	
+	@Test
+	public void testReadName() {
+		CachedUserRoleDAO roleDaoObj =new CachedUserRoleDAO(dao,info, 10L);
+		Result<List<Data>> retVal1 = new Result<List<Data>>(null,0,"test4",new String[0]);
+		Mockito.doReturn(retVal1).when(dao).readByUser(trans, "test4");
+//		Mockito.when(roleDaoObj.get(Mockito.any(), Mockito.any(String.class), Mockito.any())).thenReturn(retVal1);
+		Result<List<Data>> retVal = roleDaoObj.readByUser(trans, "test4");
+		//System.out.println(retVal.status);
+		//retVal.status = 0;
+		assertEquals("25", Integer.toString(retVal.status));
+	}	
+	
+	@Test
+	public void testReadNameUser() {
+		CachedUserRoleDAO roleDaoObj =new CachedUserRoleDAO(dao,info, 10L);
+		Result<List<Data>> retVal1 = new Result<List<Data>>(null,1,"TaggedPrincipalStub",new String[0]);
+		AuthzEnv env = Mockito.mock(AuthzEnv.class);
+		AuthzTransImpl transTemp = new AuthzTransImpl(env) {
+			@Override
+		    public<T> T get(Slot slot, T deflt) {
+				Object o=null;
+				return (T)o;
+			}
+			
+		};
+		transTemp.setUser(new TaggedPrincipalStub());
+		Mockito.doReturn(retVal1).when(info).touch(trans, null,null);
+		Mockito.doReturn(retVal1).when(dao).readByUser(transTemp, "TaggedPrincipalStub");
+		roleDaoObj.invalidate("TaggedPrincipalStub");
+		Result<List<Data>> retVal = roleDaoObj.readByUser(transTemp, "TaggedPrincipalStub");
+//		System.out.println(retVal.status);
+		assertEquals("1", Integer.toString(retVal.status));
+	}
+	
+	@Test
+	public void testReadByRoleSuccess() {
+		CachedUserRoleDAO roleDaoObj =new CachedUserRoleDAO(dao,info, 0);//Mockito.mock(CachedRoleDAO.class);//
+		Result<List<Data>> retVal1 = new Result<List<Data>>(null,1,"test",new String[0]);
+		Mockito.doReturn(retVal1).when(dao).readByRole(trans, "");
+		roleDaoObj.invalidate("");
+		Result<List<Data>> retVal = roleDaoObj.readByRole(trans, "");
+		//System.out.println(retVal.status);
+		assertEquals("1", Integer.toString(retVal.status));
+	}	
+	@Test
+	public void testReadByRoleFailure() {
+		CachedUserRoleDAO roleDaoObj =new CachedUserRoleDAO(dao,info, 0);//Mockito.mock(CachedRoleDAO.class);//
+		Result<List<Data>> retVal1 = new Result<List<Data>>(null,0,"test1",new String[0]);
+		Mockito.doReturn(retVal1).when(dao).readByRole(trans, "");
+		roleDaoObj.invalidate("");
+		Result<List<Data>> retVal = roleDaoObj.readByRole(trans, "");
+		//System.out.println(retVal.status);
+		assertEquals("25", Integer.toString(retVal.status));
+	}
+	
+	@Test
+	public void testReadUserInRole() {
+		CachedUserRoleDAO roleDaoObj =new CachedUserRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
+		Result<List<Data>> retVal1 = new Result<List<Data>>(null,0,"TaggedPrincipalStub",new String[0]);
+		AuthzEnv env = Mockito.mock(AuthzEnv.class);
+		AuthzTransImpl transTemp = new AuthzTransImpl(env) {
+			@Override
+		    public<T> T get(Slot slot, T deflt) {
+				Object o=null;
+				return (T)o;
+			}
+			
+		};
+		transTemp.setUser(new TaggedPrincipalStub());
+		Mockito.doReturn(retVal1).when(info).touch(trans, null,null);
+		Mockito.doReturn(retVal1).when(dao).readByUserRole(transTemp, "","");
+		Mockito.doReturn(retVal1).when(dao).readByUser(transTemp, "TaggedPrincipalStub");
+		Result<List<Data>> retVal = roleDaoObj.readUserInRole(transTemp, "TaggedPrincipalStub","");
+		//System.out.println(retVal.status);
+		assertEquals("25", Integer.toString(retVal.status));
+	}
+	
+
+}
\ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassExecutor.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassExecutor.java
new file mode 100644
index 0000000..5dd33c7
--- /dev/null
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassExecutor.java
@@ -0,0 +1,154 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.auth.dao.hl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.stubbing.Answer;
+import org.onap.aaf.auth.common.Define;
+import org.onap.aaf.auth.dao.cass.NsSplit;
+import org.onap.aaf.auth.dao.cass.UserRoleDAO.Data;
+import org.onap.aaf.auth.env.AuthzTransImpl;
+import org.onap.aaf.auth.layer.Result;
+import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.CadiException;
+
+
+@RunWith(MockitoJUnitRunner.class) 
+public class JU_CassExecutor {
+
+	
+	
+	@Mock
+	AuthzTransImpl trans;
+	
+	@Mock
+	Question q;
+	
+	@Mock
+	Access access;
+	
+	Function f;
+	
+	@Before
+	public void setUp() throws Exception {
+		initMocks(this);
+		try {
+			Mockito.doReturn("0.0").when(access).getProperty("aaf_root_ns","org.osaaf.aaf");
+			Mockito.doReturn(new Properties()).when(access).getProperties();
+			Define.set(access);
+		} catch (CadiException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		f =new Function(trans, q);
+	}
+	
+	@Test
+	public void testHasPermission() {
+		
+		CassExecutor cassExecutorObj =new CassExecutor(trans, f);
+		Mockito.doReturn(false).when(q).isGranted(trans, "","","","","");
+		boolean retVal = cassExecutorObj.hasPermission("", "", "", "", "");
+//		System.out.println(retVal);
+		assertFalse(retVal);
+	}	
+	
+	@Test
+	public void testInRole() {
+		
+		CassExecutor cassExecutorObj =new CassExecutor(trans, f);
+		Result<NsSplit> retVal1 = new Result<NsSplit>(null,1,"",new String[0]);
+		Mockito.doReturn(retVal1).when(q).deriveNsSplit(trans, "test");
+		
+		boolean retVal = cassExecutorObj.inRole("test");
+//		System.out.println(retVal);
+		assertFalse(retVal);
+	}
+	
+	@Test
+	public void testNamespace() {
+		f =new Function(trans, q);
+		CassExecutor cassExecutorObj =new CassExecutor(trans, f);
+		Result<Data> retVal1 = new Result<Data>(null,1,"",new String[0]);
+		Mockito.doReturn(retVal1).when(q).validNSOfDomain(trans, null);
+		
+		String retVal="";
+		try {
+			retVal = cassExecutorObj.namespace();
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			assertEquals("33", e.getMessage());
+		}
+		System.out.println(retVal);
+//		assertFalse(retVal);
+	}
+	
+	@Test
+	public void testId() {
+		Mockito.doReturn("").when(trans).user();
+		CassExecutor cassExecutorObj =new CassExecutor(trans, f);
+		String retVal = cassExecutorObj.id();
+		assertEquals("", retVal);
+	}
+	
+	@Test
+	public void testNamespaceSuccess() {
+		Mockito.doAnswer(new Answer() {
+		    private int count = 0;
+
+		    public Object answer(InvocationOnMock invocation) {
+		        if (count++ == 1)
+		            return "test@test.com";
+
+		        return null;
+		    }
+		}).when(trans).user();
+		f =new Function(trans, q);
+		CassExecutor cassExecutorObj =new CassExecutor(trans, f);
+		Result<Data> retVal1 = new Result<Data>(null,0,"",new String[0]);
+		Mockito.doReturn(retVal1).when(q).validNSOfDomain(trans, null);
+		
+		
+		String retVal="";
+		try {
+			retVal = cassExecutorObj.namespace();
+		} catch (Exception e) {
+			e.printStackTrace();
+			System.out.println(e.getMessage());
+//			assertNull( e.getMessage());
+		}
+//		System.out.println(retVal);
+//		assertFalse(retVal);
+	}
+	
+}
\ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_PermLookup.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_PermLookup.java
new file mode 100644
index 0000000..e63d4b5
--- /dev/null
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_PermLookup.java
@@ -0,0 +1,383 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.auth.dao.hl;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaf.auth.common.Define;
+import org.onap.aaf.auth.dao.cached.CachedRoleDAO;
+import org.onap.aaf.auth.dao.cached.CachedUserRoleDAO;
+import org.onap.aaf.auth.dao.cass.PermDAO.Data;
+import org.onap.aaf.auth.dao.cass.RoleDAO;
+import org.onap.aaf.auth.dao.cass.UserRoleDAO;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.auth.layer.Result;
+import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.misc.env.LogTarget;
+
+
+@RunWith(MockitoJUnitRunner.class) 
+public class JU_PermLookup {
+
+	
+	
+	@Mock
+	AuthzTrans trans;
+	
+	@Mock
+	Question q;
+	
+	@Mock
+	Access access;
+	
+	Function f;
+	
+	@Before
+	public void setUp() throws Exception {
+		initMocks(this);
+		try {
+			Mockito.doReturn("0.0").when(access).getProperty("aaf_root_ns","org.osaaf.aaf");
+			Mockito.doReturn(new Properties()).when(access).getProperties();
+			Define.set(access);
+			
+			when(trans.error()).thenReturn(new LogTarget() {
+	            
+	            @Override
+	            public void printf(String fmt, Object... vars) {}
+	            
+	            @Override
+	            public void log(Throwable e, Object... msgs) {
+	                e.getMessage();
+	                e.printStackTrace();
+	                msgs.toString();
+	                
+	            }
+	            
+	            @Override
+	            public void log(Object... msgs) {
+	            }
+	            
+	            @Override
+	            public boolean isLoggable() {
+	                
+	                return true;
+	            }
+	        });
+		} catch (CadiException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		f =new Function(trans, q);
+	}
+	
+	
+	@Test
+	public void testPerm() {
+		
+		PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
+		
+//		System.out.println(cassExecutorObj);
+//		assertFalse(retVal);
+	}
+	
+	@Test
+	public void testGetUserRole() {
+		q.userRoleDAO = Mockito.mock(CachedUserRoleDAO.class);
+		Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
+		retVal1.value = new ArrayList<UserRoleDAO.Data>();
+		UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
+		
+		dataObj.expires = new Date();
+		
+		retVal1.value.add(dataObj);
+		Mockito.doReturn(true).when(retVal1).isOKhasData();
+		Mockito.doReturn(retVal1).when(q.userRoleDAO).readByUser(trans,"");
+		PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
+		Result<List<UserRoleDAO.Data>> userRoles = cassExecutorObj.getUserRoles();
+		
+		//System.out.println(""+userRoles.status);
+		assertEquals(24,userRoles.status);
+	}
+	
+	@Test
+	public void testGetUserRolesFirstIf() {
+		q.userRoleDAO = Mockito.mock(CachedUserRoleDAO.class);
+		Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
+		retVal1.value = new ArrayList<UserRoleDAO.Data>();
+				
+		Mockito.doReturn(false).when(retVal1).isOKhasData();
+		Mockito.doReturn(retVal1).when(q.userRoleDAO).readByUser(trans,"");
+		PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
+		Result<List<UserRoleDAO.Data>> userRoles = cassExecutorObj.getUserRoles();
+		
+//		System.out.println("output is"+userRoles.status);
+		assertEquals(0,userRoles.status);
+	}
+	
+	@Test
+	public void testGetUserRolesSecondIf() {
+		q.userRoleDAO = Mockito.mock(CachedUserRoleDAO.class);
+		Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
+		retVal1.value = new ArrayList<UserRoleDAO.Data>();
+		UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
+		
+		Date dt = new Date();
+		Calendar c = Calendar.getInstance(); 
+		c.setTime(dt); 
+		c.add(Calendar.DATE, 1);
+		dataObj.expires = c.getTime();
+		
+		retVal1.value.add(dataObj);
+		Mockito.doReturn(true).when(retVal1).isOKhasData();
+		Mockito.doReturn(retVal1).when(q.userRoleDAO).readByUser(trans,"");
+		PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
+		Result<List<UserRoleDAO.Data>> userRoles = cassExecutorObj.getUserRoles();
+		
+		//System.out.println(userRoles.status);
+		assertEquals("Success",userRoles.details);
+		Result<List<UserRoleDAO.Data>> userRoles1 = cassExecutorObj.getUserRoles();
+
+		//System.out.println(userRoles1.status);
+		assertEquals(0, userRoles1.status);
+	}
+	
+	@Test
+	public void testGetRole() {
+		q.userRoleDAO = Mockito.mock(CachedUserRoleDAO.class);
+		Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
+		retVal1.value = new ArrayList<UserRoleDAO.Data>();
+		UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
+		
+		dataObj.expires = new Date();
+		
+		retVal1.value.add(dataObj);
+		Mockito.doReturn(false).when(retVal1).isOKhasData();
+		Mockito.doReturn(true).when(retVal1).isOK();
+		Mockito.doReturn(retVal1).when(q.userRoleDAO).readByUser(trans,"");
+		PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
+		Result<List<RoleDAO.Data>> userRoles = cassExecutorObj.getRoles();
+		
+		//System.out.println(""+userRoles.status);
+		assertEquals(4,userRoles.status);
+	}
+	
+	@Test
+	public void testGetRoleFirstIf() {
+		q.userRoleDAO = Mockito.mock(CachedUserRoleDAO.class);
+		q.roleDAO = Mockito.mock(CachedRoleDAO.class);
+		Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
+		retVal1.value = new ArrayList<UserRoleDAO.Data>();
+		UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
+		
+		dataObj.expires = new Date();
+		dataObj.ns="";
+		dataObj.rname="";
+		
+		retVal1.value.add(dataObj);
+		Mockito.doReturn(false).when(retVal1).isOKhasData();
+		Mockito.doReturn(false).when(retVal1).isOK();
+		Mockito.doReturn(retVal1).when(q.userRoleDAO).readByUser(trans,"");
+		Mockito.doReturn(retVal1).when(q.roleDAO).read(trans,"","");
+		PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
+		Result<List<RoleDAO.Data>> userRoles = cassExecutorObj.getRoles();
+		
+//		System.out.println(""+userRoles.status);
+		assertEquals(0,userRoles.status);
+	}
+	
+	@Test
+	public void testGetRoleSecondIf() {
+		q.userRoleDAO = Mockito.mock(CachedUserRoleDAO.class);
+		q.roleDAO = Mockito.mock(CachedRoleDAO.class);
+		Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
+		retVal1.value = new ArrayList<UserRoleDAO.Data>();
+		UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
+		
+		dataObj.expires = new Date();
+		dataObj.ns="";
+		dataObj.rname="";
+		
+		retVal1.value.add(dataObj);
+		Mockito.doReturn(false).when(retVal1).isOKhasData();
+		Mockito.doReturn(true).when(retVal1).isOK();
+		Mockito.doReturn(retVal1).when(q.userRoleDAO).readByUser(trans,"");
+		Mockito.doReturn(retVal1).when(q.roleDAO).read(trans,"","");
+		PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
+		Result<List<RoleDAO.Data>> userRoles = cassExecutorObj.getRoles();
+		userRoles = cassExecutorObj.getRoles();
+		
+//		System.out.println(""+userRoles.status);
+		assertEquals(0,userRoles.status);
+	}
+	@Test
+	public void testGetPerms() {
+		q.userRoleDAO = Mockito.mock(CachedUserRoleDAO.class);
+		Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
+		retVal1.value = new ArrayList<UserRoleDAO.Data>();
+		Mockito.doReturn(false).when(retVal1).isOKhasData();
+		Mockito.doReturn(true).when(retVal1).isOK();
+		Mockito.doReturn(retVal1).when(q.userRoleDAO).readByUser(trans,"");
+		PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
+		Result<Set<String>> userRoles = cassExecutorObj.getPermNames();
+		userRoles = cassExecutorObj.getPermNames();
+		
+		//System.out.println(""+userRoles.status);
+		assertEquals(0,userRoles.status);
+	}
+	@Test
+	public void testGetPermsRrldOk() {
+		q.userRoleDAO = Mockito.mock(CachedUserRoleDAO.class);
+		Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
+		retVal1.value = new ArrayList<UserRoleDAO.Data>();
+		UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
+		
+		dataObj.expires = new Date();
+		
+		retVal1.value.add(dataObj);
+		Mockito.doReturn(false).when(retVal1).isOKhasData();
+		Mockito.doReturn(true).when(retVal1).isOK();
+		Mockito.doReturn(retVal1).when(q.userRoleDAO).readByUser(trans,"");
+		PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
+		Result<Set<String>> userRoles = cassExecutorObj.getPermNames();
+		
+		//System.out.println(""+userRoles.status);
+		assertEquals(4,userRoles.status);
+	}	
+
+
+	@Test
+	public void testGetPerm() {
+		q.userRoleDAO = Mockito.mock(CachedUserRoleDAO.class);
+		q.roleDAO = Mockito.mock(CachedRoleDAO.class);
+		Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
+		Result<List<RoleDAO.Data>> retVal2 = Mockito.mock(Result.class);
+		
+		retVal1.value = new ArrayList<UserRoleDAO.Data>();
+		retVal2.value = new ArrayList<RoleDAO.Data>();
+		UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
+		
+		Date dt = new Date();
+		Calendar c = Calendar.getInstance(); 
+		c.setTime(dt); 
+		c.add(Calendar.DATE, 1);
+		dataObj.expires = c.getTime();
+		dataObj.ns = "";
+		dataObj.rname="";
+		
+		RoleDAO.Data dataObj1 = Mockito.mock( RoleDAO.Data.class);
+		Set<String> permSet = new HashSet<String>();
+		permSet.add("test");
+		Mockito.doReturn(permSet).when(dataObj1).perms(false);
+		
+		dt = new Date();
+		c = Calendar.getInstance(); 
+		c.setTime(dt); 
+		c.add(Calendar.DATE, 1);
+		dataObj1.ns = "test";
+		dataObj1.perms = permSet;
+		
+		retVal1.value.add(dataObj);
+		retVal2.value.add(dataObj1);
+		Mockito.doReturn(true).when(retVal1).isOKhasData();
+		Mockito.doReturn(true).when(retVal1).isOK();
+		Mockito.doReturn(true).when(retVal2).isOK();
+		Mockito.doReturn(retVal1).when(q.userRoleDAO).readByUser(trans,"");
+		Mockito.doReturn(retVal2).when(q.roleDAO).read(trans,"","");
+
+		
+		PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
+//		
+//		Mockito.doReturn(retVal2).when(cassExecutorObj).getPermNames();
+		Result<List<Data>> userRoles = cassExecutorObj.getPerms(true);
+//		userRoles = cassExecutorObj.getPerms(false);
+		
+//		System.out.println(""+userRoles.status);
+		assertEquals(0,userRoles.status);
+	}
+	
+	@Test
+	public void testGetPermFalse() {
+		q.userRoleDAO = Mockito.mock(CachedUserRoleDAO.class);
+		q.roleDAO = Mockito.mock(CachedRoleDAO.class);
+		Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
+		Result<List<RoleDAO.Data>> retVal2 = Mockito.mock(Result.class);
+		
+		retVal1.value = new ArrayList<UserRoleDAO.Data>();
+		retVal2.value = new ArrayList<RoleDAO.Data>();
+		UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
+		
+		Date dt = new Date();
+		Calendar c = Calendar.getInstance(); 
+		c.setTime(dt); 
+		c.add(Calendar.DATE, 1);
+		dataObj.expires = c.getTime();
+		dataObj.ns = "";
+		dataObj.rname="";
+		
+		RoleDAO.Data dataObj1 = Mockito.mock( RoleDAO.Data.class);
+		Set<String> permSet = new HashSet<String>();
+		permSet.add("test");
+		Mockito.doReturn(permSet).when(dataObj1).perms(false);
+		
+		dt = new Date();
+		c = Calendar.getInstance(); 
+		c.setTime(dt); 
+		c.add(Calendar.DATE, 1);
+		dataObj1.ns = "test";
+		dataObj1.perms = permSet;
+		
+		retVal1.value.add(dataObj);
+		retVal2.value.add(dataObj1);
+		Mockito.doReturn(true).when(retVal1).isOKhasData();
+		Mockito.doReturn(true).when(retVal1).isOK();
+		Mockito.doReturn(true).when(retVal2).isOK();
+		Mockito.doReturn(retVal1).when(q.userRoleDAO).readByUser(trans,"");
+		Mockito.doReturn(retVal2).when(q.roleDAO).read(trans,"","");
+
+		
+		PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
+//		
+//		Mockito.doReturn(retVal2).when(cassExecutorObj).getPermNames();
+		Result<List<Data>> userRoles = cassExecutorObj.getPerms(false);
+		userRoles = cassExecutorObj.getPerms(false);
+		
+//		System.out.println(""+userRoles.status);
+		assertEquals(0,userRoles.status);
+	}
+	
+}
\ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedPermDAOTest.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedPermDAOTest.java
deleted file mode 100644
index 972e366..0000000
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedPermDAOTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * ============LICENSE_START====================================================
- * org.onap.aaf
- * ===========================================================================
- * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
- * ===========================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END====================================================
- *
- */
-package org.onap.aaf.auth.dao.cached;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.onap.aaf.auth.dao.CIDAO;
-import org.onap.aaf.auth.dao.cass.PermDAO;
-import org.onap.aaf.auth.dao.cass.PermDAO.Data;
-import org.onap.aaf.auth.dao.cass.Status;
-import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.layer.Result;
-
-public class JU_CachedPermDAOTest {
-
-	@Mock
-	private CIDAO<AuthzTrans> info;
-	@Mock
-	private PermDAO dao;
-	private AuthzTrans trans;
-	@Mock
-	private Result<List<PermDAO.Data>> value;
-
-	@Before
-	public void setUp() throws Exception {
-		initMocks(this);
-
-		when(dao.readNS(trans, "ns")).thenReturn(value);
-	}
-
-	@Test
-	public void testReadNS() {
-		when(value.isOKhasData()).thenReturn(true);
-		when(value.isOK()).thenReturn(false);
-		CachedPermDAO ccDao = new CachedPermDAO(dao, info, 100l);
-
-		Result<List<Data>> result = ccDao.readNS(trans, "ns");
-
-		assertEquals(result, value);
-
-		when(value.isOKhasData()).thenReturn(false);
-
-		result = ccDao.readNS(trans, "ns");
-
-		assertEquals(result.status, Status.ERR_PermissionNotFound);
-
-		ccDao.readChildren(trans, "ns", "type");
-
-		verify(dao).readChildren(trans, "ns", "type");
-	}
-
-}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLocator.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLocator.java
new file mode 100644
index 0000000..cf85058
--- /dev/null
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLocator.java
@@ -0,0 +1,152 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.auth.direct.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaf.auth.dao.cass.LocateDAO;
+import org.onap.aaf.auth.dao.cass.LocateDAO.Data;
+import org.onap.aaf.auth.direct.DirectAAFLocator;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.auth.layer.Result;
+import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.config.Config;
+
+
+@RunWith(MockitoJUnitRunner.class) 
+public class JU_DirectAAFLocator {
+
+	@Mock
+	LocateDAO ldao;
+	
+	@Mock
+	AuthzEnv env;
+	
+	@Mock
+	AuthzTrans trans;
+	
+	@Mock
+	Access access;
+	
+	@Before
+	public void setUp() throws Exception {
+		initMocks(this);
+	}
+	
+	@Test
+	public void testConstructorExcpetion() {
+
+		PropAccess access = Mockito.mock(PropAccess.class);
+		Mockito.doReturn(access).when(env).access();
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LATITUDE,null);
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LONGITUDE,null);
+		try {
+			DirectAAFLocator aafLocatorObj=new DirectAAFLocator(env, ldao,"test","test");
+		} catch (LocatorException e) {
+//			System.out.println(e.getMessage());
+			assertEquals("Invalid Version String: test", e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testConstructorUriExcpetion() {
+
+		PropAccess access = Mockito.mock(PropAccess.class);
+		Mockito.doReturn(access).when(env).access();
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LATITUDE,null);
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LONGITUDE,null);
+		try {
+			DirectAAFLocator aafLocatorObj=new DirectAAFLocator(env, ldao," test","3.2");
+		} catch (LocatorException e) {
+//			System.out.println(e.getMessage());
+			assertTrue(e.getMessage().contains("Illegal character in path at index"));
+		}
+	}
+	@Test
+	public void testRefresh() {
+		
+		DirectAAFLocator aafLocatorObj=null;
+		PropAccess access = Mockito.mock(PropAccess.class);
+		Mockito.doReturn(access).when(env).access();
+		Mockito.doReturn(trans).when(env).newTransNoAvg();
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LATITUDE,null);
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LONGITUDE,null);
+		try {
+			aafLocatorObj = new DirectAAFLocator(env, ldao,"test","30.20.30.30");
+		} catch (LocatorException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		Result<List<Data>> retVal1 = new Result<List<Data>>(null,0,"",new String[0]);
+		
+		Data data= new Data();
+		data.major=30;
+		data.minor=30;
+		data.patch=30;
+		data.pkg=30;
+		retVal1.value = new ArrayList<Data>();
+		retVal1.value.add(data);
+		
+		Mockito.doReturn(retVal1).when(ldao).readByName(trans,"test");
+		boolean retVal = aafLocatorObj.refresh();
+//		System.out.println(retVal);
+		assertTrue(retVal);
+	}	
+	
+	@Test
+	public void testRefreshNOK() {
+		
+		DirectAAFLocator aafLocatorObj=null;
+		PropAccess access = Mockito.mock(PropAccess.class);
+		Mockito.doReturn(access).when(env).access();
+		Mockito.doReturn(trans).when(env).newTransNoAvg();
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LATITUDE,null);
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LONGITUDE,null);
+		try {
+			aafLocatorObj = new DirectAAFLocator(env, ldao,"test","30.20.30.30");
+		} catch (LocatorException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		Result<List<Data>> retVal1 = new Result<List<Data>>(null,1,"",new String[0]);
+		
+		Mockito.doReturn(retVal1).when(ldao).readByName(trans,"test");
+		boolean retVal = aafLocatorObj.refresh();
+//		System.out.println(retVal);
+		assertFalse(retVal);
+	}	
+	
+}
\ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java
new file mode 100644
index 0000000..ca0a891
--- /dev/null
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java
@@ -0,0 +1,223 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.auth.direct.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.util.Date;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaf.auth.dao.DAOException;
+import org.onap.aaf.auth.dao.hl.Question;
+import org.onap.aaf.auth.direct.DirectAAFUserPass;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.auth.layer.Result;
+import org.onap.aaf.misc.env.LogTarget;
+
+
+@RunWith(MockitoJUnitRunner.class) 
+public class JU_DirectAAFUserPass {
+
+	@Mock
+	Question question;
+	
+	@Mock
+	AuthzEnv env;
+	
+	@Mock
+	AuthzTrans trans;
+	
+	@Mock
+	HttpServletRequest request;
+	
+	
+	@Before
+	public void setUp() throws Exception {
+		initMocks(this);
+		when(env.warn()).thenReturn(new LogTarget() {
+            
+            @Override
+            public void printf(String fmt, Object... vars) {}
+            
+            @Override
+            public void log(Throwable e, Object... msgs) {
+                e.getMessage();
+                e.printStackTrace();
+                msgs.toString();
+                
+            }
+            
+            @Override
+            public void log(Object... msgs) {
+            }
+            
+            @Override
+            public boolean isLoggable() {
+                
+                return true;
+            }
+        });
+		when(env.error()).thenReturn(new LogTarget() {
+            
+            @Override
+            public void printf(String fmt, Object... vars) {}
+            
+            @Override
+            public void log(Throwable e, Object... msgs) {
+                e.getMessage();
+                e.printStackTrace();
+                msgs.toString();
+                
+            }
+            
+            @Override
+            public void log(Object... msgs) {
+            }
+            
+            @Override
+            public boolean isLoggable() {
+                
+                return true;
+            }
+        });
+	}
+	
+	@Test
+	public void testUserPass() {
+		
+		DirectAAFUserPass aafLocatorObj=null;
+		aafLocatorObj = new DirectAAFUserPass(env, question);
+		Result<Date> retVal1 = new Result<Date>(null,0,"",new String[0]);
+		Mockito.doReturn(trans).when(env).newTransNoAvg();
+		try {
+			Mockito.doReturn(retVal1).when(question).doesUserCredMatch(trans, null, null);
+		} catch (DAOException e) {
+			e.printStackTrace();
+		}
+		boolean retVal = aafLocatorObj.validate(null, null, null, null);
+		
+		assertTrue(retVal);
+	}	
+	
+	@Test
+	public void testUserPassStateisRequest() {
+		
+		DirectAAFUserPass aafLocatorObj=null;
+		aafLocatorObj = new DirectAAFUserPass(env, question);
+		Result<Date> retVal1 = new Result<Date>(null,1,"",new String[0]);
+		Mockito.doReturn(trans).when(env).newTransNoAvg();
+		try {
+			Mockito.doReturn(retVal1).when(question).doesUserCredMatch(trans, null, null);
+		} catch (DAOException e) {
+			e.printStackTrace();
+		}
+		boolean retVal = aafLocatorObj.validate(null, null, null, request);
+		
+//		System.out.println(retVal);
+		assertFalse(retVal);
+	}
+	
+	@Test
+	public void testUserPassStateNotNull() {
+		
+		DirectAAFUserPass aafLocatorObj=null;
+		aafLocatorObj = new DirectAAFUserPass(env, question);
+		Result<Date> retVal1 = new Result<Date>(null,1,"",new String[0]);
+		Mockito.doReturn(trans).when(env).newTransNoAvg();
+		try {
+			Mockito.doReturn(retVal1).when(question).doesUserCredMatch(trans, null, null);
+		} catch (DAOException e) {
+			e.printStackTrace();
+		}
+		boolean retVal = aafLocatorObj.validate(null, null, null, "test");
+		
+//		System.out.println(retVal);
+		assertFalse(retVal);
+	}
+	
+	@Test
+	public void testUserPassTransChk() {
+		
+		DirectAAFUserPass aafLocatorObj=null;
+		aafLocatorObj = new DirectAAFUserPass(env, question);
+		Result<Date> retVal1 = new Result<Date>(null,1,"",new String[0]);
+		Mockito.doReturn(trans).when(env).newTransNoAvg();
+		try {
+			Mockito.doReturn(retVal1).when(question).doesUserCredMatch(trans, null, null);
+		} catch (DAOException e) {
+			e.printStackTrace();
+		}
+		boolean retVal = aafLocatorObj.validate(null, null, null, trans);
+		
+//		System.out.println(retVal);
+		assertFalse(retVal);
+	}
+	
+	@Test
+	public void testUserPassTransIpNotNull() {
+		
+		DirectAAFUserPass aafLocatorObj=null;
+		aafLocatorObj = new DirectAAFUserPass(env, question);
+		Result<Date> retVal1 = new Result<Date>(null,1,"",new String[0]);
+		Mockito.doReturn("test").when(trans).ip();
+		Mockito.doReturn(trans).when(env).newTransNoAvg();
+		try {
+			Mockito.doReturn(retVal1).when(question).doesUserCredMatch(trans, null, null);
+		} catch (DAOException e) {
+			e.printStackTrace();
+		}
+		boolean retVal = aafLocatorObj.validate(null, null, null, trans);
+		
+//		System.out.println(retVal);
+		assertFalse(retVal);
+	}
+	
+	@Test
+	public void testUserExceptionChk() {
+		
+		DirectAAFUserPass aafLocatorObj=null;
+		aafLocatorObj = new DirectAAFUserPass(env, question);
+		Result<Date> retVal1 = new Result<Date>(null,1,"",new String[0]);
+		Mockito.doReturn(trans).when(env).newTransNoAvg();
+		try {
+			Mockito.doThrow(DAOException.class).when(question).doesUserCredMatch(trans, null, null);
+		} catch (DAOException e) {
+			// TODO Auto-generated catch block
+//			e.printStackTrace();
+		}
+		boolean retVal = aafLocatorObj.validate(null, null, null, trans);
+		
+//		System.out.println(retVal);
+		assertFalse(retVal);
+	}
+	
+}
\ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectLocatorCreateor.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectLocatorCreateor.java
new file mode 100644
index 0000000..d026500
--- /dev/null
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectLocatorCreateor.java
@@ -0,0 +1,86 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.auth.direct.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaf.auth.dao.cass.LocateDAO;
+import org.onap.aaf.auth.direct.DirectLocatorCreator;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.config.Config;
+
+
+@RunWith(MockitoJUnitRunner.class) 
+public class JU_DirectLocatorCreateor {
+
+	@Mock
+	LocateDAO ldao;
+	
+	@Mock
+	AuthzEnv env;
+	
+	@Before
+	public void setUp() throws Exception {
+		initMocks(this);
+	}
+	
+	@Test
+	public void testCreate() {
+		PropAccess access = Mockito.mock(PropAccess.class);
+		Mockito.doReturn(access).when(env).access();
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LATITUDE,null);
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LONGITUDE,null);
+		DirectLocatorCreator aafLocatorObj=new DirectLocatorCreator(env, ldao);
+		try {
+			aafLocatorObj.setSelf("test", 9080);
+			aafLocatorObj.create("test","30.20.30.30");
+		} catch (LocatorException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+	@Test
+	public void testCreateHostnameNull() {
+		PropAccess access = Mockito.mock(PropAccess.class);
+		Mockito.doReturn(access).when(env).access();
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LATITUDE,null);
+		Mockito.doReturn("20").when(access).getProperty(Config.CADI_LONGITUDE,null);
+		DirectLocatorCreator aafLocatorObj=new DirectLocatorCreator(env, ldao);
+		try {
+			aafLocatorObj.create("test","30.20.30.30");
+		} catch (LocatorException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+	
+}
\ No newline at end of file
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
index a3abb2b..3e68e3a 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
@@ -48,7 +48,7 @@
                             ERR_Backend                    = 9,
                             ERR_General                    = 20;
                             
-    public final RV value;
+    public RV value;
     public final int status;
     public final String details;
     public final String[] variables;
@@ -275,6 +275,8 @@
      * @return
      */
     public boolean isOKhasData() {
+    	System.out.println("specialCondition:"+specialCondition);
+    	System.out.println("specialCondition:"+(specialCondition & EMPTY_LIST));
         return status == OK && (specialCondition & EMPTY_LIST) != EMPTY_LIST;
     }
 
diff --git a/cadi/core/src/test/resources/keystore.p12 b/cadi/core/src/test/resources/keystore.p12
new file mode 100644
index 0000000..51273d5
--- /dev/null
+++ b/cadi/core/src/test/resources/keystore.p12
Binary files differ
diff --git a/cadi/core/src/test/resources/output_key b/cadi/core/src/test/resources/output_key
new file mode 100644
index 0000000..9d94dcb
--- /dev/null
+++ b/cadi/core/src/test/resources/output_key
@@ -0,0 +1 @@
+QRSTUVWXYZabcdef
\ No newline at end of file
diff --git a/cadi/core/src/test/resources/truststore.jks b/cadi/core/src/test/resources/truststore.jks
new file mode 100644
index 0000000..9ee3dcf
--- /dev/null
+++ b/cadi/core/src/test/resources/truststore.jks
Binary files differ
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/Api.java b/misc/env/src/test/java/org/onap/aaf/misc/env/Api.java
new file mode 100644
index 0000000..688e11b
--- /dev/null
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/Api.java
@@ -0,0 +1,373 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2018.12.09 at 10:14:23 PM IST 
+//
+
+
+package org.onap.aaf.misc.env;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="route" maxOccurs="unbounded" minOccurs="0">
+ *           &lt;complexType>
+ *             &lt;complexContent>
+ *               &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 &lt;sequence>
+ *                   &lt;element name="meth" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *                   &lt;element name="path" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *                   &lt;element name="param" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *                   &lt;element name="desc" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *                   &lt;element name="comments" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *                   &lt;element name="contentType" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *                   &lt;element name="expected" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *                   &lt;element name="explicitErr" type="{http://www.w3.org/2001/XMLSchema}int" maxOccurs="unbounded" minOccurs="0"/>
+ *                 &lt;/sequence>
+ *               &lt;/restriction>
+ *             &lt;/complexContent>
+ *           &lt;/complexType>
+ *         &lt;/element>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "route"
+})
+@XmlRootElement(name = "api")
+public class Api {
+
+    protected List<Api.Route> route;
+
+    /**
+     * Gets the value of the route property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the route property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getRoute().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Api.Route }
+     * 
+     * 
+     */
+    public List<Api.Route> getRoute() {
+        if (route == null) {
+            route = new ArrayList<Api.Route>();
+        }
+        return this.route;
+    }
+
+
+    /**
+     * <p>Java class for anonymous complex type.
+     * 
+     * <p>The following schema fragment specifies the expected content contained within this class.
+     * 
+     * <pre>
+     * &lt;complexType>
+     *   &lt;complexContent>
+     *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       &lt;sequence>
+     *         &lt;element name="meth" type="{http://www.w3.org/2001/XMLSchema}string"/>
+     *         &lt;element name="path" type="{http://www.w3.org/2001/XMLSchema}string"/>
+     *         &lt;element name="param" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+     *         &lt;element name="desc" type="{http://www.w3.org/2001/XMLSchema}string"/>
+     *         &lt;element name="comments" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+     *         &lt;element name="contentType" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+     *         &lt;element name="expected" type="{http://www.w3.org/2001/XMLSchema}int"/>
+     *         &lt;element name="explicitErr" type="{http://www.w3.org/2001/XMLSchema}int" maxOccurs="unbounded" minOccurs="0"/>
+     *       &lt;/sequence>
+     *     &lt;/restriction>
+     *   &lt;/complexContent>
+     * &lt;/complexType>
+     * </pre>
+     * 
+     * 
+     */
+    @XmlAccessorType(XmlAccessType.FIELD)
+    @XmlType(name = "", propOrder = {
+        "meth",
+        "path",
+        "param",
+        "desc",
+        "comments",
+        "contentType",
+        "expected",
+        "explicitErr"
+    })
+    public static class Route {
+
+        @XmlElement(required = true)
+        protected String meth;
+        @XmlElement(required = true)
+        protected String path;
+        protected List<String> param;
+        @XmlElement(required = true)
+        protected String desc;
+        protected List<String> comments;
+        protected List<String> contentType;
+        protected int expected;
+        @XmlElement(type = Integer.class)
+        protected List<Integer> explicitErr;
+
+        /**
+         * Gets the value of the meth property.
+         * 
+         * @return
+         *     possible object is
+         *     {@link String }
+         *     
+         */
+        public String getMeth() {
+            return meth;
+        }
+
+        /**
+         * Sets the value of the meth property.
+         * 
+         * @param value
+         *     allowed object is
+         *     {@link String }
+         *     
+         */
+        public void setMeth(String value) {
+            this.meth = value;
+        }
+
+        /**
+         * Gets the value of the path property.
+         * 
+         * @return
+         *     possible object is
+         *     {@link String }
+         *     
+         */
+        public String getPath() {
+            return path;
+        }
+
+        /**
+         * Sets the value of the path property.
+         * 
+         * @param value
+         *     allowed object is
+         *     {@link String }
+         *     
+         */
+        public void setPath(String value) {
+            this.path = value;
+        }
+
+        /**
+         * Gets the value of the param property.
+         * 
+         * <p>
+         * This accessor method returns a reference to the live list,
+         * not a snapshot. Therefore any modification you make to the
+         * returned list will be present inside the JAXB object.
+         * This is why there is not a <CODE>set</CODE> method for the param property.
+         * 
+         * <p>
+         * For example, to add a new item, do as follows:
+         * <pre>
+         *    getParam().add(newItem);
+         * </pre>
+         * 
+         * 
+         * <p>
+         * Objects of the following type(s) are allowed in the list
+         * {@link String }
+         * 
+         * 
+         */
+        public List<String> getParam() {
+            if (param == null) {
+                param = new ArrayList<String>();
+            }
+            return this.param;
+        }
+
+        /**
+         * Gets the value of the desc property.
+         * 
+         * @return
+         *     possible object is
+         *     {@link String }
+         *     
+         */
+        public String getDesc() {
+            return desc;
+        }
+
+        /**
+         * Sets the value of the desc property.
+         * 
+         * @param value
+         *     allowed object is
+         *     {@link String }
+         *     
+         */
+        public void setDesc(String value) {
+            this.desc = value;
+        }
+
+        /**
+         * Gets the value of the comments property.
+         * 
+         * <p>
+         * This accessor method returns a reference to the live list,
+         * not a snapshot. Therefore any modification you make to the
+         * returned list will be present inside the JAXB object.
+         * This is why there is not a <CODE>set</CODE> method for the comments property.
+         * 
+         * <p>
+         * For example, to add a new item, do as follows:
+         * <pre>
+         *    getComments().add(newItem);
+         * </pre>
+         * 
+         * 
+         * <p>
+         * Objects of the following type(s) are allowed in the list
+         * {@link String }
+         * 
+         * 
+         */
+        public List<String> getComments() {
+            if (comments == null) {
+                comments = new ArrayList<String>();
+            }
+            return this.comments;
+        }
+
+        /**
+         * Gets the value of the contentType property.
+         * 
+         * <p>
+         * This accessor method returns a reference to the live list,
+         * not a snapshot. Therefore any modification you make to the
+         * returned list will be present inside the JAXB object.
+         * This is why there is not a <CODE>set</CODE> method for the contentType property.
+         * 
+         * <p>
+         * For example, to add a new item, do as follows:
+         * <pre>
+         *    getContentType().add(newItem);
+         * </pre>
+         * 
+         * 
+         * <p>
+         * Objects of the following type(s) are allowed in the list
+         * {@link String }
+         * 
+         * 
+         */
+        public List<String> getContentType() {
+            if (contentType == null) {
+                contentType = new ArrayList<String>();
+            }
+            return this.contentType;
+        }
+
+        /**
+         * Gets the value of the expected property.
+         * 
+         */
+        public int getExpected() {
+            return expected;
+        }
+
+        /**
+         * Sets the value of the expected property.
+         * 
+         */
+        public void setExpected(int value) {
+            this.expected = value;
+        }
+
+        /**
+         * Gets the value of the explicitErr property.
+         * 
+         * <p>
+         * This accessor method returns a reference to the live list,
+         * not a snapshot. Therefore any modification you make to the
+         * returned list will be present inside the JAXB object.
+         * This is why there is not a <CODE>set</CODE> method for the explicitErr property.
+         * 
+         * <p>
+         * For example, to add a new item, do as follows:
+         * <pre>
+         *    getExplicitErr().add(newItem);
+         * </pre>
+         * 
+         * 
+         * <p>
+         * Objects of the following type(s) are allowed in the list
+         * {@link Integer }
+         * 
+         * 
+         */
+        public List<Integer> getExplicitErr() {
+            if (explicitErr == null) {
+                explicitErr = new ArrayList<Integer>();
+            }
+            return this.explicitErr;
+        }
+
+    }
+
+}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java
new file mode 100644
index 0000000..0c21bda
--- /dev/null
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java
@@ -0,0 +1,82 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.misc.env;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.aaf.misc.env.impl.EnvFactory;
+
+public class JU_BaseDataFactory {
+
+	@Before
+	public void setUp() throws Exception {
+		initMocks(this);
+	}
+	
+	@Test
+	public void testGenSchemaException() {
+		Store env = Mockito.mock(Store.class);
+		Mockito.doReturn("testdir").when(env).get(null, EnvFactory.DEFAULT_SCHEMA_DIR);
+		try {
+			BaseDataFactory.genSchema(env, new String[] {});
+		} catch (APIException e) {
+			assertTrue(e.getLocalizedMessage().contains("does not exist.  You can set this with"));
+		}
+	}
+	
+	@Test
+	public void testGenSchemaXsdException() {
+		Store env = Mockito.mock(Store.class);
+		Mockito.doReturn(System.getProperty("user.dir")).when(env).get(null, EnvFactory.DEFAULT_SCHEMA_DIR);
+		String[] schemaFIles = new String[] {"../auth-client/src/main/xsd/aaf_2_0.xsd"};
+		try {
+			BaseDataFactory.genSchema(env, schemaFIles);
+		} catch (APIException e) {
+			assertTrue(e.getLocalizedMessage().contains("for schema validation"));
+		}
+	}
+	
+	@Test
+	public void testGenSchemaNoException() {
+		Store env = Mockito.mock(Store.class);
+		Mockito.doReturn(System.getProperty("user.dir")).when(env).get(null, EnvFactory.DEFAULT_SCHEMA_DIR);
+		String[] schemaFIles = new String[] {"../../auth-client/src/main/xsd/aaf_2_0.xsd"};
+		try {
+			BaseDataFactory.genSchema(env, schemaFIles);
+		} catch (APIException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	@Test
+	public void testGetQName() {
+		String[] schemaFIles = new String[] {"../../auth-client/src/main/xsd/aaf_2_0.xsd"};
+		try {
+			BaseDataFactory.getQName(Api.class);
+		} catch (APIException e) {
+			assertTrue(e.getLocalizedMessage().contains("package-info does not have an XmlSchema annotation"));
+		}
+	}
+}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java
new file mode 100644
index 0000000..2617559
--- /dev/null
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java
@@ -0,0 +1,85 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.misc.env.impl;
+
+import static org.junit.Assert.assertFalse;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+
+public class JU_JavaUtilLogTarget {
+
+    @Mock
+    Level level;
+
+    @Mock
+    Logger log;
+
+    @Before
+    public void setup() {
+    	initMocks(this);
+    }
+
+    @Test
+    public void testLoggable() {
+    	JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level);
+    	boolean retVal = logObj.isLoggable();
+    	
+        assertFalse(retVal);
+    }
+
+    @Test
+    public void testLog() {
+    	JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level);
+    	Mockito.doReturn(false).when(log).isLoggable(level);
+    	logObj.log(new Object[] {"test","test2",""});
+    	Mockito.doReturn(true).when(log).isLoggable(level);
+    	logObj.log(new Object[] {"test","test2",""});
+    	
+    }
+    
+    @Test
+    public void testLogThrowable() {
+    	JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level);
+    	
+    	Mockito.doReturn(true).when(log).isLoggable(level);
+    	logObj.log(new Throwable("test exception"), new Object[] {"test","test2",""});
+    	logObj.log(new Throwable(), new Object[] {"test","test2",""});
+    }
+    
+    @Test
+    public void testPrintf() {
+    	JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level);
+    	
+    	Mockito.doReturn(true).when(log).isLoggable(level);
+    	logObj.printf("test", new Object[] {"test","test2",""});
+
+    	Mockito.doReturn(false).when(log).isLoggable(level);
+    	logObj.printf("test", new Object[] {"test","test2",""});
+    }
+}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java
new file mode 100644
index 0000000..e685dfe
--- /dev/null
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java
@@ -0,0 +1,43 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.misc.env.impl;
+
+import org.junit.Test;
+import org.onap.aaf.misc.env.APIException;
+
+public class JU_NullLifeCycle {
+
+    @Test
+    public void testServicePrestart() {
+    	NullLifeCycle lifeCycleObj = new NullLifeCycle();
+    	try {
+    		lifeCycleObj.servicePrestart(null);
+    		lifeCycleObj.serviceDestroy(null);
+    		lifeCycleObj.threadDestroy(null);
+    		lifeCycleObj.threadPrestart(null);
+    		lifeCycleObj.refresh(null);
+    	}catch(APIException a) {
+    		
+    	}
+    }
+   
+}
\ No newline at end of file
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java
index 9feaf3e..2067e2a 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java
@@ -21,42 +21,88 @@
 
 package org.onap.aaf.misc.env.impl;
 
-import static org.junit.Assert.assertFalse;
-import static org.powermock.api.mockito.PowerMockito.when;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.MockitoAnnotations.initMocks;
 
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.Mockito;
 import org.onap.aaf.misc.env.APIException;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ Log4JLogTarget.class, Logger.class })
 public class JU_Log4JLogTargetTest {
 
+	@Mock
+	Level level;
+	 
     @Mock
     Logger log;
 
     @Before
     public void setup() {
-        MockitoAnnotations.initMocks(this);
-        PowerMockito.mockStatic(Logger.class);
-        when(Logger.getLogger("Info")).thenReturn(log);
-        when(log.isEnabledFor (Level.DEBUG)).thenReturn(false);
+    	initMocks(this);
     }
 
     @Test
-    public void test() throws APIException {
-        Log4JLogTarget target = new Log4JLogTarget(null, Level.INFO);
-        Log4JLogTarget target1 = new Log4JLogTarget("Info", Level.DEBUG);
+    public void testLoggable() {
+    	Log4JLogTarget logObj = null;
+		try {
+			logObj = new Log4JLogTarget( "testLogger", Level.DEBUG);
+		} catch (APIException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+    	boolean retVal = logObj.isLoggable();
+        assertTrue(retVal);
+    }
+    
+    @Test
+    public void testLog() {
+    	Log4JLogTarget logObj = null;
+		try {
+			logObj = new Log4JLogTarget( null, Level.DEBUG);
+		} catch (APIException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+    	logObj.log(new Object[] {"test"});
+    }
+    
+    @Test
+    public void testLogThrowable() {
+    	Log4JLogTarget logObj = null;
+		try {
+			logObj = new Log4JLogTarget( null, Level.DEBUG);
+		} catch (APIException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		logObj.log(new Throwable("test exception"), new Object[] {"test","test2","",null});
+    }
+    
+    @Test
+    public void testPrintf() {
+    	Log4JLogTarget logObj = null;
+		try {
+			logObj = new Log4JLogTarget( "", level);
+		} catch (APIException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+    	logObj.printf("test", new Object[] {"test","test2",""});
 
-        assertFalse(target1.isLoggable());
+    }
+    
+    @Test
+    public void testSetEnv() {
+		try {
+			Log4JLogTarget.setLog4JEnv("test", Mockito.mock(BasicEnv.class));
+		} catch (APIException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
 
     }
 }
\ No newline at end of file
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java
new file mode 100644
index 0000000..62c4903
--- /dev/null
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java
@@ -0,0 +1,714 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.misc.env.jaxb;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.validation.Schema;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.misc.env.APIException;
+import org.onap.aaf.misc.env.Data;
+import org.onap.aaf.misc.env.Env;
+import org.onap.aaf.misc.env.EnvJAXB;
+import org.onap.aaf.misc.env.LogTarget;
+import org.onap.aaf.misc.env.TimeTaken;
+
+public class JU_JAXBDF {
+
+    @Mock
+    EnvJAXB primaryEnv;
+    
+    @Mock
+    JAXBumar jumar;
+    
+    @Mock
+    JAXBmar jmar;
+    
+    @Mock
+    Env env;
+    
+    TimeTaken tt,ttObjectify;
+
+    @Before
+    public void setUp() {
+    	initMocks(this);
+    	tt=Mockito.mock(TimeTaken.class);
+    	Mockito.doReturn(tt).when(env).start("JAXB Stringify", Env.XML);
+		Mockito.doNothing().when(tt).done();
+		ttObjectify=Mockito.mock(TimeTaken.class);
+    	Mockito.doReturn(ttObjectify).when(env).start("JAXB Objectify", Env.XML);
+		Mockito.doNothing().when(ttObjectify).done();
+    }
+
+    @Test
+    public void testNewInstance() {
+    	JAXBDF<?> bdfObj = null;
+		try {
+			bdfObj = new JAXBDF( null, new Class[] {this.getClass()});
+			bdfObj.jumar = Mockito.mock(JAXBumar.class);
+			Mockito.doThrow(new IllegalAccessException("Test Exception")).when(bdfObj.jumar).newInstance();
+	    	Object retVal = bdfObj.newInstance();
+		} catch (IllegalAccessException e) {
+			assertEquals("Test Exception", e.getLocalizedMessage());
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("Test Exception"));
+		} catch (InstantiationException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+    	
+    }
+    
+    @Test
+    public void testNewInstanceNoException() {
+    	JAXBDF<?> bdfObj = null;
+		try {
+			bdfObj = new JAXBDF( null, new Class[] {this.getClass()});
+	    	Object retVal = bdfObj.newInstance();
+	    	assertTrue(retVal instanceof JU_JAXBDF);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} 
+    	
+    }
+    
+    @Test
+    public void testPrettyNoException() {
+    	JAXBDF<?> bdfObj = null;
+		try {
+			bdfObj = new JAXBDF( null, Mockito.mock(Schema.class), new Class[] {this.getClass()});
+	    	Object retVal = bdfObj.pretty(true);
+	    	assertTrue(retVal instanceof JAXBDF);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} 
+    }
+
+    @Test
+    public void testFragment() {
+    	JAXBDF<?> bdfObj = null;
+		try {
+			bdfObj = new JAXBDF( null, Mockito.mock(QName.class), new Class[] {this.getClass()});
+	    	Object retVal = bdfObj.asFragment(true);
+	    	assertTrue(retVal instanceof JAXBDF);
+	    	bdfObj.servicePrestart(null);
+	    	bdfObj.threadPrestart(null);
+	    	bdfObj.refresh(null);
+	    	bdfObj.threadDestroy(null);
+	    	bdfObj.serviceDestroy(null);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} 
+    	
+    }
+    
+    @Test
+    public void testNewData() {
+    	JAXBDF<?> bdfObj = null;
+		try {
+			bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()});
+	    	Data<?> retVal = bdfObj.newData();
+	    	assertTrue(retVal instanceof JAXBData);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} 
+    }
+    
+    @Test
+    public void testNewDataENV() {
+    	JAXBDF<?> bdfObj = null;
+		try {
+			bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()});
+	    	Data<?> retVal = bdfObj.newData(Mockito.mock(Env.class));
+	    	assertTrue(retVal instanceof JAXBData);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} 
+    }
+    
+    @Test
+    public void testNewDataType() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()});
+	    	Data<?> retVal = bdfObj.newData(new JAXBumar(new Class[] {this.getClass()}));
+	    	assertTrue(retVal instanceof JAXBData);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} catch (JAXBException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} 
+    }
+    
+    @Test
+    public void testNewDataStream() {
+    	JAXBDF<?> bdfObj = null;
+		try {
+			bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			InputStream is = Mockito.mock(InputStream.class);
+			Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, is);
+	    	Data<?> retVal = bdfObj.newDataFromStream(env, is);
+	    	assertTrue(retVal instanceof JAXBData);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} catch (JAXBException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} 
+    }
+    
+    @Test
+    public void testNewDataStreamException() {
+    	JAXBDF<?> bdfObj = null;
+		try {
+			bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			InputStream is = Mockito.mock(InputStream.class);
+			Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, is);
+	    	Data<?> retVal = bdfObj.newDataFromStream(env, is);
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			// TODO Auto-generated catch block
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    }
+    
+    @Test
+    public void testNewDataFromString() {
+    	JAXBDF<?> bdfObj = null;
+		try {
+			bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()});
+	    	Data<?> retVal = bdfObj.newDataFromString("test");
+	    	assertTrue(retVal instanceof JAXBData);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} 
+    }
+    
+    @Test
+    public void testStringify() {
+    	JAXBDF<JAXBmar> bdfObj = null;
+		try {
+			JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()});
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()});
+			bdfObj.jmar =  Mockito.mock(JAXBmar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(envJaxb).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class));
+	    	String retVal = bdfObj.stringify(typeObj);
+	    	assertEquals("", retVal);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} catch (JAXBException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} 
+    }
+    
+    @Test
+    public void testStringifyException() {
+    	JAXBDF<JAXBmar> bdfObj = null;
+		try {
+			JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()});
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(envJaxb).debug();
+			bdfObj = new JAXBDF<JAXBmar>( envJaxb, new Class[] {this.getClass()});
+			bdfObj.jmar =  Mockito.mock(JAXBmar.class);
+			Mockito.doThrow(new JAXBException("test") ).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class));
+	    	String retVal = bdfObj.stringify(typeObj);
+	    	System.out.println(retVal);
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    }
+    
+    @Test
+    public void testStringifyWriter() {
+    	JAXBDF<JAXBmar> bdfObj = null;
+		try {
+			JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()});
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()});
+			bdfObj.jmar =  Mockito.mock(JAXBmar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(envJaxb).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class));
+	    	bdfObj.stringify(typeObj, Mockito.mock(StringWriter.class));
+		} catch (APIException e) {
+			e.printStackTrace();
+		} catch (JAXBException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} 
+    }
+    
+    @Test
+    public void testStringifyWriterException() {
+    	JAXBDF<JAXBmar> bdfObj = null;
+		try {
+			JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()});
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()});
+			bdfObj.jmar =  Mockito.mock(JAXBmar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(envJaxb).debug();
+			StringWriter sw = Mockito.mock(StringWriter.class);
+			Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw);
+	    	bdfObj.stringify(typeObj, sw);
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    }
+    
+    @Test
+    public void testStringifyOS() {
+    	JAXBDF<JAXBmar> bdfObj = null;
+		try {
+			JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()});
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()});
+			bdfObj.jmar =  Mockito.mock(JAXBmar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(envJaxb).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(OutputStream.class));
+	    	bdfObj.stringify(typeObj, Mockito.mock(OutputStream.class));
+		} catch (APIException e) {
+			e.printStackTrace();
+		} catch (JAXBException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} 
+    }
+    
+    @Test
+    public void testStringifyOsException() {
+    	JAXBDF<JAXBmar> bdfObj = null;
+		try {
+			JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()});
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()});
+			bdfObj.jmar =  Mockito.mock(JAXBmar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(envJaxb).debug();
+			OutputStream sw = Mockito.mock(OutputStream.class);
+			Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw);
+	    	bdfObj.stringify(typeObj, sw);
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    }
+    
+    @Test
+    public void testStringifyOptions() {
+    	JAXBDF<JAXBmar> bdfObj = null;
+		try {
+			JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()});
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()});
+			bdfObj.jmar =  Mockito.mock(JAXBmar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(envJaxb).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(OutputStream.class));
+	    	bdfObj.stringify(env, typeObj, true);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} catch (JAXBException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} 
+    }
+    
+    @Test
+    public void testStringifyOSOptions() {
+    	JAXBDF<JAXBmar> bdfObj = null;
+		try {
+			JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()});
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()});
+			bdfObj.jmar =  Mockito.mock(JAXBmar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(OutputStream.class),true);
+	    	bdfObj.stringify(env, typeObj, Mockito.mock(OutputStream.class),true);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} catch (JAXBException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} 
+    }
+    
+    @Test
+    public void testStringifyOsOptionsException() {
+    	JAXBDF<JAXBmar> bdfObj = null;
+		try {
+			JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()});
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()});
+			bdfObj.jmar =  Mockito.mock(JAXBmar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			OutputStream sw = Mockito.mock(OutputStream.class);
+			Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw,true);
+	    	bdfObj.stringify(env, typeObj, sw,true);
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    }
+    @Test
+    public void testStringifySWOptions() {
+    	JAXBDF<JAXBmar> bdfObj = null;
+		try {
+			JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()});
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()});
+			bdfObj.jmar =  Mockito.mock(JAXBmar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class),true);
+	    	bdfObj.stringify(env, typeObj, Mockito.mock(StringWriter.class),true);
+		} catch (APIException e) {
+			e.printStackTrace();
+		} catch (JAXBException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} 
+    }
+    
+    @Test
+    public void testStringifySWOptionsException() {
+    	JAXBDF<JAXBmar> bdfObj = null;
+		try {
+			JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()});
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()});
+			bdfObj.jmar =  Mockito.mock(JAXBmar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			StringWriter sw = Mockito.mock(StringWriter.class);
+			Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw,true);
+	    	bdfObj.stringify(env, typeObj, sw,true);
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    }
+ 
+    @Test
+    public void testObjectifyEnv() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(StringReader.class));
+			
+	    	bdfObj.objectify(env, Mockito.mock(StringReader.class));
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    @Test
+    public void testObjectifyEnvException() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			StringReader sr = Mockito.mock(StringReader.class);
+			Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr);
+			
+	    	bdfObj.objectify(env, sr);
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    
+    @Test
+    public void testObjectifyRdr() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(StringReader.class));
+			
+	    	bdfObj.objectify( Mockito.mock(StringReader.class));
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    @Test
+    public void testObjectifyRdrException() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(envJaxb).debug();
+			StringReader sr = Mockito.mock(StringReader.class);
+			Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr);
+			
+	    	bdfObj.objectify(sr);
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    
+    @Test
+    public void testObjectifyEnvIS() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(InputStream.class));
+			
+	    	bdfObj.objectify(env, Mockito.mock(InputStream.class));
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    @Test
+    public void testObjectifyEnvISException() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			InputStream sr = Mockito.mock(InputStream.class);
+			Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr);
+			
+	    	bdfObj.objectify(env, sr);
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    
+    @Test
+    public void testObjectifyIs() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(InputStream.class));
+			
+	    	bdfObj.objectify( Mockito.mock(InputStream.class));
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    @Test
+    public void testObjectifyIsException() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(envJaxb).debug();
+			InputStream sr = Mockito.mock(InputStream.class);
+			Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr);
+			
+	    	bdfObj.objectify(sr);
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    
+    @Test
+    public void testObjectifyEnvStr() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, "test");
+			
+	    	bdfObj.objectify(env, "test");
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    @Test
+    public void testObjectifyEnvStrException() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			InputStream sr = Mockito.mock(InputStream.class);
+			Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, "test");
+			
+	    	bdfObj.objectify(env, "test");
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    
+    @Test
+    public void testObjectifyStr() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(env).debug();
+			Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, "test");
+			
+	    	bdfObj.objectify( "test");
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    @Test
+    public void testObjectifyStrException() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()});
+			bdfObj.jumar =  Mockito.mock(JAXBumar.class);
+			LogTarget logT = Mockito.mock(LogTarget.class);
+			Mockito.doReturn(logT).when(envJaxb).debug();
+			InputStream sr = Mockito.mock(InputStream.class);
+			Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, "test");
+			
+	    	bdfObj.objectify("test");
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} catch (JAXBException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+    
+    @Test
+    public void testTypeClass() {
+    	JAXBDF<JAXBumar> bdfObj = null;
+		try {
+			EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
+			bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
+			
+	    	Object obj = bdfObj.getTypeClass();
+	    	assertFalse(obj instanceof JU_JAXBDF);
+		} catch (APIException e) {
+			assertTrue(e.getMessage().contains("test"));
+		} 
+    	
+    }
+}
