@Override
    public int compare(EvictableEntryView e1, EvictableEntryView e2) {
        long time1 = Math.max(e1.getCreationTime(), e1.getLastAccessTime());
        long time2 = Math.max(e2.getCreationTime(), e2.getLastAccessTime());

        return Long.compare(time1, time2);
    }
@Test
    public void lru_comparator_does_not_prematurely_select_newly_created_entries() {
        // 0. Entries to sort
        List<TestEntryView> givenEntries = new LinkedList<>();
        givenEntries.add(new TestEntryView(1, 1, 0));
        givenEntries.add(new TestEntryView(2, 2, 3));
        givenEntries.add(new TestEntryView(3, 2, 0));
        givenEntries.add(new TestEntryView(4, 4, 4));
        givenEntries.add(new TestEntryView(5, 5, 20));
        givenEntries.add(new TestEntryView(6, 6, 6));
        givenEntries.add(new TestEntryView(7, 7, 0));
        givenEntries.add(new TestEntryView(8, 9, 15));
        givenEntries.add(new TestEntryView(9, 10, 10));
        givenEntries.add(new TestEntryView(10, 10, 0));

        // 1. Create expected list of ordered elements by
        // sorting entries based on their idle-times. Longest
        // idle time must be the first element of the list.
        List<TestEntryView> descOrderByIdleTimes = new LinkedList<>(givenEntries);
        Collections.sort(descOrderByIdleTimes, (o1, o2) -> -Long.compare(idleTime(o1), idleTime(o2)));

        // 2. Then sort given entries by using LRU eviction comparator.
        Collections.sort(givenEntries, (o1, o2) -> LRUEvictionPolicyComparator.INSTANCE.compare(o1, o2));

        // 3. Check both lists are equal
        assertEquals(descOrderByIdleTimes, givenEntries);
    }