### Question:
QueueStatistics extends SerializableBase { public void pruneStats(LocalDate date, int maxDays) { if (startEpochDate == null) { startEpochDate = date.toEpochDay(); return; } long daysDifference = date.toEpochDay() - startEpochDate; long extraDaysData = daysDifference - maxDays; if (extraDaysData > 0) { LocalDate startDate = date.minusDays(maxDays); this.startEpochDate = startDate.toEpochDay(); for (int i = 0; i <= extraDaysData; i++) { cleanData(startDate.minusDays(i).toString()); } } } QueueStatistics(String id); void updateTime(); void incrementDeadLetter(String date, long delta); void update(TasksStat stat, String eventDate); void incrementDiscard(String date, long delta); void incrementSuccessful(String date, long delta); void updateJobExecutionTime(String date, JobRunTime jobRunTimeDelta); void pruneStats(LocalDate date, int maxDays); void incrementRetry(String date, long delta); long tasksDiscarded(String date); long tasksSuccessful(String date); long tasksMovedToDeadLetter(String date); long tasksRetried(String date); JobRunTime jobRunTime(String date);  }### Answer:
@Test public void pruneStats() { QueueStatistics queueStatistics = new QueueStatistics(id); LocalDate localDate = LocalDate.parse("2020-04-11"); queueStatistics.pruneStats(localDate, 7); assertNotNull(queueStatistics.getStartEpochDate()); for (int i = 0; i < 7; i++) { addData(queueStatistics, localDate, i); } validate(queueStatistics, 7); queueStatistics.pruneStats(localDate, 7); validate(queueStatistics, 7); for (int i = 7; i < 14; i++) { addData(queueStatistics, localDate, i); } queueStatistics.setStartEpochDate(queueStatistics.getStartEpochDate() - 14); validate(queueStatistics, 14); queueStatistics.pruneStats(localDate, 7); validate(queueStatistics, 7); for (int i = 0; i < 7; i++) { String date = localDate.minusDays(i).toString(); checkNonNull(queueStatistics, date); } }