예제 #1
0
  public void testPut() throws InterruptedException {
    mCache.put("key", "value");

    final CountDownLatch latch = new CountDownLatch(1);
    mCache.setOnEntryRemovedListener(
        new OnEntryRemovedListener<String, String>() {
          @Override
          public void onEntryRemoved(boolean evicted, String key, String value) {
            assertEquals("key", key);
            assertEquals("value", value);
            latch.countDown();
          }
        });
    assertNull(mCache.put("key", "value"));
    latch.await();
  }
예제 #2
0
 public void testRemove() {
   assertNull(mCache.remove("key"));
   mCache.put("key", "value");
   assertNull(mCache.remove("key"));
 }
예제 #3
0
 public void testGet() {
   assertNull(mCache.get("key"));
   mCache.put("key", "value");
   assertNull(mCache.get("key"));
 }