### Question:
HeartBeatInfoStorage { synchronized boolean shouldSendSdkHeartBeat(String heartBeatTag, long millis) { if (sharedPreferences.contains(heartBeatTag)) { long timeElapsed = millis - sharedPreferences.getLong(heartBeatTag, -1); if (timeElapsed >= (long) 1000 * 60 * 60 * 24) { sharedPreferences.edit().putLong(heartBeatTag, millis).apply(); return true; } return false; } else { sharedPreferences.edit().putLong(heartBeatTag, millis).apply(); return true; } } private  HeartBeatInfoStorage(Context applicationContext); @VisibleForTesting @RestrictTo(RestrictTo.Scope.TESTS)  HeartBeatInfoStorage(SharedPreferences preferences);   }### Answer:
@Test public void shouldSendSdkHeartBeat_answerIsNo() { sharedPreferences.edit().putLong(testSdk, 1).apply(); assertThat(heartBeatInfoStorage.shouldSendSdkHeartBeat(testSdk, 1)).isFalse(); }
@Test public void shouldSendSdkHeartBeat_answerIsYes() { long currentTime = System.currentTimeMillis(); assertThat(heartBeatInfoStorage.shouldSendSdkHeartBeat(testSdk, 1)).isTrue(); assertThat(sharedPreferences.getLong(testSdk, -1)).isEqualTo(1); assertThat(heartBeatInfoStorage.shouldSendSdkHeartBeat(testSdk, currentTime)).isTrue(); assertThat(sharedPreferences.getLong(testSdk, -1)).isEqualTo(currentTime); }