summaryrefslogtreecommitdiffstats
path: root/framework/src/test/java
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-10-05 14:32:33 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-10-05 14:32:33 +0530
commit8b4f5b8f95b02cd8b511fd2890ffa1589cb404fa (patch)
tree5a7b0f47a36029335e6c97108a84c842cad4ca6f /framework/src/test/java
parentf2b21b10732d743a5a0940d6565aa18b643f6604 (diff)
Improve profile verification
CLI-34 Change-Id: I7c0443c80506dcc12151c448de4b8ebda42dadea Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/test/java')
-rw-r--r--framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java46
1 files changed, 24 insertions, 22 deletions
diff --git a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
index b2c15086..16c3f2f3 100644
--- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
@@ -16,6 +16,14 @@
package org.onap.cli.fw;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.net.URL;
+
import org.junit.Before;
import org.junit.Test;
import org.onap.cli.fw.error.OnapCommandException;
@@ -23,14 +31,6 @@ import org.onap.cli.fw.error.OnapCommandHelpFailed;
import org.onap.cli.fw.error.OnapCommandNotFound;
import org.onap.cli.fw.error.OnapCommandRegistrationFailed;
-import java.io.File;
-import java.net.URL;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
public class OnapCommandRegistrarTest {
OnapCommandRegistrar registerar;
@@ -113,7 +113,6 @@ public class OnapCommandRegistrarTest {
}
@Test(expected = OnapCommandHelpFailed.class)
- // For coverage
public void helpTestException() throws OnapCommandException {
OnapCommand test = new OnapCommandTest1();
Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass();
@@ -141,22 +140,25 @@ public class OnapCommandRegistrarTest {
}
@Test
- public void testCoverageScope() throws OnapCommandException {
- OnapCommandRegistrar.getRegistrar().setProfile("test");
- OnapCommandRegistrar.getRegistrar().addParamCache("a", "b");
- OnapCommandRegistrar.getRegistrar().getParamCache();
- OnapCommandRegistrar.getRegistrar().removeParamCache("a");
-
- OnapCommandRegistrar.getRegistrar().isInteractiveMode();
- OnapCommandRegistrar.getRegistrar().setInteractiveMode(false);
+ public void testProfile() throws OnapCommandException {
+ try {
+ OnapCommandRegistrar.getRegistrar().setProfile("test");
+ OnapCommandRegistrar.getRegistrar().addParamCache("a", "b");
+ OnapCommandRegistrar.getRegistrar().getParamCache();
+ OnapCommandRegistrar.getRegistrar().removeParamCache("a");
- OnapCommandRegistrar.getRegistrar().setEnabledProductVersion("cli-1.0");
- OnapCommandRegistrar.getRegistrar().getEnabledProductVersion();
- OnapCommandRegistrar.getRegistrar().getAvailableProductVersions();
- OnapCommandRegistrar.getRegistrar().listCommandsForEnabledProductVersion();
+ OnapCommandRegistrar.getRegistrar().setInteractiveMode(false);
+ assertTrue(!OnapCommandRegistrar.getRegistrar().isInteractiveMode());
- OnapCommandRegistrar.getRegistrar().listCommandInfo();
+ OnapCommandRegistrar.getRegistrar().setEnabledProductVersion("cli-1.0");
+ assertEquals("cli-1.0", OnapCommandRegistrar.getRegistrar().getEnabledProductVersion());
+ OnapCommandRegistrar.getRegistrar().getAvailableProductVersions();
+ assertTrue(OnapCommandRegistrar.getRegistrar().listCommandsForEnabledProductVersion().contains("schema-refresh"));
+ assertTrue(OnapCommandRegistrar.getRegistrar().listCommandInfo().size() > 2);
+ } catch (Exception e) {
+ fail("failed to test the profile");
+ }
}
}