AuditService { public AuditReport getReport() { AuditReport report = new AuditReport(); report.setDatasize(countRecentNotEmptyDataPoints()); report.setAirportFrequency(computeAirportRelativeFrequency()); report.setRadiusFrequency(computeRadiusHistogram()); return report; }  void auditWeatherSearch(String iataCode, double radiusKm); AuditReport getReport();  }
@Test public void noRecords() { reset(repository); when(repository.getAllAirports()).thenReturn(Collections.emptyList()); AuditReport report = service.getReport(); assertEquals(0, report.getDatasize()); assertTrue(report.getAirportFrequency().isEmpty()); }
@Test public void oldDataPoint() throws ParseException { airport.getWeather().setLastUpdateTime(new SimpleDateFormat("yyyy-MM-dd").parse("2000-01-01").getTime()); AuditReport report = service.getReport(); assertEquals(0, report.getDatasize()); }
@Test public void emptyDataPoint() throws ParseException { airport.getWeather().setHumidity(null); AuditReport report = service.getReport(); assertEquals(0, report.getDatasize()); }