aboutsummaryrefslogtreecommitdiffstats
path: root/testutil/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-04-12 08:30:35 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2024-04-12 08:39:04 +0200
commit76a89b62274060452022ddf24a7685ee2f380cb4 (patch)
treeef924603de22efd026f519ab31fd8f5a6ff60f2f /testutil/src
parent7e7ebf7b527be1f163d497a41898e2252d878fe7 (diff)
Replace all usages of Arrays.asList with List.of where possible.
Diffstat (limited to 'testutil/src')
-rw-r--r--testutil/src/main/java/com/yahoo/test/OrderTester.java3
-rw-r--r--testutil/src/test/java/com/yahoo/test/MatchersTestCase.java20
2 files changed, 8 insertions, 15 deletions
diff --git a/testutil/src/main/java/com/yahoo/test/OrderTester.java b/testutil/src/main/java/com/yahoo/test/OrderTester.java
index 391eb5c4ebd..6f83cd723b8 100644
--- a/testutil/src/main/java/com/yahoo/test/OrderTester.java
+++ b/testutil/src/main/java/com/yahoo/test/OrderTester.java
@@ -2,7 +2,6 @@
package com.yahoo.test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
/**
@@ -25,7 +24,7 @@ public abstract class OrderTester<T extends Comparable<? super T>> {
@SafeVarargs
@SuppressWarnings("varargs")
private OrderTester<T> addGroup(T... group) {
- groups.add(Arrays.asList(group));
+ groups.add(List.of(group));
return this;
}
diff --git a/testutil/src/test/java/com/yahoo/test/MatchersTestCase.java b/testutil/src/test/java/com/yahoo/test/MatchersTestCase.java
index 839856db7f2..c36818e4f7f 100644
--- a/testutil/src/test/java/com/yahoo/test/MatchersTestCase.java
+++ b/testutil/src/test/java/com/yahoo/test/MatchersTestCase.java
@@ -1,13 +1,14 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.test;
-import static org.junit.Assert.assertEquals;
-
-import java.util.Arrays;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import org.hamcrest.Matcher;
import org.junit.Test;
+import java.util.List;
+
/**
* Tests for com.yahoo.test.Matchers.
*
@@ -18,16 +19,9 @@ public class MatchersTestCase {
@Test
public final void testHasItemWithMethodObjectString() {
@SuppressWarnings("rawtypes")
- final Matcher<Iterable> m = Matchers.hasItemWithMethod("nalle",
- "toLowerCase");
- assertEquals(
- false,
- m.matches(Arrays.asList(new Object[] { Integer.valueOf(1),
- Character.valueOf('c'), "blbl" })));
- assertEquals(
- true,
- m.matches(Arrays.asList(new Object[] { Character.valueOf('c'),
- "NALLE" })));
+ final Matcher<Iterable> m = Matchers.hasItemWithMethod("nalle", "toLowerCase");
+ assertFalse(m.matches(List.of(new Object[]{1, 'c', "blbl"})));
+ assertTrue(m.matches(List.of(new Object[]{'c', "NALLE"})));
}
}