public void testEntrySet() {
    dc.put("k1", "v1", 6000000, -1);
    dc.put("k2", "v2", -1, -1);
    dc.put("k3", "v3", -1, 6000000);
    dc.put("k4", "v4", 6000000, 6000000);

    Set expected = new HashSet();
    expected.add(Immutables.immutableInternalCacheEntry(dc.get("k1")));
    expected.add(Immutables.immutableInternalCacheEntry(dc.get("k2")));
    expected.add(Immutables.immutableInternalCacheEntry(dc.get("k3")));
    expected.add(Immutables.immutableInternalCacheEntry(dc.get("k4")));

    Set actual = new HashSet();
    for (Map.Entry o : dc.entrySet()) actual.add(o);

    assert actual.equals(expected) : "Expected to see keys " + expected + " but only saw " + actual;
  }
Пример #2
0
 @Override
 public InternalCacheEntry next() {
   return Immutables.immutableInternalCacheEntry(super.next());
 }