@Test
public void testLRUCache() throws Exception {

    assertEquals("Should be initial empty.", 0, cache.size());
    assertEquals("Should be initial empty.", true, cache.isEmpty());
    for (int i = 0 ; i < 100; i++) {
        cache.put(String.valueOf(i), i);
        assertEquals("Should be the right size.", i+1, cache.size());
    }
    for (int i = 100 ; i < 20000000; i++) {
        cache.put(String.valueOf(i), i);
    }
    assertEquals("Should keep latest element.", 20000000 - 1, cache.get(String.valueOf(20000000-1)));
    assertFalse("Should not keep the obsolete element.",
        cache.containsKey(String.valueOf(20000000 - 101)));
}