### Question:
TertiaryKeyRotationTracker { public boolean isKeyRotationDue(String packageName) { return getBackupsSinceRotation(packageName) >= MAX_BACKUPS_UNTIL_TERTIARY_KEY_ROTATION; } @VisibleForTesting  TertiaryKeyRotationTracker(SharedPreferences sharedPreferences); static TertiaryKeyRotationTracker getInstance(Context context); boolean isKeyRotationDue(String packageName); void recordBackup(String packageName); void resetCountdown(String packageName); void markAllForRotation();  }### Answer:
@Test public void isKeyRotationDue_forNewPackage_isFalse() { boolean keyRotationDue = mTertiaryKeyRotationTracker.isKeyRotationDue(PACKAGE_1); assertThat(keyRotationDue).isFalse(); }
@Test public void isKeyRotationDue_afterLessThanRotationAmountBackups_isFalse() { simulateBackups(PACKAGE_1, NUMBER_OF_BACKUPS_BEFORE_ROTATION - 1); boolean keyRotationDue = mTertiaryKeyRotationTracker.isKeyRotationDue(PACKAGE_1); assertThat(keyRotationDue).isFalse(); }
@Test public void isKeyRotationDue_afterRotationAmountBackups_isTrue() { simulateBackups(PACKAGE_1, NUMBER_OF_BACKUPS_BEFORE_ROTATION); boolean keyRotationDue = mTertiaryKeyRotationTracker.isKeyRotationDue(PACKAGE_1); assertThat(keyRotationDue).isTrue(); }
@Test public void isKeyRotationDue_forNewInstance_readsStateFromDisk() { simulateBackups(PACKAGE_1, NUMBER_OF_BACKUPS_BEFORE_ROTATION); boolean keyRotationDueForNewInstance = newInstance().isKeyRotationDue(PACKAGE_1); assertThat(keyRotationDueForNewInstance).isTrue(); }