@Test public void shouldRefreshKey_whenKeyIsNullAndTimeIsInFuture_returnsTrue() { Calendar futureCalendar = Calendar.getInstance(); futureCalendar.add(Calendar.YEAR, 1); futureCalendar.getTimeInMillis(); assertTrue(EphemeralKeyManager.shouldRefreshKey(null, TEST_SECONDS_BUFFER, futureCalendar)); }
static boolean shouldRefreshKey( @Nullable EphemeralKey key, long bufferInSeconds, @Nullable Calendar proxyCalendar) { if (key == null) { return true; } Calendar now = proxyCalendar == null ? Calendar.getInstance() : proxyCalendar; long nowInSeconds = TimeUnit.MILLISECONDS.toSeconds(now.getTimeInMillis()); long nowPlusBuffer = nowInSeconds + bufferInSeconds; return key.getExpires() < nowPlusBuffer; }
EphemeralKeyManager { static boolean shouldRefreshKey( @Nullable EphemeralKey key, long bufferInSeconds, @Nullable Calendar proxyCalendar) { if (key == null) { return true; } Calendar now = proxyCalendar == null ? Calendar.getInstance() : proxyCalendar; long nowInSeconds = TimeUnit.MILLISECONDS.toSeconds(now.getTimeInMillis()); long nowPlusBuffer = nowInSeconds + bufferInSeconds; return key.getExpires() < nowPlusBuffer; } }
EphemeralKeyManager { static boolean shouldRefreshKey( @Nullable EphemeralKey key, long bufferInSeconds, @Nullable Calendar proxyCalendar) { if (key == null) { return true; } Calendar now = proxyCalendar == null ? Calendar.getInstance() : proxyCalendar; long nowInSeconds = TimeUnit.MILLISECONDS.toSeconds(now.getTimeInMillis()); long nowPlusBuffer = nowInSeconds + bufferInSeconds; return key.getExpires() < nowPlusBuffer; } EphemeralKeyManager(
            @NonNull EphemeralKeyProvider ephemeralKeyProvider,
            @NonNull KeyManagerListener keyManagerListener,
            long timeBufferInSeconds,
            @Nullable Calendar overrideCalendar); }
EphemeralKeyManager { static boolean shouldRefreshKey( @Nullable EphemeralKey key, long bufferInSeconds, @Nullable Calendar proxyCalendar) { if (key == null) { return true; } Calendar now = proxyCalendar == null ? Calendar.getInstance() : proxyCalendar; long nowInSeconds = TimeUnit.MILLISECONDS.toSeconds(now.getTimeInMillis()); long nowPlusBuffer = nowInSeconds + bufferInSeconds; return key.getExpires() < nowPlusBuffer; } EphemeralKeyManager(
            @NonNull EphemeralKeyProvider ephemeralKeyProvider,
            @NonNull KeyManagerListener keyManagerListener,
            long timeBufferInSeconds,
            @Nullable Calendar overrideCalendar);  }
EphemeralKeyManager { static boolean shouldRefreshKey( @Nullable EphemeralKey key, long bufferInSeconds, @Nullable Calendar proxyCalendar) { if (key == null) { return true; } Calendar now = proxyCalendar == null ? Calendar.getInstance() : proxyCalendar; long nowInSeconds = TimeUnit.MILLISECONDS.toSeconds(now.getTimeInMillis()); long nowPlusBuffer = nowInSeconds + bufferInSeconds; return key.getExpires() < nowPlusBuffer; } EphemeralKeyManager(
            @NonNull EphemeralKeyProvider ephemeralKeyProvider,
            @NonNull KeyManagerListener keyManagerListener,
            long timeBufferInSeconds,
            @Nullable Calendar overrideCalendar);   }