aboutsummaryrefslogtreecommitdiffstats
path: root/validate/validation
diff options
context:
space:
mode:
authorpriyanka.akhade <priyanka.akhade@huawei.com>2020-02-28 05:47:34 +0000
committerpriyanka.akhade <priyanka.akhade@huawei.com>2020-02-29 11:26:08 +0000
commit132177fb71c08f157fb42037f9dd26ceb2d0ba43 (patch)
treef47d3c4d950e98d5bcf104aa8952f39a84e3ba6d /validate/validation
parent4f1d279e42a3326cdc97e1eacaf0fdb58ee944e7 (diff)
Migrate to gson
Issue-ID: CLI-247 Signed-off-by: priyanka.akhade <priyanka.akhade@huawei.com> Change-Id: If66134db5503382fb45210ece883402fc130ac93
Diffstat (limited to 'validate/validation')
-rw-r--r--validate/validation/src/test/java/org/onap/cli/validation/OnapValidationTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/validate/validation/src/test/java/org/onap/cli/validation/OnapValidationTest.java b/validate/validation/src/test/java/org/onap/cli/validation/OnapValidationTest.java
index 181ae515..e94de60a 100644
--- a/validate/validation/src/test/java/org/onap/cli/validation/OnapValidationTest.java
+++ b/validate/validation/src/test/java/org/onap/cli/validation/OnapValidationTest.java
@@ -17,6 +17,7 @@
package org.onap.cli.validation;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.io.File;
@@ -48,6 +49,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
public class OnapValidationTest {
public static final String SAMPLE_VERSION = "open_cli_sample_version";
@@ -64,6 +68,7 @@ public class OnapValidationTest {
OnapCli cli = new OnapCli();
private static Logger LOG = LoggerFactory.getLogger(OnapValidationTest.class);
+ private static Gson gson = new GsonBuilder().serializeNulls().create();
private void handle(String[] args) {
cli.resetExitCode();
@@ -261,4 +266,11 @@ public class OnapValidationTest {
onapCli.handle();
assertEquals(OnapCliConstants.EXIT_SUCCESS, onapCli.getExitCode());
}
+ @Test
+ public void testOnapCommandSchemaInfoForUnknownFields(){
+ OnapCommandSchemaInfo ocsi = new OnapCommandSchemaInfo();
+ String testExp = "{\"schemaName\":\"testSchema\",\"schemaURI\":\"testUri\",\"unknownField\":\"unknown\"}";
+ ocsi= gson.fromJson(testExp,OnapCommandSchemaInfo.class);
+ assertNotNull(ocsi);
+ }
}