From cb067ee35bfba82cb686cdfce8207fe3060380c8 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Fri, 24 Aug 2018 09:02:47 -0400 Subject: aairesultwrapper is now actually serializable added in a proper serialization and deserialization test addressed any comments from pull added in a serialization test for AAIResultWrapper and updated one of the null returns change jsonBody in AAIResultWrapper back to String Change-Id: Iffa5661f129cc26d69dfaa966cd265c67903cf21 Issue-ID: SO-899 Signed-off-by: Benjamin, Max (mb388a) --- .../so/client/aai/entities/AAIResultWrapperTest.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'common/src/test/java/org/onap') diff --git a/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java b/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java index ff940a0dea..e40c25a2e2 100644 --- a/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java +++ b/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java @@ -20,9 +20,10 @@ package org.onap.so.client.aai.entities; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.io.IOException; +import java.io.Serializable; import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; @@ -30,11 +31,15 @@ import java.util.Map; import java.util.Optional; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.runners.MockitoJUnitRunner; import org.onap.aai.domain.yang.GenericVnf; import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.springframework.util.SerializationUtils; + import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonMappingException; @@ -43,7 +48,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(MockitoJUnitRunner.class) public class AAIResultWrapperTest { String json; - + @Rule + public ExpectedException thrown= ExpectedException.none(); + AAIResultWrapper aaiResultWrapper; AAIResultWrapper aaiResultWrapperEmpty; @@ -56,6 +63,14 @@ public class AAIResultWrapperTest { aaiResultWrapperEmpty = new AAIResultWrapper("{}"); } + @Test + public void testAAIResultWrapperIsSerializable() throws IOException { + AAIResultWrapper original = new AAIResultWrapper(""); + byte[] serialized = SerializationUtils.serialize(original); + AAIResultWrapper deserialized = (AAIResultWrapper) SerializationUtils.deserialize(serialized); + assertEquals(deserialized.getJson(), original.getJson()); + } + @Test public void testGetRelationshipsEmpty() { Optional relationships = aaiResultWrapperEmpty.getRelationships(); -- cgit 1.2.3-korg