Use List.of() instead of Arrays.asList()/Lists 14/95714/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 8 Apr 2021 21:58:41 +0000 (23:58 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 8 Apr 2021 21:58:41 +0000 (23:58 +0200)
Java 11 has a nice List.of(), which we can use to make our code
a tad leaner.

Change-Id: I62ac055bd9273fac8632c79cf7d664c47c1303e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bundles-test-lib/src/test/java/org/opendaylight/odlparent/bundlestest/lib/ServiceReferenceUtilTest.java

index 90032f7066731291eca80cba186e5023c5808b5a..09b34745edd16da0ee4defd64087138af1974c74 100644 (file)
@@ -9,10 +9,9 @@ package org.opendaylight.odlparent.bundlestest.lib;
 
 import static com.google.common.truth.Truth.assertThat;
 
-import com.google.common.collect.Lists;
-import java.util.Arrays;
 import java.util.Dictionary;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
@@ -34,7 +33,7 @@ public class ServiceReferenceUtilTest {
     public void testGetProperties() {
         assertThat(new ServiceReferenceUtil().getProperties(getServiceReference())).containsExactly(
                 "property1", "value1",
-                "property2", Arrays.asList(new String[] { "value2.1", "value2.2" }),
+                "property2", List.of("value2.1", "value2.2"),
                 "property3", null);
     }
 
@@ -48,7 +47,7 @@ public class ServiceReferenceUtilTest {
 
         TestServiceReference() {
             properties.put("property1", "value1");
-            properties.put("property2", Lists.newArrayList("value2.1", "value2.2"));
+            properties.put("property2", List.of("value2.1", "value2.2"));
             properties.put("property3", null);
         }