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

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

    assertFalse(cache.isEmpty());
    cache.clear();
    assertTrue(cache.isEmpty());
  }
Exemple #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"));
  }