public void testContainsKey() { assertTrue(_cache.containsKey("first key")); assertTrue(_cache.containsKey("second key")); assertTrue(_cache.containsKey("third key")); assertFalse(_cache.containsKey("fourth key")); assertFalse(_cache.containsKey("fifth key")); }
public void testClear() { _cache.clear(); assertFalse(_cache.containsKey("first key")); assertFalse(_cache.containsKey("second key")); assertFalse(_cache.containsKey("third key")); assertFalse(_cache.containsKey("fourth key")); assertFalse(_cache.containsKey("fifth key")); }
public void testRemove() { assertEquals("third value", _cache.remove("third key")); assertTrue(_cache.containsKey("first key")); assertTrue(_cache.containsKey("second key")); assertFalse(_cache.containsKey("third key")); assertFalse(_cache.containsKey("fourth key")); assertFalse(_cache.containsKey("fifth key")); }
public void testPut() { assertEquals("third value", _cache.put("third key", "alternate third value")); assertNull(_cache.put("fourth key", "forth value")); assertTrue(_cache.containsKey("first key")); assertTrue(_cache.containsKey("second key")); assertTrue(_cache.containsKey("third key")); assertTrue(_cache.containsKey("fourth key")); assertFalse(_cache.containsKey("fifth key")); }
public void testPutAll() { HashMap map = new HashMap(); map.put("fourth key", "forth value"); map.put("fifth key", "fifth value"); _cache.putAll(map); assertTrue(_cache.containsKey("first key")); assertTrue(_cache.containsKey("second key")); assertTrue(_cache.containsKey("third key")); assertTrue(_cache.containsKey("fourth key")); assertTrue(_cache.containsKey("fifth key")); }