Commit 04862724 authored by Christopher Bohn's avatar Christopher Bohn 🤔
Browse files

Improved error handling, tested error handling, fixed bugs found thereby

parent 6768b54c
......@@ -80,7 +80,7 @@ public class Demonstration {
Date currentTimeStamp = weather.getTimestamp();
System.out.println("Current timestamp: " +
(currentTimeStamp == OpenWeatherConnector.IMPOSSIBLE_DATE ? "not present" : currentTimeStamp));
System.out.println("Available timestamps: " + weather.getTimeStamps());
System.out.println("Available timestamps: " + weather.getTimestamps());
Date timestamp;
switch (dataSet) {
......@@ -102,7 +102,7 @@ public class Demonstration {
"snow. (You might not want to trust those values if they match the 1-hour precipitation.)");
break;
case "forecast":
timestamp = weather.getTimeStamps().get(weather.getTimeStamps().size() / 2);
timestamp = weather.getTimestamps().get(weather.getTimestamps().size() / 2);
System.out.println("At " + timestamp + " it will be " + weather.getWeatherCategories(timestamp));
System.out.println("Specifically, it will be " + weather.getWeatherDescriptions(timestamp));
System.out.println("The temperature will be " + weather.getTemperature(timestamp) + "K");
......@@ -133,7 +133,7 @@ public class Demonstration {
break;
case "air_pollution/history":
case "air_pollution/forecast":
timestamp = weather.getTimeStamps().get(weather.getTimeStamps().size() / 2);
timestamp = weather.getTimestamps().get(weather.getTimestamps().size() / 2);
System.out.println("The air quality at " + timestamp +
(timestamp.toInstant().isBefore(now) ? " was " : " will be ") +
weather.getAirQualityIndex(timestamp) + " pollutant concentration");
......
......@@ -18,7 +18,7 @@ public class AirPollution_UnlNov24ToNov27Test {
public void setup() throws IOException {
connector = new OpenWeatherConnector("air_pollution/history");
connector.retrieveData("air_pollution-unl-historical.json");
timestamps = connector.getTimeStamps();
timestamps = connector.getTimestamps();
}
@Test
......
......@@ -5,7 +5,6 @@ import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
......@@ -19,7 +18,7 @@ public class Forecast_UnlNov7ToNov12Test {
public void setup() throws IOException {
connector = new OpenWeatherConnector("forecast");
connector.retrieveData("forecasted_weather-unl-nov7-nov12.json");
List<Date> timestamps = connector.getTimeStamps();
List<Date> timestamps = connector.getTimestamps();
Sunday = timestamps.get(0);
Monday = timestamps.get(8);
Tuesday = timestamps.get(16);
......
{
"list" : [
{
"dt" : 1606266000
}
]
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment