Utils { public static int ttlToExpiration(final int ttl) { if (ttl <= 0) { return 0; } if (ttl < TTL_CUTOFF) { return ttl; } int expirationTime = (int) (System.currentTimeMillis() / 1000) + ttl; if (expirationTime < 0) { return Integer.MAX_VALUE - 1; } return expirationTime; } private  Utils(); static int ttlToExpiration(final int ttl); static Function<List<List<T>>, List<T>> flatten(); static int getGlobalConnectionCount(); static Throwable unwrap(final Throwable e);  }
@Test public void testTtlToExpiration() { assertEquals(0, Utils.ttlToExpiration(-123123)); assertEquals(0, Utils.ttlToExpiration(0)); assertEquals(123, Utils.ttlToExpiration(123)); assertEquals(2591999, Utils.ttlToExpiration(2591999)); assertTimestamp(2592000); assertTimestamp(3000000); assertEquals(Integer.MAX_VALUE - 1, Utils.ttlToExpiration(Integer.MAX_VALUE - 1234)); }