CrossCheckPutAllTest.java
package org.caffinitas.ohc.linked;
import org.caffinitas.ohc.Eviction;
import org.caffinitas.ohc.HashAlgorithm;
import org.caffinitas.ohc.OHCache;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
public class CrossCheckPutAllTest extends CrossCheckTestBase {
@Test(dataProvider = "types")
public void testPutAll(Eviction eviction, HashAlgorithm hashAlgorithm) throws Exception
{
try (OHCache<Integer, String> cache = cache(eviction, hashAlgorithm))
{
Map<Integer, String> map = new HashMap<>();
map.put(1, "one");
map.put(2, "two");
map.put(3, "three");
cache.putAll(map);
Assert.assertEquals(cache.get(1), map.get(1));
Assert.assertEquals(cache.get(2), map.get(2));
Assert.assertEquals(cache.get(3), map.get(3));
Assert.assertEquals(cache.stats().getSize(), 3);
}
}
}