diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2021-04-13 17:16:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-04-13 17:16:58 +0000 |
commit | 322b149685bb2f9405999f5a299130694d1b8fe3 (patch) | |
tree | 1aac8e2667cf8a29984ee03bff5623fdecf9161a /utils/src/test | |
parent | 1cb818e3cbd6154762f908be8698317fa10fbc49 (diff) | |
parent | 1155833a3d4e271f495e0ca40ea591919aa11b78 (diff) |
Merge "Revert "Modify StandardCoder to handle empty source""
Diffstat (limited to 'utils/src/test')
-rw-r--r-- | utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java b/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java index be588a40..a468f0b4 100644 --- a/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java +++ b/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java @@ -1,8 +1,8 @@ -/*- +/* * ============LICENSE_START======================================================= * ONAP PAP * ================================================================================ - * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ package org.onap.policy.common.utils.coder; -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -264,8 +263,6 @@ public class StandardCoderTest { @Test public void testToJsonTree_testFromJsonJsonElementClassT() throws Exception { - assertThat(coder.fromJson((JsonElement) null, MyMap.class)).isNull(); - MyMap map = new MyMap(); map.props = new LinkedHashMap<>(); map.props.put("jel keyA", "jel valueA"); @@ -281,34 +278,6 @@ public class StandardCoderTest { } @Test - public void testFromJsonStringClassT() throws Exception { - assertThat(coder.fromJson((String) null, MyMap.class)).isNull(); - - String json = "{'props': {'str keyA': 'str valueA', 'str keyB':'str valueB'}}".replace('\'', '"'); - - Object result = coder.fromJson(json, MyMap.class); - - assertNotNull(result); - assertEquals("{str keyA=str valueA, str keyB=str valueB}", result.toString()); - - assertThatThrownBy(() -> coder.fromJson("", MyMap.class)).isInstanceOf(CoderException.class) - .hasMessageContaining("empty"); - } - - @Test - public void testFromJsonReaderClassT() throws Exception { - String json = "{'props': {'str keyA': 'str valueA', 'str keyB':'str valueB'}}".replace('\'', '"'); - - Object result = coder.fromJson(new StringReader(json), MyMap.class); - - assertNotNull(result); - assertEquals("{str keyA=str valueA, str keyB=str valueB}", result.toString()); - - assertThatThrownBy(() -> coder.fromJson(new StringReader(""), MyMap.class)).isInstanceOf(CoderException.class) - .hasMessageContaining("empty"); - } - - @Test public void testConvertFromDouble() throws Exception { String text = "[listA, {keyA=100}, 200]"; assertEquals(text, coder.decode(text, Object.class).toString()); |