@Test
public void shouldSmearRotationWeekly() {

  final long hours = Duration.ofDays(7).toHours();
  final int[] rotationsPerHour = new int[(int) hours];
  final int n = 10000;
  for (int i = 0; i < n; i++) {
    for (int hour = 0; hour < hours; hour++) {
      final long nowMillis = TimeUnit.HOURS.toMillis(hour);
      final long epoch = KubernetesGCPServiceAccountSecretManager.smearedEpoch(
          nowMillis, "sa" + i + "@example.com");
      if (epoch != 0) {
        rotationsPerHour[hour]++;
        break;
      }
    }
  }
  final IntSummaryStatistics stats = IntStream.of(rotationsPerHour).summaryStatistics();
  final double expectedMeanRotationsPerHour = n / hours;
  assertThat(stats.getAverage(), is(closeTo(expectedMeanRotationsPerHour, expectedMeanRotationsPerHour / 2)));
  assertThat((double) stats.getMax(), is(lessThan(expectedMeanRotationsPerHour * 2)));
}