diff options
author | Nelson, Thomas (arthurdent3) <nelson24@att.com> | 2019-05-15 17:59:33 +0000 |
---|---|---|
committer | Nelson, Thomas (arthurdent3) <nelson24@att.com> | 2019-05-15 17:59:33 +0000 |
commit | b426a6e832df4db4a57c0d271559fd0b0926e02d (patch) | |
tree | d6c8b23ea14bb5a33d07dc747d9f8434d97406ab | |
parent | d6e7b63cc580e7b3822be61fe92a493ad5e222a3 (diff) |
Update junit test
Change-Id: I1c39d008958cebed0454b5a1f980e3c88082c876
Issue-ID: MUSIC-395
Signed-off-by: Nelson, Thomas (arthurdent3) <nelson24@att.com>
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java | 5 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/jsonobjects/JsonInsertTest.java | 23 |
3 files changed, 27 insertions, 5 deletions
@@ -15,7 +15,11 @@ src/main/webapp .DS_Store ._* +# Ignore jars +**/*.jar *.jar + + .metadata # Eclipse stuff .settings/ diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java index 4533f947..09cd65dc 100644 --- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java +++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java @@ -43,6 +43,7 @@ import org.onap.music.eelf.logging.format.ErrorTypes; @ApiModel(value = "JsonTable", description = "Json model for table vlaues insert") @JsonIgnoreProperties(ignoreUnknown = true) public class JsonInsert implements Serializable { + private static final long serialVersionUID = 1L; private String keyspaceName; private String tableName; private transient Map<String, Object> values; @@ -117,11 +118,11 @@ public class JsonInsert implements Serializable { } @ApiModelProperty(value = "Information for selecting specific rows for insert") - public Map<String, Object> getRow_specification() { + public Map<String, Object> getRowSpecification() { return rowSpecification; } - public void setRow_specification(Map<String, Object> rowSpecification) { + public void setRowSpecification(Map<String, Object> rowSpecification) { this.rowSpecification = rowSpecification; } diff --git a/src/test/java/org/onap/music/unittests/jsonobjects/JsonInsertTest.java b/src/test/java/org/onap/music/unittests/jsonobjects/JsonInsertTest.java index 69403cc7..535cdd84 100644 --- a/src/test/java/org/onap/music/unittests/jsonobjects/JsonInsertTest.java +++ b/src/test/java/org/onap/music/unittests/jsonobjects/JsonInsertTest.java @@ -23,8 +23,12 @@ package org.onap.music.unittests.jsonobjects; import static org.junit.Assert.*; + +import java.io.Serializable; import java.util.HashMap; import java.util.Map; + +import org.apache.commons.lang3.SerializationUtils; import org.junit.Test; import org.onap.music.datastore.jsonobjects.JsonInsert; @@ -74,13 +78,26 @@ public class JsonInsertTest { } @Test - public void testGetRow_specification() { + public void testGetRowSpecification() { + Map<String,Object> cons = new HashMap<>(); + cons.put("val1","one"); + cons.put("val2","two"); + ji.setRowSpecification(cons); + assertEquals("two",ji.getRowSpecification().get("val2")); + } + + @Test + public void testSerialize() { Map<String,Object> cons = new HashMap<>(); cons.put("val1","one"); cons.put("val2","two"); - ji.setRow_specification(cons); - assertEquals("two",ji.getRow_specification().get("val2")); + ji.setTimestamp("10:30"); + ji.setRowSpecification(cons); + byte[] test1 = ji.serialize(); + byte[] ji1 = SerializationUtils.serialize(ji); + assertArrayEquals(ji1,test1); } + } |