summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo
diff options
context:
space:
mode:
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo')
-rw-r--r--vespajlib/src/test/java/com/yahoo/collections/LazySetTest.java6
-rw-r--r--vespajlib/src/test/java/com/yahoo/io/reader/NamedReaderTestCase.java3
-rw-r--r--vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java4
-rw-r--r--vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java3
-rw-r--r--vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java5
5 files changed, 9 insertions, 12 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/collections/LazySetTest.java b/vespajlib/src/test/java/com/yahoo/collections/LazySetTest.java
index 8450c7986ef..4acd9ef3214 100644
--- a/vespajlib/src/test/java/com/yahoo/collections/LazySetTest.java
+++ b/vespajlib/src/test/java/com/yahoo/collections/LazySetTest.java
@@ -198,15 +198,15 @@ public class LazySetTest {
assertFalse(set.remove("foo"));
Mockito.verify(delegate).remove("foo");
- Collection<String> containsAllArg = Collections.singletonList("foo");
+ Collection<String> containsAllArg = Set.of("foo");
assertFalse(set.containsAll(containsAllArg));
Mockito.verify(delegate).containsAll(containsAllArg);
- Collection<String> retainAllArg = Collections.singletonList("foo");
+ Collection<String> retainAllArg = Set.of("foo");
assertFalse(set.retainAll(retainAllArg));
Mockito.verify(delegate).retainAll(retainAllArg);
- Collection<String> removeAllArg = Collections.singletonList("foo");
+ Collection<String> removeAllArg = Set.of("foo");
assertFalse(set.removeAll(removeAllArg));
Mockito.verify(delegate).removeAll(removeAllArg);
diff --git a/vespajlib/src/test/java/com/yahoo/io/reader/NamedReaderTestCase.java b/vespajlib/src/test/java/com/yahoo/io/reader/NamedReaderTestCase.java
index b1061fbc9ef..968746319d3 100644
--- a/vespajlib/src/test/java/com/yahoo/io/reader/NamedReaderTestCase.java
+++ b/vespajlib/src/test/java/com/yahoo/io/reader/NamedReaderTestCase.java
@@ -6,7 +6,6 @@ import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.Method;
import java.nio.CharBuffer;
-import java.util.Collections;
import java.util.List;
import com.yahoo.protect.ClassValidator;
@@ -30,7 +29,7 @@ public class NamedReaderTestCase {
assertEquals("test1",r.getName());
assertEquals("test1",r.toString());
assertEquals(stringReader,r.getReader());
- NamedReader.closeAll(Collections.singletonList(r));
+ NamedReader.closeAll(List.of(r));
NamedReader.closeAll(null); // noop, nor exception
}
diff --git a/vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java b/vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java
index 528ca57d256..b5d36326774 100644
--- a/vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java
+++ b/vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java
@@ -3,9 +3,9 @@ package com.yahoo.tensor;
import org.junit.Test;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
@@ -139,7 +139,7 @@ public class IndexedTensorTestCase {
Tensor.Builder builder = Tensor.Builder.of(type);
builder.cell(47.0, 98);
Tensor tensor = builder.build();
- assertEquals(47.0, tensor.sum(Collections.singletonList("x")).asDouble(), 0.000001);
+ assertEquals(47.0, tensor.sum(List.of("x")).asDouble(), 0.000001);
}
private void assertBuildingVWXYZ(TensorType type) {
diff --git a/vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java b/vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java
index 378e2397a89..6b0dbac8f2a 100644
--- a/vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java
+++ b/vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java
@@ -9,7 +9,6 @@ import com.yahoo.tensor.functions.Join;
import com.yahoo.tensor.functions.Reduce;
import com.yahoo.tensor.functions.TensorFunction;
-import java.util.Collections;
import java.util.List;
import java.util.Random;
@@ -69,7 +68,7 @@ public class MatrixDotProductBenchmark {
.value(random.nextDouble());
}
}
- return Collections.singletonList(builder.build());
+ return List.of(builder.build());
}
private static void addDimension(TensorType.Builder builder, String name, TensorType.Dimension.Type type, int size) {
diff --git a/vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java b/vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java
index 69fb71b9b0e..7a51ea300f4 100644
--- a/vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java
+++ b/vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java
@@ -11,7 +11,6 @@ import com.yahoo.tensor.functions.TensorFunction;
import org.junit.Test;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.DoubleBinaryOperator;
@@ -214,7 +213,7 @@ public class TensorTestCase {
Tensor unitK = Tensor.Builder.of(new TensorType.Builder().mapped("k").build()).cell().label("k", 0).value(1).build();
Tensor vectorInJSpace = vector(Type.mapped).multiply(unitJ);
Tensor matrixInKSpace = matrix(Type.mapped, 2).get(0).multiply(unitK);
- assertEquals("Generic computation implementation", 42, (int)dotProduct(vectorInJSpace, Collections.singletonList(matrixInKSpace)));
+ assertEquals("Generic computation implementation", 42, (int)dotProduct(vectorInJSpace, List.of(matrixInKSpace)));
}
@Test
@@ -458,7 +457,7 @@ public class TensorTestCase {
.value((i+1)*(j+1));
}
}
- return Collections.singletonList(builder.build());
+ return List.of(builder.build());
}
private TensorType vectorType(TensorType.Builder builder, String name, TensorType.Dimension.Type type, int size) {