HCOLL-119 removed the use of " public <K, V> SharedHashMap<K, V> create(File file, Class<K> kClass, Class<V> vClass) "

This commit is contained in:
Rob Austin
2014-07-24 18:20:21 +01:00
parent c94c9f0ed8
commit d1b1e180d6
5 changed files with 123 additions and 37 deletions
@@ -25,6 +25,7 @@ package net.openhft.chronicle.map;/*
/*import junit.framework.Test;
import junit.framework.TestSuite;*/
import net.openhft.collections.KeySetView;
import net.openhft.collections.SharedHashMapBuilder;
import net.openhft.collections.jrs166.JSR166TestCase;
import org.junit.Test;
@@ -111,7 +112,7 @@ public class ChronicleMap8Test extends JSR166TestCase {
* Returns a new map from Integers 1-5 to Strings "A"-"E".
*/
private static ConcurrentHashMap map5ConcurrentHashMap() {
ConcurrentHashMap<Integer,String> map = new ConcurrentHashMap<Integer,String>(5);
ConcurrentHashMap<Integer, String> map = new ConcurrentHashMap<Integer, String>(5);
assertTrue(map.isEmpty());
map.put(one, "A");
map.put(two, "B");
@@ -305,15 +306,15 @@ public class ChronicleMap8Test extends JSR166TestCase {
*/
@Test
public void testKeySetAddRemove() {
ChronicleMap map = map5();
Set set1 = map.keySet();
Set set2 = map.keySet(true);
ChronicleMap<Integer, String> map = map5();
final KeySetView<Integer, String> set1 = map.keySet();
final KeySetView<Integer, String> set2 = map.keySet("true");
set2.add(six);
assertTrue(((ConcurrentHashMap.KeySetView) set2).getMap() == map);
assertTrue(((ConcurrentHashMap.KeySetView) set1).getMap() == map);
assertTrue(set2.getMap() == map);
assertTrue(set1.getMap() == map);
assertEquals(set2.size(), map.size());
assertEquals(set1.size(), map.size());
assertTrue((Boolean) map.get(six));
assertTrue((Boolean.parseBoolean(map.get(six))));
assertTrue(set1.contains(six));
assertTrue(set2.contains(six));
set2.remove(six);
@@ -398,8 +399,6 @@ public class ChronicleMap8Test extends JSR166TestCase {
}
/**
* KeySetView.getMappedValue returns the map's mapped value
*/
@@ -413,38 +412,39 @@ public class ChronicleMap8Test extends JSR166TestCase {
} catch (NullPointerException e) {
}
final net.openhft.collections.KeySetView set = map.keySet("1");
final net.openhft.collections.KeySetView set = map.keySet("A");
set.add(one);
set.add(six);
set.add(seven);
assertTrue(set.getMappedValue() == "1");
assertTrue(map.get(one) != "1");
assertTrue(map.get(six) == "1");
assertTrue(map.get(seven) == "1");
assertTrue(set.getMappedValue().equals("A"));
assertTrue(map.get(one).equals("A"));
assertTrue(map.get(six).equals("A"));
assertTrue(map.get(seven).equals("A"));
}
@Test
public void testConcurrentHashMapGetMappedValue() {
ConcurrentHashMap map = map5ConcurrentHashMap();
assertNull(map.keySet().getMappedValue());
try {
map.keySet(null);
shouldThrow();
} catch (NullPointerException e) {
}
/* @Test
public void testConcurrentHashMapGetMappedValue() {
ConcurrentHashMap map = map5ConcurrentHashMap();
assertNull(map.keySet().getMappedValue());
try {
map.keySet(null);
shouldThrow();
} catch (NullPointerException e) {
}
final ConcurrentHashMap.KeySetView set = map.keySet("1");
final ConcurrentHashMap.KeySetView set = map.keySet("A");
set.add(one);
set.add(six);
set.add(seven);
assertTrue(set.getMappedValue() == "1");
assertTrue(map.get(one) != "1");
assertTrue(map.get(six) == "1");
assertTrue(map.get(seven) == "1");
}
set.add(one);
set.add(six);
set.add(seven);
assertTrue(set.getMappedValue() == "A");
assertTrue(map.get(one) == "A");
assertTrue(map.get(six) == "A");
assertTrue(map.get(seven) == "A");
}
*/
void checkSpliteratorCharacteristics(Spliterator<?> sp,
int requiredCharacteristics) {
assertEquals(requiredCharacteristics,