From bd6500bf91fcd7fc1e1bbcf438bd4a4e7ff4a3c0 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Sun, 7 Apr 2019 10:50:27 -0400 Subject: Clean up a couple of array lists Initialized initial array size for empty list. Add some junit tests to ensure that the returned lists are mutable. Updated license in filter class. Change-Id: I9c151eb50355a71f4d34ac46b41f8278cf913664 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn --- .../src/test/java/org/onap/policy/models/base/PfUtilsTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'models-base/src/test') diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java index 11ddf3132..339ee9d1b 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java @@ -52,9 +52,19 @@ public class PfUtilsTest { }); assertTrue(resultList.isEmpty()); + // verify that we can modify the empty list without throwing an exception + resultList.add("xyz"); + resultList.add("pdq"); + resultList.remove("xyz"); + + List origList = Arrays.asList("abc", "def"); List newList = PfUtils.mapList(origList, text -> text + "X"); assertEquals(Arrays.asList("abcX", "defX"), newList); + + // verify that we can modify the list without throwing an exception + newList.remove("abcX"); + newList.add("something else"); } } -- cgit 1.2.3-korg