### Question:
LocatorCache { public synchronized void setLocatorCurrentInBatchLayer(Locator loc) { getOrCreateInsertedLocatorEntry(loc).setBatchCurrent(); } protected  LocatorCache(long expireAfterAccessDuration, TimeUnit expireAfterAccessTimeUnit,
                           long expireAfterWriteDuration, TimeUnit expireAfterWriteTimeUnit); static LocatorCache getInstance(); @VisibleForTesting static LocatorCache getInstance(long expireAfterAccessDuration, TimeUnit expireAfterAccessTimeUnit,
                                           long expireAfterWriteDuration, TimeUnit expireAfterWriteTimeUnit); long getCurrentLocatorCount(); long getCurrentDelayedLocatorCount(); synchronized boolean isLocatorCurrentInBatchLayer(Locator loc); synchronized boolean isLocatorCurrentInDiscoveryLayer(Locator loc); synchronized boolean isLocatorCurrentInTokenDiscoveryLayer(Locator loc); synchronized boolean isDelayedLocatorForASlotCurrent(int slot, Locator locator); synchronized void setLocatorCurrentInBatchLayer(Locator loc); synchronized void setLocatorCurrentInDiscoveryLayer(Locator loc); synchronized void setLocatorCurrentInTokenDiscoveryLayer(Locator loc); synchronized void setDelayedLocatorForASlotCurrent(int slot, Locator locator); @VisibleForTesting synchronized void resetCache(); @VisibleForTesting synchronized void resetInsertedLocatorsCache();  }### Answer:
@Test public void testSetLocatorCurrentInBatchLayer() throws InterruptedException { locatorCache.setLocatorCurrentInBatchLayer(LOCATOR); assertTrue("locator not stored in cache", locatorCache.isLocatorCurrentInBatchLayer(LOCATOR)); Thread.sleep(2000L); assertTrue("locator not expired from cache", !locatorCache.isLocatorCurrentInBatchLayer(LOCATOR)); }