### Question:
HibernateCacheTimestamperMemcachedImpl implements HibernateCacheTimestamper { @Override public long next() { final long defaultNext = System.currentTimeMillis(); long next; try { next = memcachedAdapter.increaseCounter(cacheNamespace, TIMESTAMP_KEY, INCREASE_BY, defaultNext, EXPIRY_SECONDS); } catch (Exception ex) { log.warn("Failed to increase counter to get next timestamper.", ex); next = defaultNext; } log.debug("hibernate cache timestamper next : {}", next); return next; }  @Override void setSettings(Settings settings); @Override void setProperties(OverridableReadOnlyProperties properties); @Override void setMemcachedAdapter(MemcachedAdapter memcachedAdapter); @Override void init(); @Override long next(); CacheNamespace getCacheNamespace(); static final String TIMESTAMP_KEY; static final long INCREASE_BY; static final int EXPIRY_SECONDS; }### Answer:
@Test public void next() throws Exception { givenTimestamperWithCacheRegionPrefix("myservice"); CacheNamespace cacheNamespace = timestamper.getCacheNamespace(); long expected = 12345L; when(memcachedAdapter.increaseCounter(eq(cacheNamespace), eq(HibernateCacheTimestamperMemcachedImpl .TIMESTAMP_KEY), eq(HibernateCacheTimestamperMemcachedImpl.INCREASE_BY), anyLong(), eq(HibernateCacheTimestamperMemcachedImpl.EXPIRY_SECONDS))) .thenReturn(expected); long next = timestamper.next(); assertThat(next).isEqualTo(expected); }