/** check {@link ImmutableTimeStampedCache#emptyCache()}. */ @Test public void testEmptyCache() { // setup cache = ImmutableTimeStampedCache.emptyCache(); // actions + verify try { cache.getNeighbors(date); Assert.fail("Expected Exception"); } catch (TimeStampedCacheException e) { // expected } try { cache.getEarliest(); Assert.fail("Expected Exception"); } catch (IllegalStateException e) { // expected } try { cache.getLatest(); Assert.fail("Expected Exception"); } catch (IllegalStateException e) { // expected } Assert.assertEquals(cache.getAll().size(), 0); Assert.assertEquals(cache.getNeighborsSize(), 0); }
/** check {@link ImmutableTimeStampedCache#getLatest()} */ @Test public void testGetLatest() { Assert.assertEquals(cache.getLatest(), data.get(data.size() - 1)); }