summaryrefslogtreecommitdiffstats
path: root/gson
diff options
context:
space:
mode:
authorwaynedunican <wayne.dunican@est.tech>2024-06-25 14:47:25 +0100
committerwaynedunican <wayne.dunican@est.tech>2024-06-27 12:00:30 +0100
commitcf67c9ea492dcac3cdded351a853653cb38af40c (patch)
tree1270ab27441c9cc410f00fb1d1100c85f49d7855 /gson
parent0fb3ba9d6e541a6853ea91f20c990a6b66e5c9b5 (diff)
Convert common to JUnit 5
Review for common-logging, common-parameters & gson Issue-ID: POLICY-5043 Change-Id: I0f1dce53716dff8d9c5557a68b2723c6a4752c9f Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'gson')
-rw-r--r--gson/pom.xml5
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/DoubleConverterTest.java16
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/GsonMessageBodyHandlerTest.java38
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/InstantAsMillisTypeAdapterTest.java9
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/InstantTypeAdapterTest.java9
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/JacksonExclusionStrategyTest.java34
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/JacksonFieldAdapterFactoryTest.java23
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/JacksonHandlerTest.java16
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/JacksonMethodAdapterFactoryTest.java21
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/LocalDateTimeTypeAdapterTest.java9
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/LocalDateTypeAdapterTest.java9
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/MapDoubleAdapterFactoryTest.java19
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/OffsetDateTimeAdapterTest.java9
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/OffsetTimeTypeAdapterTest.java9
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/StringTypeAdapterTest.java9
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/ZoneOffsetTypeAdapterTest.java9
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/ZonedDateTimeTypeAdapterTest.java9
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/internal/AdapterTest.java48
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/internal/AnyGetterSerializerTest.java21
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/internal/AnySetterDeserializerTest.java19
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/internal/ClassWalkerTest.java31
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/internal/FieldDeserializerTest.java13
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/internal/FieldSerializerTest.java11
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/internal/JacksonTypeAdapterTest.java21
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/internal/LifterTest.java11
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/internal/MethodAdapterTest.java11
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/internal/MethodDeserializerTest.java13
-rw-r--r--gson/src/test/java/org/onap/policy/common/gson/internal/MethodSerializerTest.java13
28 files changed, 241 insertions, 224 deletions
diff --git a/gson/pom.xml b/gson/pom.xml
index 0353f139..0f11f374 100644
--- a/gson/pom.xml
+++ b/gson/pom.xml
@@ -55,11 +55,6 @@
<artifactId>re2j</artifactId>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
diff --git a/gson/src/test/java/org/onap/policy/common/gson/DoubleConverterTest.java b/gson/src/test/java/org/onap/policy/common/gson/DoubleConverterTest.java
index f4e3a76b..72cb41db 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/DoubleConverterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/DoubleConverterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,20 +21,19 @@
package org.onap.policy.common.gson;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class DoubleConverterTest {
+class DoubleConverterTest {
@Test
- @SuppressWarnings("unchecked")
- public void testConvertFromDoubleObject() {
+ void testConvertFromDoubleObject() {
// these should be unchanged
assertNull(DoubleConverter.convertFromDouble((Object) null));
assertEquals("hello", DoubleConverter.convertFromDouble("hello"));
@@ -68,7 +68,7 @@ public class DoubleConverterTest {
}
@Test
- public void testConvertFromDoubleList() {
+ void testConvertFromDoubleList() {
// null is ok
DoubleConverter.convertFromDouble((List<Object>) null);
@@ -86,7 +86,7 @@ public class DoubleConverterTest {
}
@Test
- public void testConvertFromDoubleMap() {
+ void testConvertFromDoubleMap() {
// null is ok
DoubleConverter.convertFromDouble((Map<String, Object>) null);
diff --git a/gson/src/test/java/org/onap/policy/common/gson/GsonMessageBodyHandlerTest.java b/gson/src/test/java/org/onap/policy/common/gson/GsonMessageBodyHandlerTest.java
index fc101430..00e1caf0 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/GsonMessageBodyHandlerTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/GsonMessageBodyHandlerTest.java
@@ -3,7 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,9 +22,9 @@
package org.onap.policy.common.gson;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import jakarta.ws.rs.core.MediaType;
import java.io.ByteArrayInputStream;
@@ -39,10 +39,10 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import lombok.ToString;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-public class GsonMessageBodyHandlerTest {
+class GsonMessageBodyHandlerTest {
private static final String GEN_TYPE = "some-type";
private static final String[] subtypes = {"json", "jSoN", "hello+json", "javascript", "x-javascript", "x-json"};
@@ -54,18 +54,18 @@ public class GsonMessageBodyHandlerTest {
private GsonMessageBodyHandler hdlr;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
hdlr = new GsonMessageBodyHandler();
}
@Test
- public void testIsWriteable() {
+ void testIsWriteable() {
// null media type
assertTrue(hdlr.isWriteable(null, null, null, null));
for (String subtype : subtypes) {
- assertTrue("writeable " + subtype, hdlr.isWriteable(null, null, null, new MediaType(GEN_TYPE, subtype)));
+ assertTrue(hdlr.isWriteable(null, null, null, new MediaType(GEN_TYPE, subtype)), "writeable " + subtype);
}
@@ -79,12 +79,12 @@ public class GsonMessageBodyHandlerTest {
}
@Test
- public void testGetSize() {
+ void testGetSize() {
assertEquals(-1, hdlr.getSize(null, null, null, null, null));
}
@Test
- public void testWriteTo_testReadFrom() throws Exception {
+ void testWriteTo_testReadFrom() throws Exception {
ByteArrayOutputStream outstr = new ByteArrayOutputStream();
MyObject obj1 = new MyObject(10);
hdlr.writeTo(obj1, obj1.getClass(), CLASS_OBJ, null, null, null, outstr);
@@ -95,7 +95,7 @@ public class GsonMessageBodyHandlerTest {
}
@Test
- public void testWriteTo_DifferentTypes() throws Exception {
+ void testWriteTo_DifferentTypes() throws Exception {
ByteArrayOutputStream outstr = new ByteArrayOutputStream();
// use a derived type, but specify the base type when writing
@@ -108,7 +108,7 @@ public class GsonMessageBodyHandlerTest {
}
@Test
- public void testIsReadable() {
+ void testIsReadable() {
// null media type
assertTrue(hdlr.isReadable(null, null, null, null));
@@ -116,7 +116,7 @@ public class GsonMessageBodyHandlerTest {
assertFalse(hdlr.isReadable(null, null, null, new MediaType(GEN_TYPE, null)));
for (String subtype : subtypes) {
- assertTrue("readable " + subtype, hdlr.isReadable(null, null, null, new MediaType(GEN_TYPE, subtype)));
+ assertTrue(hdlr.isReadable(null, null, null, new MediaType(GEN_TYPE, subtype)), "readable " + subtype);
}
@@ -130,7 +130,7 @@ public class GsonMessageBodyHandlerTest {
}
@Test
- public void testReadFrom_DifferentTypes() throws Exception {
+ void testReadFrom_DifferentTypes() throws Exception {
ByteArrayOutputStream outstr = new ByteArrayOutputStream();
MyObject obj1 = new MyObject(10);
hdlr.writeTo(obj1, obj1.getClass(), CLASS_OBJ, null, null, null, outstr);
@@ -148,7 +148,7 @@ public class GsonMessageBodyHandlerTest {
}
@Test
- public void testMapDouble() throws Exception {
+ void testMapDouble() throws Exception {
MyMap map = new MyMap();
map.props = new HashMap<>();
map.props.put("plainString", "def");
@@ -171,7 +171,7 @@ public class GsonMessageBodyHandlerTest {
}
@Test
- public void testInterestingFields() throws IOException {
+ void testInterestingFields() throws IOException {
InterestingFields data = new InterestingFields();
data.instant = Instant.ofEpochMilli(1583249713500L);
data.uuid = UUID.fromString("a850cb9f-3c5e-417c-abfd-0679cdcd1ab0");
diff --git a/gson/src/test/java/org/onap/policy/common/gson/InstantAsMillisTypeAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/InstantAsMillisTypeAdapterTest.java
index c48919a7..f2ddf06a 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/InstantAsMillisTypeAdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/InstantAsMillisTypeAdapterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,20 +22,20 @@
package org.onap.policy.common.gson;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.time.Instant;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class InstantAsMillisTypeAdapterTest {
+class InstantAsMillisTypeAdapterTest {
private static Gson gson =
new GsonBuilder().registerTypeAdapter(Instant.class, new InstantAsMillisTypeAdapter()).create();
@Test
- public void test() {
+ void test() {
InterestingFields data = new InterestingFields();
data.instant = Instant.ofEpochMilli(1583249713500L);
diff --git a/gson/src/test/java/org/onap/policy/common/gson/InstantTypeAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/InstantTypeAdapterTest.java
index 68f54ed8..2e27d1dc 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/InstantTypeAdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/InstantTypeAdapterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,21 +23,21 @@ package org.onap.policy.common.gson;
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.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import java.time.Instant;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class InstantTypeAdapterTest {
+class InstantTypeAdapterTest {
private static Gson gson =
new GsonBuilder().registerTypeAdapter(Instant.class, new InstantTypeAdapter()).create();
@Test
- public void test() {
+ void test() {
InterestingFields data = new InterestingFields();
data.instant = Instant.ofEpochMilli(1583249713500L);
diff --git a/gson/src/test/java/org/onap/policy/common/gson/JacksonExclusionStrategyTest.java b/gson/src/test/java/org/onap/policy/common/gson/JacksonExclusionStrategyTest.java
index 9d8d3495..38f2f32a 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/JacksonExclusionStrategyTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/JacksonExclusionStrategyTest.java
@@ -3,7 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
- * Modificaitons Copyright (C) 2023 Nordix Foundation.
+ * Modificaitons Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +21,9 @@
package org.onap.policy.common.gson;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
@@ -33,22 +33,22 @@ import java.lang.reflect.GenericArrayType;
import java.util.LinkedList;
import java.util.TreeMap;
import lombok.ToString;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
-public class JacksonExclusionStrategyTest {
+class JacksonExclusionStrategyTest {
private static JacksonExclusionStrategy strategy;
private static Gson gson;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() {
strategy = new JacksonExclusionStrategy();
gson = new GsonBuilder().setExclusionStrategies(strategy).create();
}
@Test
- public void testWithGson() {
+ void testWithGson() {
Derived data = new Derived();
data.setId(10);
data.setText("some text");
@@ -65,7 +65,7 @@ public class JacksonExclusionStrategyTest {
}
@Test
- public void testShouldSkipField() throws Exception {
+ void testShouldSkipField() throws Exception {
// should skip every field of Data
assertTrue(strategy.shouldSkipField(new FieldAttributes(Data.class.getDeclaredField("id"))));
assertTrue(strategy.shouldSkipField(new FieldAttributes(Data.class.getDeclaredField("text"))));
@@ -75,18 +75,18 @@ public class JacksonExclusionStrategyTest {
}
@Test
- public void testShouldSkipClass() {
+ void testShouldSkipClass() {
assertFalse(strategy.shouldSkipClass(null));
assertFalse(strategy.shouldSkipClass(Object.class));
}
@Test
- public void testIsManaged() {
+ void testIsManaged() {
// these classes SHOULD be managed
Class<?>[] managed = {Data.class, Intfc.class, com.google.gson.TypeAdapter.class};
for (Class<?> clazz : managed) {
- assertTrue(clazz.getName(), JacksonExclusionStrategy.isManaged(clazz));
+ assertTrue(JacksonExclusionStrategy.isManaged(clazz), clazz.getName());
}
// generic classes should NOT be managed
@@ -97,7 +97,7 @@ public class JacksonExclusionStrategyTest {
MyMap.class, MyList.class, MyJson.class, GenericArrayType.class};
for (Class<?> clazz : unmanaged) {
- assertFalse(clazz.getName(), JacksonExclusionStrategy.isManaged(clazz));
+ assertFalse(JacksonExclusionStrategy.isManaged(clazz), clazz.getName());
}
}
@@ -113,7 +113,7 @@ public class JacksonExclusionStrategyTest {
return id;
}
- public void setId(int id) {
+ void setId(int id) {
this.id = id;
}
@@ -121,7 +121,7 @@ public class JacksonExclusionStrategyTest {
return text;
}
- public void setText(String text) {
+ void setText(String text) {
this.text = text;
}
}
@@ -134,7 +134,7 @@ public class JacksonExclusionStrategyTest {
return value;
}
- public void setValue(String value) {
+ void setValue(String value) {
this.value = value;
}
}
diff --git a/gson/src/test/java/org/onap/policy/common/gson/JacksonFieldAdapterFactoryTest.java b/gson/src/test/java/org/onap/policy/common/gson/JacksonFieldAdapterFactoryTest.java
index dc62186b..65bf90f0 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/JacksonFieldAdapterFactoryTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/JacksonFieldAdapterFactoryTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +21,10 @@
package org.onap.policy.common.gson;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -32,11 +33,11 @@ import com.google.gson.reflect.TypeToken;
import java.util.ArrayList;
import java.util.List;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.gson.annotation.GsonJsonIgnore;
import org.onap.policy.common.gson.annotation.GsonJsonProperty;
-public class JacksonFieldAdapterFactoryTest {
+class JacksonFieldAdapterFactoryTest {
private static JacksonFieldAdapterFactory factory = new JacksonFieldAdapterFactory();
@@ -44,7 +45,7 @@ public class JacksonFieldAdapterFactoryTest {
.registerTypeAdapterFactory(factory).create();
@Test
- public void testCreate() {
+ void testCreate() {
// unhandled types
assertNull(factory.create(gson, TypeToken.get(JsonElement.class)));
assertNull(factory.create(gson, TypeToken.get(NothingToSerialize.class)));
@@ -83,7 +84,7 @@ public class JacksonFieldAdapterFactoryTest {
}
@Test
- public void testCreate_Lists() {
+ void testCreate_Lists() {
DataList lst = new DataList();
lst.theList = new ArrayList<>();
lst.theList.add(new Data(200, "text 20"));
@@ -99,7 +100,7 @@ public class JacksonFieldAdapterFactoryTest {
}
@Test
- public void testCreate_OnlyOutProps() {
+ void testCreate_OnlyOutProps() {
InFieldIgnored data = new InFieldIgnored();
data.value = "out only";
@@ -113,7 +114,7 @@ public class JacksonFieldAdapterFactoryTest {
}
@Test
- public void testCreate_OnlyInProps() {
+ void testCreate_OnlyInProps() {
OutFieldIgnored data = new OutFieldIgnored();
data.value = "in only";
@@ -154,7 +155,7 @@ public class JacksonFieldAdapterFactoryTest {
this.text = text;
}
- public void setId(int id) {
+ void setId(int id) {
this.id = id;
}
}
diff --git a/gson/src/test/java/org/onap/policy/common/gson/JacksonHandlerTest.java b/gson/src/test/java/org/onap/policy/common/gson/JacksonHandlerTest.java
index 7131817d..316104c5 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/JacksonHandlerTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/JacksonHandlerTest.java
@@ -3,7 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +21,9 @@
package org.onap.policy.common.gson;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
@@ -35,14 +35,14 @@ import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.gson.annotation.GsonJsonAnyGetter;
import org.onap.policy.common.gson.annotation.GsonJsonAnySetter;
-public class JacksonHandlerTest {
+class JacksonHandlerTest {
@Test
- public void test() throws Exception {
+ void test() throws Exception {
JacksonHandler hdlr = new JacksonHandler();
assertTrue(hdlr.isReadable(null, null, null, MediaType.APPLICATION_JSON_TYPE));
@@ -85,7 +85,7 @@ public class JacksonHandlerTest {
}
@Test
- public void testMapDouble() throws Exception {
+ void testMapDouble() throws Exception {
MyMap map = new MyMap();
map.props = new HashMap<>();
map.props.put("plainString", "def");
diff --git a/gson/src/test/java/org/onap/policy/common/gson/JacksonMethodAdapterFactoryTest.java b/gson/src/test/java/org/onap/policy/common/gson/JacksonMethodAdapterFactoryTest.java
index 7afb0e5a..41996941 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/JacksonMethodAdapterFactoryTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/JacksonMethodAdapterFactoryTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +21,11 @@
package org.onap.policy.common.gson;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -33,13 +34,13 @@ import com.google.gson.reflect.TypeToken;
import java.util.Map;
import java.util.TreeMap;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.gson.annotation.GsonJsonAnyGetter;
import org.onap.policy.common.gson.annotation.GsonJsonAnySetter;
import org.onap.policy.common.gson.annotation.GsonJsonIgnore;
import org.onap.policy.common.gson.annotation.GsonJsonProperty;
-public class JacksonMethodAdapterFactoryTest {
+class JacksonMethodAdapterFactoryTest {
private static JacksonMethodAdapterFactory factory = new JacksonMethodAdapterFactory();
@@ -47,7 +48,7 @@ public class JacksonMethodAdapterFactoryTest {
.registerTypeAdapterFactory(factory).create();
@Test
- public void testCreate() {
+ void testCreate() {
// unhandled types
assertNull(factory.create(gson, TypeToken.get(JsonElement.class)));
assertNull(factory.create(gson, TypeToken.get(NothingToSerialize.class)));
@@ -101,8 +102,8 @@ public class JacksonMethodAdapterFactoryTest {
dblget.overMap.put("getB", 110);
String result2 = gson.toJson(dblget);
- dblget.overMap.keySet().forEach(key -> assertTrue("over contains " + key, result2.contains(key)));
- der.map.keySet().forEach(key -> assertFalse("sub contains " + key, result2.contains(key)));
+ dblget.overMap.keySet().forEach(key -> assertTrue(result2.contains(key), "over contains " + key));
+ der.map.keySet().forEach(key -> assertFalse(result2.contains(key), "sub contains " + key));
// override of AnySetter
Map<String, Integer> map = new TreeMap<>();
diff --git a/gson/src/test/java/org/onap/policy/common/gson/LocalDateTimeTypeAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/LocalDateTimeTypeAdapterTest.java
index 2778a4ba..87f3c46d 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/LocalDateTimeTypeAdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/LocalDateTimeTypeAdapterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,21 +23,21 @@ package org.onap.policy.common.gson;
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.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import java.time.LocalDateTime;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class LocalDateTimeTypeAdapterTest {
+class LocalDateTimeTypeAdapterTest {
private static Gson gson =
new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeTypeAdapter()).create();
@Test
- public void test() {
+ void test() {
InterestingFields data = new InterestingFields();
data.date = LocalDateTime.of(2020, 2, 3, 4, 5, 6, 789000000);
diff --git a/gson/src/test/java/org/onap/policy/common/gson/LocalDateTypeAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/LocalDateTypeAdapterTest.java
index 17acf5e6..b62a19b6 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/LocalDateTypeAdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/LocalDateTypeAdapterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,22 +23,22 @@ package org.onap.policy.common.gson;
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.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import java.time.LocalDate;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class LocalDateTypeAdapterTest {
+class LocalDateTypeAdapterTest {
private static Gson gson =
new GsonBuilder().registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()).create();
private static final String TEST_DATE = "2020-01-01";
@Test
- public void test() {
+ void test() {
InterestingFields data = new InterestingFields();
data.date = LocalDate.parse(TEST_DATE);
diff --git a/gson/src/test/java/org/onap/policy/common/gson/MapDoubleAdapterFactoryTest.java b/gson/src/test/java/org/onap/policy/common/gson/MapDoubleAdapterFactoryTest.java
index 30d99466..048e09e5 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/MapDoubleAdapterFactoryTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/MapDoubleAdapterFactoryTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +21,8 @@
package org.onap.policy.common.gson;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -30,14 +31,14 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class MapDoubleAdapterFactoryTest {
+class MapDoubleAdapterFactoryTest {
private static Gson gson = new GsonBuilder().registerTypeAdapterFactory(new MapDoubleAdapterFactory()).create();
@Test
@SuppressWarnings("unchecked")
- public void testMap() {
+ void testMap() {
MyMap map = new MyMap();
map.data = new HashMap<>();
map.data.put("plainString", "def");
@@ -71,7 +72,7 @@ public class MapDoubleAdapterFactoryTest {
}
@Test
- public void testList() {
+ void testList() {
MyList list = new MyList();
list.data = new ArrayList<>();
list.data.add("ghi");
@@ -93,7 +94,7 @@ public class MapDoubleAdapterFactoryTest {
}
@Test
- public void test_ValueIsNotObject() {
+ void test_ValueIsNotObject() {
MyDoubleMap map = new MyDoubleMap();
map.data = new LinkedHashMap<>();
map.data.put("plainDouble", 13.5);
@@ -110,7 +111,7 @@ public class MapDoubleAdapterFactoryTest {
}
@Test
- public void test_KeyIsNotString() {
+ void test_KeyIsNotString() {
MyObjectMap map = new MyObjectMap();
map.data = new LinkedHashMap<>();
@@ -128,7 +129,7 @@ public class MapDoubleAdapterFactoryTest {
}
@Test
- public void test_ListValueIsNotObject() {
+ void test_ListValueIsNotObject() {
MyDoubleList list = new MyDoubleList();
list.data = new ArrayList<>();
list.data.add(13.5);
diff --git a/gson/src/test/java/org/onap/policy/common/gson/OffsetDateTimeAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/OffsetDateTimeAdapterTest.java
index a0bcb1b2..33212b89 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/OffsetDateTimeAdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/OffsetDateTimeAdapterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,22 +23,22 @@ package org.onap.policy.common.gson;
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.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import java.time.OffsetDateTime;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class OffsetDateTimeAdapterTest {
+class OffsetDateTimeAdapterTest {
private static Gson gson =
new GsonBuilder().registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeTypeAdapter()).create();
private static final String TEST_DATE = "2020-01-01T12:00:00.999+05:00";
@Test
- public void test() {
+ void test() {
InterestingFields data = new InterestingFields();
data.date = OffsetDateTime.parse(TEST_DATE);
diff --git a/gson/src/test/java/org/onap/policy/common/gson/OffsetTimeTypeAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/OffsetTimeTypeAdapterTest.java
index 8098af98..27f179f1 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/OffsetTimeTypeAdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/OffsetTimeTypeAdapterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,22 +23,22 @@ package org.onap.policy.common.gson;
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.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import java.time.OffsetTime;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class OffsetTimeTypeAdapterTest {
+class OffsetTimeTypeAdapterTest {
private static Gson gson =
new GsonBuilder().registerTypeAdapter(OffsetTime.class, new OffsetTimeTypeAdapter()).create();
private static final String TEST_TIME = "12:00:00.999+05:00";
@Test
- public void test() {
+ void test() {
InterestingFields data = new InterestingFields();
data.time = OffsetTime.parse(TEST_TIME);
diff --git a/gson/src/test/java/org/onap/policy/common/gson/StringTypeAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/StringTypeAdapterTest.java
index f35677cd..a2027512 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/StringTypeAdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/StringTypeAdapterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +23,7 @@ package org.onap.policy.common.gson;
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.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -30,15 +31,15 @@ import com.google.gson.JsonParseException;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class StringTypeAdapterTest {
+class StringTypeAdapterTest {
private static Gson gson = new GsonBuilder().registerTypeAdapter(MyData.class, new MyAdapter()).create();
private static final int TEST_NUM1 = 10;
private static final int TEST_NUM3 = 30;
@Test
- public void test() {
+ void test() {
InterestingFields data = new InterestingFields();
data.data1 = new MyData(TEST_NUM1);
data.data2 = null;
diff --git a/gson/src/test/java/org/onap/policy/common/gson/ZoneOffsetTypeAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/ZoneOffsetTypeAdapterTest.java
index d9a33169..a334c307 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/ZoneOffsetTypeAdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/ZoneOffsetTypeAdapterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,22 +23,22 @@ package org.onap.policy.common.gson;
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.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import java.time.ZoneOffset;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class ZoneOffsetTypeAdapterTest {
+class ZoneOffsetTypeAdapterTest {
private static Gson gson =
new GsonBuilder().registerTypeAdapter(ZoneOffset.class, new ZoneOffsetTypeAdapter()).create();
private static final String TEST_ZONE = "+05:00";
@Test
- public void test() {
+ void test() {
InterestingFields data = new InterestingFields();
data.zone = ZoneOffset.of(TEST_ZONE);
diff --git a/gson/src/test/java/org/onap/policy/common/gson/ZonedDateTimeTypeAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/ZonedDateTimeTypeAdapterTest.java
index 032533eb..bf534a5c 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/ZonedDateTimeTypeAdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/ZonedDateTimeTypeAdapterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +23,7 @@ package org.onap.policy.common.gson;
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.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -30,14 +31,14 @@ import com.google.gson.JsonParseException;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import lombok.ToString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class ZonedDateTimeTypeAdapterTest {
+class ZonedDateTimeTypeAdapterTest {
private static Gson gson =
new GsonBuilder().registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeTypeAdapter()).create();
@Test
- public void test() {
+ void test() {
InterestingFields data = new InterestingFields();
data.date = ZonedDateTime.of(2020, 2, 3, 4, 5, 6, 789000000, ZoneId.of("US/Eastern"));
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/AdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/AdapterTest.java
index fd999951..ebe2b727 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/AdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/AdapterTest.java
@@ -3,7 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +21,9 @@
package org.onap.policy.common.gson.internal;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -35,9 +35,9 @@ import com.google.gson.JsonPrimitive;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.gson.JacksonExclusionStrategy;
import org.onap.policy.common.gson.annotation.GsonJsonProperty;
import org.onap.policy.common.gson.internal.Adapter.Factory;
@@ -45,7 +45,7 @@ import org.onap.policy.common.gson.internal.DataAdapterFactory.Data;
import org.onap.policy.common.gson.internal.DataAdapterFactory.DerivedData;
import org.springframework.test.util.ReflectionTestUtils;
-public class AdapterTest {
+class AdapterTest {
private static final String GET_INVALID_NAME = "get$InvalidName";
private static final String SET_INVALID_NAME = "set$InvalidName";
private static final String EMPTY_ALIAS = "emptyAlias";
@@ -82,18 +82,18 @@ public class AdapterTest {
private Data dataField;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() {
saveFactory = (Factory) ReflectionTestUtils.getField(Adapter.class, FACTORY_FIELD);
}
- @After
- public void tearDown() {
+ @AfterEach
+ void tearDown() {
ReflectionTestUtils.setField(Adapter.class, FACTORY_FIELD, saveFactory);
}
@Test
- public void testIsManagedField() {
+ void testIsManagedField() {
assertTrue(Adapter.isManaged(field(VALUE_NAME)));
// return an invalid field name
@@ -104,7 +104,7 @@ public class AdapterTest {
}
@Test
- public void testIsManagedMethod() {
+ void testIsManagedMethod() {
assertTrue(Adapter.isManaged(mget(GET_VALUE_NAME)));
// return an invalid method name
@@ -119,7 +119,7 @@ public class AdapterTest {
}
@Test
- public void testAdapterField_Converter() {
+ void testAdapterField_Converter() {
Adapter adapter = new Adapter(gson, field("dataField"));
// first, write something of type Data
@@ -137,7 +137,7 @@ public class AdapterTest {
@Test
@SuppressWarnings("unchecked")
- public void testAdapterField_Converter_List() {
+ void testAdapterField_Converter_List() {
listField = DataAdapterFactory.makeList();
Adapter adapter = new Adapter(gson, field("listField"));
@@ -168,7 +168,7 @@ public class AdapterTest {
}
@Test
- public void testAdapterMethod_Converter() throws Exception {
+ void testAdapterMethod_Converter() throws Exception {
listField = DataAdapterFactory.makeList();
Method getter = mget("getMyList");
@@ -192,7 +192,7 @@ public class AdapterTest {
}
@Test
- public void testGetPropName_testGetFullName_testMakeError() {
+ void testGetPropName_testGetFullName_testMakeError() {
// test field
Adapter adapter = new Adapter(gson, field(VALUE_NAME));
@@ -217,7 +217,7 @@ public class AdapterTest {
}
@Test
- public void testToJsonTree() {
+ void testToJsonTree() {
Adapter adapter = new Adapter(gson, field(VALUE_NAME));
JsonElement tree = adapter.toJsonTree("hello");
@@ -226,14 +226,14 @@ public class AdapterTest {
}
@Test
- public void testFromJsonTree() {
+ void testFromJsonTree() {
Adapter adapter = new Adapter(gson, field(VALUE_NAME));
assertEquals("world", adapter.fromJsonTree(new JsonPrimitive("world")));
}
@Test
- public void testDetmPropName() {
+ void testDetmPropName() {
assertEquals(EMPTY_ALIAS, Adapter.detmPropName(field(EMPTY_ALIAS)));
assertEquals("name-with-alias", Adapter.detmPropName(field("nameWithAlias")));
assertEquals("unaliased", Adapter.detmPropName(field("unaliased")));
@@ -246,7 +246,7 @@ public class AdapterTest {
}
@Test
- public void testDetmGetterPropName() {
+ void testDetmGetterPropName() {
assertEquals(EMPTY_ALIAS, Adapter.detmGetterPropName(mget("getEmptyAlias")));
assertEquals("get-with-alias", Adapter.detmGetterPropName(mget("getWithAlias")));
assertEquals("plain", Adapter.detmGetterPropName(mget("getPlain")));
@@ -265,7 +265,7 @@ public class AdapterTest {
}
@Test
- public void testDetmSetterPropName() {
+ void testDetmSetterPropName() {
assertEquals(EMPTY_ALIAS, Adapter.detmSetterPropName(mset("setEmptyAlias")));
assertEquals("set-with-alias", Adapter.detmSetterPropName(mset("setWithAlias")));
assertEquals("plain", Adapter.detmSetterPropName(mset("setPlain")));
@@ -281,12 +281,12 @@ public class AdapterTest {
}
@Test
- public void testGetQualifiedNameField() throws Exception {
+ void testGetQualifiedNameField() throws Exception {
assertEquals(MY_NAME + ".value", Adapter.getQualifiedName(AdapterTest.class.getDeclaredField(VALUE_NAME)));
}
@Test
- public void testGetQualifiedNameMethod() {
+ void testGetQualifiedNameMethod() {
assertEquals(MY_NAME + GET_VALUE, Adapter.getQualifiedName(mget(GET_VALUE_NAME)));
}
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/AnyGetterSerializerTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/AnyGetterSerializerTest.java
index f68e3e3e..1e206cf5 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/AnyGetterSerializerTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/AnyGetterSerializerTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +22,8 @@
package org.onap.policy.common.gson.internal;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -33,12 +34,12 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.gson.JacksonExclusionStrategy;
import org.onap.policy.common.gson.internal.DataAdapterFactory.Data;
-public class AnyGetterSerializerTest {
+class AnyGetterSerializerTest {
private static DataAdapterFactory dataAdapter = new DataAdapterFactory();
@@ -53,14 +54,14 @@ public class AnyGetterSerializerTest {
*
* @throws Exception if an error occurs
*/
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
set = new HashSet<>(Arrays.asList("id", "value"));
ser = new AnyGetterSerializer(gson, set, MapData.class.getDeclaredMethod("getTheMap"));
}
@Test
- public void testAddToTree_testCopyLiftedItems() {
+ void testAddToTree_testCopyLiftedItems() {
JsonObject tree = new JsonObject();
tree.addProperty("hello", "world");
@@ -83,7 +84,7 @@ public class AnyGetterSerializerTest {
}
@Test
- public void testAddToTree_NullMap() {
+ void testAddToTree_NullMap() {
JsonObject tree = new JsonObject();
tree.addProperty("hello", "world");
@@ -98,7 +99,7 @@ public class AnyGetterSerializerTest {
}
@Test
- public void testAddToTree_NotAnObject() throws Exception {
+ void testAddToTree_NotAnObject() throws Exception {
ser = new AnyGetterSerializer(gson, set, NotAnObject.class.getDeclaredMethod("getNonMap"));
JsonObject tree = new JsonObject();
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/AnySetterDeserializerTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/AnySetterDeserializerTest.java
index c03e3695..d833925b 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/AnySetterDeserializerTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/AnySetterDeserializerTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,9 +21,9 @@
package org.onap.policy.common.gson.internal;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -33,12 +34,12 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.gson.JacksonExclusionStrategy;
import org.onap.policy.common.gson.internal.DataAdapterFactory.Data;
-public class AnySetterDeserializerTest {
+class AnySetterDeserializerTest {
private static DataAdapterFactory dataAdapter = new DataAdapterFactory();
@@ -53,15 +54,15 @@ public class AnySetterDeserializerTest {
*
* @throws Exception if an error occurs
*/
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
set = new HashSet<>(Arrays.asList("id", "value"));
deser = new AnySetterDeserializer(gson, set,
MapData.class.getDeclaredMethod("setItem", String.class, List.class));
}
@Test
- public void testAnySetterDeserializer() {
+ void testAnySetterDeserializer() {
JsonObject json = new JsonObject();
// these should not be copied
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/ClassWalkerTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/ClassWalkerTest.java
index a1350643..ee55c626 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/ClassWalkerTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/ClassWalkerTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +22,9 @@
package org.onap.policy.common.gson.internal;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import com.google.gson.JsonParseException;
import java.lang.reflect.Field;
@@ -36,14 +37,14 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.stream.Collectors;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.gson.annotation.GsonJsonAnyGetter;
import org.onap.policy.common.gson.annotation.GsonJsonAnySetter;
import org.onap.policy.common.gson.annotation.GsonJsonIgnore;
import org.onap.policy.common.gson.annotation.GsonJsonProperty;
-public class ClassWalkerTest {
+class ClassWalkerTest {
private static final String SET_OVERRIDE = ".setOverride";
private static final String INVALID_FIELD_NAME = "invalidFieldName";
@@ -53,13 +54,13 @@ public class ClassWalkerTest {
/**
* Set up.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
walker = new MyWalker();
}
@Test
- public void testExamineClassOfQ_testExamineField_testExamineInField_testExamineOutField() {
+ void testExamineClassOfQ_testExamineField_testExamineInField_testExamineOutField() {
walker.walkClassHierarchy(DerivedFromBottom.class);
assertEquals("[Intfc1, Intfc2, Intfc1, Intfc3, Bottom, DerivedFromBottom]", walker.classes.toString());
@@ -79,7 +80,7 @@ public class ClassWalkerTest {
}
@Test
- public void testHasAnyGetter() {
+ void testHasAnyGetter() {
walker.walkClassHierarchy(Object.class);
assertNull(walker.getAnyGetter());
assertNull(walker.getAnySetter());
@@ -94,7 +95,7 @@ public class ClassWalkerTest {
}
@Test
- public void testHasAnySetter() {
+ void testHasAnySetter() {
walker.walkClassHierarchy(Object.class);
assertNull(walker.getAnySetter());
assertNull(walker.getAnyGetter());
@@ -109,7 +110,7 @@ public class ClassWalkerTest {
}
@Test
- public void testExamineMethod() {
+ void testExamineMethod() {
walker.walkClassHierarchy(DerivedFromData.class);
assertEquals("[Data, DerivedFromData]", walker.classes.toString());
@@ -161,7 +162,7 @@ public class ClassWalkerTest {
}
@Test
- public void testExamineMethod_AnyGetter() {
+ void testExamineMethod_AnyGetter() {
walker.walkClassHierarchy(AnyGetterOverride.class);
assertNotNull(walker.getAnyGetter());
@@ -169,7 +170,7 @@ public class ClassWalkerTest {
}
@Test
- public void testExamineMethod_AnySetter() {
+ void testExamineMethod_AnySetter() {
walker.walkClassHierarchy(AnySetterOverride.class);
assertNotNull(walker.getAnySetter());
@@ -177,7 +178,7 @@ public class ClassWalkerTest {
}
@Test
- public void testGetInNotIgnored_testGetOutNotIgnored() {
+ void testGetInNotIgnored_testGetOutNotIgnored() {
walker.walkClassHierarchy(DerivedFromData.class);
assertEquals("[id, onlyIn, text, value]", new TreeSet<>(walker.getInNotIgnored()).toString());
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/FieldDeserializerTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/FieldDeserializerTest.java
index acb241e6..8f783bcb 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/FieldDeserializerTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/FieldDeserializerTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +22,8 @@
package org.onap.policy.common.gson.internal;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -31,11 +32,11 @@ import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.gson.JacksonExclusionStrategy;
import org.onap.policy.common.gson.internal.DataAdapterFactory.Data;
-public class FieldDeserializerTest {
+class FieldDeserializerTest {
private static final String TEXT_FIELD_NAME = "text";
private static final String LIST_FIELD_NAME = "listField";
private static final String INITIAL_VALUE = "initial value";
@@ -53,7 +54,7 @@ public class FieldDeserializerTest {
private List<Data> listField;
@Test
- public void testGetFromTree() throws Exception {
+ void testGetFromTree() throws Exception {
deser = new FieldDeserializer(gson, FieldDeserializerTest.class.getDeclaredField(TEXT_FIELD_NAME));
JsonObject json = new JsonObject();
@@ -90,7 +91,7 @@ public class FieldDeserializerTest {
}
@Test
- public void testGetFromTree_SetEx() throws Exception {
+ void testGetFromTree_SetEx() throws Exception {
deser = new FieldDeserializer(gson, FieldDeserializerTest.class.getDeclaredField(TEXT_FIELD_NAME)) {
@Override
public Object fromJsonTree(JsonElement tree) {
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/FieldSerializerTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/FieldSerializerTest.java
index 156e4ef3..a55d9908 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/FieldSerializerTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/FieldSerializerTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +22,8 @@
package org.onap.policy.common.gson.internal;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -30,11 +31,11 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.gson.JacksonExclusionStrategy;
import org.onap.policy.common.gson.internal.DataAdapterFactory.Data;
-public class FieldSerializerTest {
+class FieldSerializerTest {
private static final String TEXT_FIELD_NAME = "text";
private static final String LIST_FIELD_NAME = "listField";
@@ -79,7 +80,7 @@ public class FieldSerializerTest {
}
@Test
- public void testAddToTree_GetEx() throws Exception {
+ void testAddToTree_GetEx() throws Exception {
ser = new FieldSerializer(gson, FieldSerializerTest.class.getDeclaredField(TEXT_FIELD_NAME)) {
@Override
protected Object getFromObject(Object source) throws IllegalAccessException {
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/JacksonTypeAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/JacksonTypeAdapterTest.java
index 5e73d06e..e2d350ec 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/JacksonTypeAdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/JacksonTypeAdapterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@
package org.onap.policy.common.gson.internal;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -34,10 +35,10 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import lombok.ToString;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-public class JacksonTypeAdapterTest {
+class JacksonTypeAdapterTest {
private static final String HELLO = "hello";
private static final String WORLD = "world";
@@ -53,8 +54,8 @@ public class JacksonTypeAdapterTest {
/**
* Initializes the previously defined fields.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
// create list of serializers, one for "id" and one for "value"
sers = new ArrayList<>(2);
sers.add(new NamedSer(HELLO) {
@@ -91,7 +92,7 @@ public class JacksonTypeAdapterTest {
}
@Test
- public void testWriteJsonWriterT() throws Exception {
+ void testWriteJsonWriterT() throws Exception {
Data data = new Data("abc", "def");
StringWriter wtr = new StringWriter();
@@ -106,7 +107,7 @@ public class JacksonTypeAdapterTest {
* @throws Exception if an error occurs
*/
@Test
- public void testWriteJsonWriterT_NotAnObject() throws Exception {
+ void testWriteJsonWriterT_NotAnObject() throws Exception {
TypeAdapter<String> delegate = gson.getAdapter(String.class);
JacksonTypeAdapter<String> stringAdapter = new JacksonTypeAdapter<>(gson, delegate, sers, desers);
@@ -117,7 +118,7 @@ public class JacksonTypeAdapterTest {
}
@Test
- public void testReadJsonReader() throws Exception {
+ void testReadJsonReader() throws Exception {
Data data = adapter
.read(new JsonReader(new StringReader("{'hello':'four','world':'score'}".replace('\'', '"'))));
@@ -130,7 +131,7 @@ public class JacksonTypeAdapterTest {
* @throws Exception if an error occurs
*/
@Test
- public void testReadJsonReader_NotAnObject() throws Exception {
+ void testReadJsonReader_NotAnObject() throws Exception {
TypeAdapter<String> delegate = gson.getAdapter(String.class);
JacksonTypeAdapter<String> stringAdapter = new JacksonTypeAdapter<>(gson, delegate, sers, desers);
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/LifterTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/LifterTest.java
index e0b9eb30..e83757b6 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/LifterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/LifterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,21 +21,21 @@
package org.onap.policy.common.gson.internal;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.gson.Gson;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class LifterTest {
+class LifterTest {
private static Gson gson = new Gson();
@Test
- public void testLifter_testShouldLift() throws Exception {
+ void testLifter_testShouldLift() throws Exception {
Set<String> set = new HashSet<>(Arrays.asList("abc", "def"));
Lifter lifter = new Lifter(gson, set, LifterTest.class.getDeclaredMethod("getValue"), String.class);
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodAdapterTest.java
index 6c13865d..17a184a3 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodAdapterTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodAdapterTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,19 +22,19 @@
package org.onap.policy.common.gson.internal;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.JsonParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class MethodAdapterTest {
+class MethodAdapterTest {
private static final Gson gson = new Gson();
private String saved;
@Test
- public void testMethodAdapter_testInvoke() throws Exception {
+ void testMethodAdapter_testInvoke() throws Exception {
MethodAdapter adapter =
new MethodAdapter(gson, MethodAdapterTest.class.getDeclaredMethod("getValue"), String.class);
assertEquals("hello", adapter.invoke(this));
@@ -51,7 +52,7 @@ public class MethodAdapterTest {
return "hello";
}
- public void setValue(String val) {
+ void setValue(String val) {
saved = val;
}
}
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodDeserializerTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodDeserializerTest.java
index 7fcfca18..60fe7a0a 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodDeserializerTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodDeserializerTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,20 +21,20 @@
package org.onap.policy.common.gson.internal;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.gson.JacksonExclusionStrategy;
import org.onap.policy.common.gson.internal.DataAdapterFactory.Data;
-public class MethodDeserializerTest {
+class MethodDeserializerTest {
private static final String PROP_NAME = "text";
private static final String METHOD_NAME = "setText";
private static final String INITIAL_VALUE = "initial value";
@@ -51,7 +52,7 @@ public class MethodDeserializerTest {
private List<Data> listField;
@Test
- public void testGetFromTree() throws Exception {
+ void testGetFromTree() throws Exception {
deser = new MethodDeserializer(gson, MethodDeserializerTest.class.getDeclaredMethod(METHOD_NAME, String.class));
// non-existent value - should not overwrite
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodSerializerTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodSerializerTest.java
index ed240513..ae41e08d 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodSerializerTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodSerializerTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,19 +21,19 @@
package org.onap.policy.common.gson.internal;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.gson.JacksonExclusionStrategy;
import org.onap.policy.common.gson.internal.DataAdapterFactory.Data;
-public class MethodSerializerTest {
+class MethodSerializerTest {
private static final String PROP_NAME = "text";
private static final String METHOD_NAME = "getText";
@@ -48,7 +49,7 @@ public class MethodSerializerTest {
private List<Data> listField;
@Test
- public void testAddToTree() throws Exception {
+ void testAddToTree() throws Exception {
ser = new MethodSerializer(gson, MethodSerializerTest.class.getDeclaredMethod(METHOD_NAME));
// serialize null value first
@@ -74,7 +75,7 @@ public class MethodSerializerTest {
JsonElement tree = ser.toJsonTree(listField);
assertTrue(dataAdapter.isDataWritten());
- assertEquals(DataAdapterFactory.ENCODED_LIST, tree.toString());
+ assertEquals(DataAdapterFactory.ENCODED_LIST, tree.toString());
}
protected String getText() {