@Test public void testFileLowestHumidity() { CSVRecord coldestRecord = null; DirectoryResource dr = new DirectoryResource(); String filename = ""; for (File f : dr.selectedFiles()) { FileResource fr = new FileResource(f); CSVRecord record = WeatherCSVProblem.lowestHumidityInFile(fr.getCSVParser()); if (coldestRecord == null) { coldestRecord = record; } else { double recordTemp = Double.parseDouble(record.get("Humidity")); double coldestTemp = Double.parseDouble(coldestRecord.get("Humidity")); if (recordTemp < coldestTemp) { coldestRecord = record; filename = f.getName(); } } } System.out.println(filename); System.out.println( "Lowest Humidity " + coldestRecord.get("Humidity") + " at " + coldestRecord.get("DateUTC")); }
@Test public void testLowestHumidityInFile() { FileResource fr = new FileResource("../../resources/main/nc_weather/2014/weather-2014-07-22.csv"); CSVParser parser = fr.getCSVParser(); CSVRecord rec = WeatherCSVProblem.lowestHumidityInFile(parser); System.out.println("Lowest Humidity was " + rec.get("Humidity") + " at " + rec.get("DateUTC")); }