### Question:
LocatorCache { public synchronized boolean isLocatorCurrentInBatchLayer(Locator loc) { LocatorCacheEntry entry = insertedLocators.getIfPresent(loc.toString()); return entry != null && entry.isBatchCurrent(); } 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 testIsLocatorCurrentInBatchLayer() throws InterruptedException { assertTrue("locator which was never set is present in cache", !locatorCache.isLocatorCurrentInBatchLayer(LOCATOR)); locatorCache.setLocatorCurrentInBatchLayer(LOCATOR); assertTrue("locator not stored in cache", locatorCache.isLocatorCurrentInBatchLayer(LOCATOR)); }