summaryrefslogtreecommitdiffstats
path: root/vespajlib/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-04-11 11:07:11 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2024-04-11 11:07:11 +0200
commit5a4aa7df8f19d6672779f6d1ce78459e38e4d811 (patch)
treebf0813754eb80599680bdd18d072eedf6bb62a33 /vespajlib/src
parent42a9f71995b99044652bddf52ad869a824d98ddc (diff)
Fix failing annotator test and singletonMap => Map.of
Diffstat (limited to 'vespajlib/src')
-rw-r--r--vespajlib/src/test/java/com/yahoo/collections/LazyMapTest.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/collections/LazyMapTest.java b/vespajlib/src/test/java/com/yahoo/collections/LazyMapTest.java
index 940dc159a17..930b274ef3e 100644
--- a/vespajlib/src/test/java/com/yahoo/collections/LazyMapTest.java
+++ b/vespajlib/src/test/java/com/yahoo/collections/LazyMapTest.java
@@ -4,7 +4,6 @@ package com.yahoo.collections;
import org.junit.Test;
import org.mockito.Mockito;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -22,7 +21,6 @@ import static org.junit.Assert.fail;
* @author Simon Thoresen Hult
*/
public class LazyMapTest {
-
@Test
public void requireThatInitialDelegateIsEmpty() {
LazyMap<String, String> map = newLazyMap(new HashMap<String, String>());
@@ -36,14 +34,14 @@ public class LazyMapTest {
assertEquals(LazyMap.SingletonMap.class, map.getDelegate().getClass());
map = newLazyMap(new HashMap<String, String>());
- map.putAll(Collections.singletonMap("foo", "bar"));
+ map.put("foo", "bar");
assertEquals(LazyMap.SingletonMap.class, map.getDelegate().getClass());
}
@Test
public void requireThatEmptyMapPutAllEmptyMapDoesNotUpgradeToSingletonMap() {
LazyMap<String, String> map = newLazyMap(new HashMap<String, String>());
- map.putAll(Collections.<String, String>emptyMap());
+ map.putAll(Map.of());
assertEquals(LazyMap.EmptyMap.class, map.getDelegate().getClass());
}
@@ -81,7 +79,7 @@ public class LazyMapTest {
assertEquals("bar", map.put("foo", "baz"));
assertEquals("baz", map.get("foo"));
assertSame(delegate, map.getDelegate());
- map.putAll(Collections.singletonMap("foo", "cox"));
+ map.put("foo", "cox");
assertSame(delegate, map.getDelegate());
assertEquals("cox", map.get("foo"));
}
@@ -89,7 +87,7 @@ public class LazyMapTest {
@Test
public void requireThatSingletonMapPutAllEmptyMapDoesNotUpgradeToFinalMap() {
LazyMap<String, String> map = newSingletonMap("foo", "bar");
- map.putAll(Collections.<String, String>emptyMap());
+ map.putAll(Map.of());
assertEquals(LazyMap.SingletonMap.class, map.getDelegate().getClass());
}
@@ -188,7 +186,7 @@ public class LazyMapTest {
Mockito.verify(delegate).put("foo", "bar");
Mockito.verify(delegate).put("baz", "cox");
- Map<String, String> arg = Collections.singletonMap("baz", "cox");
+ Map<String, String> arg = Map.of("baz", "cox");
map.putAll(arg);
Mockito.verify(delegate).putAll(arg);