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;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Set;
+import org.junit.Before;
import org.junit.Test;
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]);
@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();
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();