Add test cases for aaf authz modules
[aaf/authz.git] / authz-cmd / src / test / java / org / onap / aaf / cmd / ns / JU_ListUsersInRole.java
index 7fc7af3..786adb5 100644 (file)
@@ -30,42 +30,38 @@ import org.junit.runner.RunWith;
 import org.mockito.runners.MockitoJUnitRunner;\r
 import org.onap.aaf.cmd.AAFcli;\r
 import org.onap.aaf.cmd.JU_AAFCli;\r
-import org.onap.aaf.cmd.ns.List;\r
-import org.onap.aaf.cmd.ns.ListUsers;\r
-import org.onap.aaf.cmd.ns.ListUsersInRole;\r
-import org.onap.aaf.cmd.ns.NS;\r
-\r
-import org.onap.aaf.cadi.CadiException;\r
-import org.onap.aaf.cadi.LocatorException;\r
-import org.onap.aaf.inno.env.APIException;\r
 \r
 @RunWith(MockitoJUnitRunner.class)\r
 public class JU_ListUsersInRole {\r
-       \r
+\r
        private static ListUsersInRole lsUserinRole;\r
-       \r
+\r
        @BeforeClass\r
-       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {\r
+       public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {\r
                AAFcli cli = JU_AAFCli.getAAfCli();\r
                NS ns = new NS(cli);\r
                List ls = new List(ns);\r
                ListUsers lsU = new ListUsers(ls);\r
                lsUserinRole = new ListUsersInRole(lsU);\r
        }\r
-       \r
+\r
        @Test\r
        public void exec() {\r
                try {\r
-                       assertEquals(lsUserinRole._exec(0, "add","del","reset","extend"),500);\r
-               } catch (CadiException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               } catch (APIException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               } catch (LocatorException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       assertEquals(lsUserinRole._exec(0, "add", "del", "reset", "extend"), 500);\r
+               } catch (Exception e) {\r
+                       assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");\r
+               }\r
+       }\r
+\r
+       @Test\r
+       public void detailedHelp() {\r
+               boolean hasNoError = true;\r
+               try {\r
+                       lsUserinRole.detailedHelp(1, new StringBuilder("test"));\r
+               } catch (Exception e) {\r
+                       hasNoError = false;\r
                }\r
+               assertEquals(hasNoError, true);\r
        }\r
 }\r