BUG-4803: invalidate cache before each test
[yangtools.git] / common / util / src / test / java / org / opendaylight / yangtools / util / OffsetMapTest.java
index 8f95699c83396cd773c723a3febbba2d81c6a6df..17a6f2e1edf8d308b76e258d2363e6cb90daadae 100644 (file)
@@ -15,7 +15,6 @@ import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterators;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -30,6 +29,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.NoSuchElementException;
 import java.util.Set;
+import org.junit.Before;
 import org.junit.Test;
 
 public class OffsetMapTest {
@@ -40,6 +40,11 @@ public class OffsetMapTest {
         return (ImmutableOffsetMap<String, String>) ImmutableOffsetMap.copyOf(twoEntryMap);
     }
 
+    @Before
+    public void setup() {
+        OffsetMapCache.invalidateCache();
+    }
+
     @Test(expected=IllegalArgumentException.class)
     public void testWrongImmutableConstruction() {
         new ImmutableOffsetMap.Ordered<String, String>(Collections.<String, Integer>emptyMap(), new String[1]);
@@ -333,7 +338,7 @@ public class OffsetMapTest {
 
     @Test
     public void testEmptyMutable() throws CloneNotSupportedException {
-        final MutableOffsetMap<String, String> map = new MutableOffsetMap<>();
+        final MutableOffsetMap<String, String> map = MutableOffsetMap.of();
         assertTrue(map.isEmpty());
 
         final Map<String, String> other = map.clone();
@@ -341,15 +346,6 @@ public class OffsetMapTest {
         assertNotSame(other, map);
     }
 
-    @Test
-    public void testMutableWithKeyset() {
-        final MutableOffsetMap<String, String> map = new MutableOffsetMap<>(ImmutableSet.of("k1", "k2"));
-        assertTrue(map.isEmpty());
-        assertTrue(map.keySet().isEmpty());
-        assertNull(map.get("k1"));
-        assertNull(map.remove("k2"));
-    }
-
     @Test
     public void testMutableToEmpty() {
         final MutableOffsetMap<String, String> mutable = createMap().toModifiableMap();