StatusCache { public StatusDTO getStatus() { synchronized (LOCK) { if (cachedStatus != null && cachedStatus.getTimeUTC() != null) { long lastUpdateTimeSkew = System.currentTimeMillis() - cachedStatus.getTimeUTC().getTime(); if (lastUpdateTimeSkew <= STATUS_CACHE_TTL) { log.debug("Returning cached status. Last Update Date: {}, Age: {}ms", cachedStatus.getTimeUTC(), lastUpdateTimeSkew); return cachedStatus; } log.debug("Cache existed but had expired. Date: {}, Age: {}ms", cachedStatus.getTimeUTC(), lastUpdateTimeSkew); } reset(); } return null; }  StatusDTO getStatus(); void setStatus(StatusDTO status); void clear();  }
@Test public void initialGetReturnsNull() { StatusCache cache = new StatusCache(); assertNull(cache.getStatus()); }