Beispiel #1
0
  public void testSize() {
    Cache<String, String> cache = initialize();

    assertEquals(3, cache.size());
    cache.clear();
    assertEquals(0, cache.size());
  }
Beispiel #2
0
  public void testIsEmpty() {
    Cache<String, String> cache = initialize();

    assertFalse(cache.isEmpty());
    cache.clear();
    assertTrue(cache.isEmpty());
  }
Beispiel #3
0
  public void testClear() {
    Cache<String, String> cache = initialize();

    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"));
  }