aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2019-02-15 15:29:54 +0100
committersebdet <sebastien.determe@intl.att.com>2019-02-15 15:29:54 +0100
commit2f468e4472e56ec56cb9823d188a564749b93457 (patch)
tree8e4747a0c4d7924e769959f51c4bacb4ae8a3973 /src/test
parent84ed4289eed8fd30b123ba2a76dea5d9a3c56d52 (diff)
Remove remaining Jackson
Remove jackson import as jackson shoul dbe removed Issue-ID: CLAMP-292 Change-Id: I43b3bd2e2f217293ae8ac262b013b2287d1e2b16 Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java b/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java
index 3e11b8a2..82c2162a 100644
--- a/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java
+++ b/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java
@@ -24,15 +24,17 @@
package org.onap.clamp.clds.util;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import java.io.IOException;
+import java.io.IOException;
import java.util.List;
+
import org.junit.Test;
public class JsonUtilsTest {
@@ -78,7 +80,8 @@ public class JsonUtilsTest {
}
/**
- * This method test that the security hole in Jackson is not enabled in the default ObjectMapper.
+ * This method test that the security hole in GSON is not enabled in the default
+ * ObjectMapper.
*/
@Test
public void testCreateBeanDeserializer() {
@@ -91,48 +94,47 @@ public class JsonUtilsTest {
assertFalse(testObject instanceof TestObject);
}
-
@Test
public void shouldReturnJsonValueByName() throws IOException {
- //given
+ // given
String modelProperties = ResourceFileUtil
.getResourceAsString("example/model-properties/custom/modelBpmnPropertiesMultiVF.json");
JsonElement globalElement = JsonUtils.GSON.fromJson(modelProperties, JsonObject.class).get("global");
- //when
+ // when
String locationName = JsonUtils.getStringValueByName(globalElement, "location");
String timeoutValue = JsonUtils.getStringValueByName(globalElement, "timeout");
- //then
+ // then
assertThat(locationName).isEqualTo("SNDGCA64");
assertThat(timeoutValue).isEqualTo("500");
}
@Test
public void shouldReturnJsonObjectByPropertyName() throws IOException {
- //given
+ // given
String modelProperties = ResourceFileUtil
.getResourceAsString("example/model-properties/custom/modelBpmnPropertiesMultiVF.json");
JsonElement globalElement = JsonUtils.GSON.fromJson(modelProperties, JsonObject.class).get("global");
- //when
+ // when
JsonObject deployParameters = JsonUtils.getJsonObjectByName(globalElement, "deployParameters");
- //then
+ // then
assertThat(deployParameters).isEqualToComparingFieldByField(DEPLOY_PARAMETERS);
}
@Test
public void shouldReturnJsonValuesByPropertyName() throws IOException {
- //given
+ // given
String modelProperties = ResourceFileUtil
.getResourceAsString("example/model-properties/custom/modelBpmnPropertiesMultiVF.json");
JsonElement globalElement = JsonUtils.GSON.fromJson(modelProperties, JsonObject.class).get("global");
- //when
+ // when
List<String> vfs = JsonUtils.getStringValuesByName(globalElement, "vf");
- //then
+ // then
assertThat(vfs).containsExactly(
"6c7aaec2-59eb-41d9-8681-b7f976ab668d",
"8sadsad0-a98s-6a7s-fd12-sadji9sa8d12",
@@ -140,18 +142,17 @@ public class JsonUtilsTest {
);
}
-
@Test
public void shouldReturnJsonValueAsInteger() throws IOException {
- //given
+ // given
String modelProperties = ResourceFileUtil
.getResourceAsString("example/model-properties/custom/modelBpmnPropertiesMultiVF.json");
JsonElement globalElement = JsonUtils.GSON.fromJson(modelProperties, JsonObject.class).get("global");
- //when
+ // when
Integer timeoutValue = JsonUtils.getIntValueByName(globalElement, "timeout");
- //then
+ // then
assertThat(timeoutValue).isEqualTo(500);
}
}