Skip to content
Snippets Groups Projects
Commit 830eafd2 authored by Christopher Bohn's avatar Christopher Bohn :thinking:
Browse files

Reformatted to SOFT160 formatting specification

parent 77a56416
Branches
No related tags found
No related merge requests found
Showing
with 5459 additions and 5016 deletions
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.unl.cse.soft160.rest_connector</groupId>
......
......@@ -43,8 +43,8 @@ public class Demonstration {
case "air_pollution/history":
Instant yesterday = now.minus(1, ChronoUnit.DAYS);
Instant twoDaysAgo = now.minus(2, ChronoUnit.DAYS);
query = "lat=40.81506358&lon=-96.7048613&start=" +
twoDaysAgo.getEpochSecond() + "&end=" + yesterday.getEpochSecond();
query = "lat=40.81506358&lon=-96.7048613&start=" + twoDaysAgo.getEpochSecond() + "&end="
+ yesterday.getEpochSecond();
break;
default:
System.err.println("The " + dataSet + " dataset is not currently supported.");
......@@ -107,24 +107,22 @@ public class Demonstration {
private static void reportAirPollutionHistoryOrForecastData(OpenWeatherConnector weather, Instant now) {
Date 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");
System.out.println(
"The air quality at " + timestamp + (timestamp.toInstant().isBefore(now) ? " was " : " will be ")
+ weather.getAirQualityIndex(timestamp) + " pollutant concentration");
System.out.println("CO: " + weather.getCarbonMonoxide(timestamp) + " μg/m3");
System.out.println("NO: " + weather.getNitrogenMonoxide(timestamp) + " μg/m3");
System.out.println("NO2: " + weather.getNitrogenDioxide(timestamp) + " μg/m3");
System.out.println("O3: " + weather.getOzone(timestamp) + " μg/m3");
System.out.println("SO2: " + weather.getSulfurDioxide(timestamp) + " μg/m3");
System.out.println("NH3: " + weather.getAmmonia(timestamp) + " μg/m3");
System.out.println("Fine particulate matter: " + weather.getFineParticulateMatter(timestamp) + " " +
"μg/m3");
System.out.println("Coarse particulate matter: " + weather.getCoarseParticulateMatter(timestamp) + " " +
"μg/m3");
System.out.println("Fine particulate matter: " + weather.getFineParticulateMatter(timestamp) + " " + "μg/m3");
System.out
.println("Coarse particulate matter: " + weather.getCoarseParticulateMatter(timestamp) + " " + "μg/m3");
}
private static void reportAirPollutionData(OpenWeatherConnector weather) {
System.out.println("The current air quality is " + weather.getAirQualityIndex() +
" pollutant concentration");
System.out.println("The current air quality is " + weather.getAirQualityIndex() + " pollutant concentration");
System.out.println("CO: " + weather.getCarbonMonoxide() + " μg/m3");
System.out.println("NO: " + weather.getNitrogenMonoxide() + " μg/m3");
System.out.println("NO2: " + weather.getNitrogenDioxide() + " μg/m3");
......@@ -140,76 +138,76 @@ public class Demonstration {
System.out.println("It is currently " + weather.getWeatherCategories());
System.out.println("Specifically, it is " + weather.getWeatherDescriptions());
System.out.println("The temperature is " + weather.getTemperature() + "K");
System.out.println("Factoring in the relative humidity of " + weather.getHumidity() + "%, the dew " +
"point is " + weather.getDewPoint() + "K, and it feels like " + weather.getFeelsLike() + "K");
System.out.println("That probably also factored in winds, which are " + weather.getWindSpeed() + "m/s" +
" from " + weather.getWindDirection() + "˚, gusting to " + weather.getWindGust() + "m/s");
System.out.println("Factoring in the relative humidity of " + weather.getHumidity() + "%, the dew "
+ "point is " + weather.getDewPoint() + "K, and it feels like " + weather.getFeelsLike() + "K");
System.out.println("That probably also factored in winds, which are " + weather.getWindSpeed() + "m/s"
+ " from " + weather.getWindDirection() + "˚, gusting to " + weather.getWindGust() + "m/s");
System.out.println("Visibility is " + weather.getVisibility() + "m");
System.out.println("The pressure is " + weather.getPressure() + "hPa");
System.out.println("Cloud cover is " + weather.getCloudCover() + "%");
System.out.println("The UV Index is " + weather.getUltravioletIndex());
System.out.println("Precipitation in the last hour has been " + weather.getOneHourRainfall() + "mm of" +
" rain and " + weather.getOneHourSnowfall() + "mm of snow.");
System.out.println("Precipitation in the last hour has been " + weather.getOneHourRainfall() + "mm of"
+ " rain and " + weather.getOneHourSnowfall() + "mm of snow.");
if (weather.getTimestamps("minutely").size() > 0) {
System.out.println("There is minutely data from " + weather.getTimestamps("minutely").get(0) + " to " +
weather.getTimestamps("minutely").get(weather.getTimestamps("minutely").size() - 1));
System.out.println("There is minutely data from " + weather.getTimestamps("minutely").get(0) + " to "
+ weather.getTimestamps("minutely").get(weather.getTimestamps("minutely").size() - 1));
timestamp = weather.getTimestamps("minutely").get(weather.getTimestamps("minutely").size() / 2);
System.out.println("\tAt " + timestamp + " the 1-hour (?) precipitation total will be " +
weather.getMinutelyPrecipitation(timestamp));
System.out.println("\tAt " + timestamp + " the 1-hour (?) precipitation total will be "
+ weather.getMinutelyPrecipitation(timestamp));
} else {
System.out.println("There is no minutely data.");
}
if (weather.getTimestamps("hourly").size() > 0) {
System.out.println("There is hourly data from " + weather.getTimestamps("hourly").get(0) + " to " +
weather.getTimestamps("hourly").get(weather.getTimestamps("hourly").size() - 1));
System.out.println("There is hourly data from " + weather.getTimestamps("hourly").get(0) + " to "
+ weather.getTimestamps("hourly").get(weather.getTimestamps("hourly").size() - 1));
timestamp = weather.getTimestamps("hourly").get(weather.getTimestamps("hourly").size() / 2);
System.out.println("\tAt " + timestamp + " it will be " + weather.getWeatherCategories(timestamp));
System.out.println("\tSpecifically, it will be " + weather.getWeatherDescriptions(timestamp));
System.out.println("\tThe temperature will be " + weather.getTemperature(timestamp) + "K");
System.out.println("\tFactoring in the relative humidity of " + weather.getHumidity(timestamp) + "%, the dew " +
"point will be " + weather.getDewPoint(timestamp) + "K, and it will feel like " +
weather.getFeelsLike(timestamp) + "K");
System.out.println("\tThat probably also factored in winds, which will be " +
weather.getWindSpeed(timestamp) + "m/s from " + weather.getWindDirection(timestamp) +
"˚, gusting to " + weather.getWindGust(timestamp) + "m/s");
System.out.println("\tFactoring in the relative humidity of " + weather.getHumidity(timestamp)
+ "%, the dew " + "point will be " + weather.getDewPoint(timestamp) + "K, and it will feel like "
+ weather.getFeelsLike(timestamp) + "K");
System.out.println("\tThat probably also factored in winds, which will be "
+ weather.getWindSpeed(timestamp) + "m/s from " + weather.getWindDirection(timestamp)
+ "˚, gusting to " + weather.getWindGust(timestamp) + "m/s");
System.out.println("\tVisibility will be " + weather.getVisibility(timestamp) + "m");
System.out.println("\tThe pressure will be " + weather.getPressure(timestamp) + "hPa");
System.out.println("\tCloud cover will be " + weather.getCloudCover(timestamp) + "%");
System.out.println("\tThe UV Index will be " + weather.getUltravioletIndex(timestamp));
System.out.println("\tThere will be a " + weather.getProbabilityOfPrecipitation(timestamp) * 100 + "% " +
"chance of precipitation, resulting in " + weather.getOneHourRainfall(timestamp) + "mm of " +
"rain and " + weather.getOneHourSnowfall(timestamp) + "mm of snow in the hour before " +
timestamp);
System.out.println("\tThere will be a " + weather.getProbabilityOfPrecipitation(timestamp) * 100 + "% "
+ "chance of precipitation, resulting in " + weather.getOneHourRainfall(timestamp) + "mm of "
+ "rain and " + weather.getOneHourSnowfall(timestamp) + "mm of snow in the hour before "
+ timestamp);
} else {
System.out.println("There is no hourly data.");
}
if (weather.getTimestamps("daily").size() > 0) {
System.out.println("There is daily data from " + weather.getTimestamps("daily").get(0) + " to " +
weather.getTimestamps("daily").get(weather.getTimestamps("daily").size() - 1));
System.out.println("There is daily data from " + weather.getTimestamps("daily").get(0) + " to "
+ weather.getTimestamps("daily").get(weather.getTimestamps("daily").size() - 1));
timestamp = weather.getTimestamps("daily").get(weather.getTimestamps("daily").size() / 2);
System.out.println("\tAt " + timestamp + " it will be " + weather.getWeatherCategories(timestamp));
System.out.println("\tSpecifically, it will be " + weather.getWeatherDescriptions(timestamp));
System.out.println("\tThe temperatures will range from " + weather.getLowTemperature(timestamp) + "K to " +
weather.getHighTemperature(timestamp) + "K");
System.out.println("\tThe temperatures will range from " + weather.getLowTemperature(timestamp) + "K to "
+ weather.getHighTemperature(timestamp) + "K");
System.out.println("\t\tMorning:" + weather.getMorningTemperature(timestamp) + "K");
System.out.println("\t\tDaytime:" + weather.getDaytimeTemperature(timestamp) + "K");
System.out.println("\t\tEvening:" + weather.getEveningTemperature(timestamp) + "K");
System.out.println("\t\tNighttime:" + weather.getNighttimeTemperature(timestamp) + "K");
System.out.println("\tFactoring in the relative humidity of " + weather.getHumidity(timestamp) + "%, the dew " +
"point will be " + weather.getDewPoint(timestamp) + "K, and it will feel like:");
System.out.println("\tFactoring in the relative humidity of " + weather.getHumidity(timestamp)
+ "%, the dew " + "point will be " + weather.getDewPoint(timestamp) + "K, and it will feel like:");
System.out.println("\t\tMorning:" + weather.getMorningFeelsLike(timestamp) + "K");
System.out.println("\t\tDaytime:" + weather.getDaytimeFeelsLike(timestamp) + "K");
System.out.println("\t\tEvening:" + weather.getEveningFeelsLike(timestamp) + "K");
System.out.println("\t\tNighttime:" + weather.getNighttimeFeelsLike(timestamp) + "K");
System.out.println("\tThat probably also factored in winds, which will be " +
weather.getWindSpeed(timestamp) + "m/s from " + weather.getWindDirection(timestamp) +
"˚, gusting to " + weather.getWindGust(timestamp) + "m/s");
System.out.println("\tThat probably also factored in winds, which will be "
+ weather.getWindSpeed(timestamp) + "m/s from " + weather.getWindDirection(timestamp)
+ "˚, gusting to " + weather.getWindGust(timestamp) + "m/s");
System.out.println("\tThe pressure will be " + weather.getPressure(timestamp) + "hPa");
System.out.println("\tCloud cover will be " + weather.getCloudCover(timestamp) + "%");
System.out.println("\tThe UV Index will be " + weather.getUltravioletIndex(timestamp));
System.out.println("\tThere will be a " + weather.getProbabilityOfPrecipitation(timestamp) * 100 + "% " +
"chance of precipitation, resulting in " + weather.getDailyRainfall(timestamp) + "mm of " +
"rain and " + weather.getDailySnowfall(timestamp) + "mm of snow");
System.out.println("\tThere will be a " + weather.getProbabilityOfPrecipitation(timestamp) * 100 + "% "
+ "chance of precipitation, resulting in " + weather.getDailyRainfall(timestamp) + "mm of "
+ "rain and " + weather.getDailySnowfall(timestamp) + "mm of snow");
} else {
System.out.println("There is no daily data.");
}
......@@ -220,36 +218,36 @@ public class Demonstration {
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");
System.out.println("Factoring in the relative humidity of " + weather.getHumidity(timestamp) + "%, " +
"it will feel like " + weather.getFeelsLike(timestamp) + "K");
System.out.println("That probably also factored in winds, which will be " +
weather.getWindSpeed(timestamp) + "m/s from " + weather.getWindDirection(timestamp) +
"˚, gusting to " + weather.getWindGust(timestamp) + "m/s");
System.out.println("Factoring in the relative humidity of " + weather.getHumidity(timestamp) + "%, "
+ "it will feel like " + weather.getFeelsLike(timestamp) + "K");
System.out.println("That probably also factored in winds, which will be " + weather.getWindSpeed(timestamp)
+ "m/s from " + weather.getWindDirection(timestamp) + "˚, gusting to " + weather.getWindGust(timestamp)
+ "m/s");
System.out.println("Visibility will be " + weather.getVisibility(timestamp) + "m");
System.out.println("The pressure will be " + weather.getPressure(timestamp) + "hPa");
System.out.println("Cloud cover will be " + weather.getCloudCover(timestamp) + "%");
System.out.println("There will be a " + weather.getProbabilityOfPrecipitation(timestamp) * 100 + "% " +
"chance of precipitation, resulting in " + weather.getThreeHourRainfall(timestamp) + "mm of " +
"rain and " + weather.getThreeHourSnowfall(timestamp) + "mm of snow in the three hours before" +
" " + timestamp);
System.out.println("There will be a " + weather.getProbabilityOfPrecipitation(timestamp) * 100 + "% "
+ "chance of precipitation, resulting in " + weather.getThreeHourRainfall(timestamp) + "mm of "
+ "rain and " + weather.getThreeHourSnowfall(timestamp) + "mm of snow in the three hours before" + " "
+ timestamp);
}
private static void reportWeatherData(OpenWeatherConnector weather) {
System.out.println("It is currently " + weather.getWeatherCategories());
System.out.println("Specifically, it is " + weather.getWeatherDescriptions());
System.out.println("The temperature is " + weather.getTemperature() + "K");
System.out.println("Factoring in the relative humidity of " + weather.getHumidity() + "%, it feels " +
"like " + weather.getFeelsLike() + "K");
System.out.println("That probably also factored in winds, which are " + weather.getWindSpeed() + "m/s" +
" from " + weather.getWindDirection() + "˚, gusting to " + weather.getWindGust() + "m/s");
System.out.println("Factoring in the relative humidity of " + weather.getHumidity() + "%, it feels " + "like "
+ weather.getFeelsLike() + "K");
System.out.println("That probably also factored in winds, which are " + weather.getWindSpeed() + "m/s"
+ " from " + weather.getWindDirection() + "˚, gusting to " + weather.getWindGust() + "m/s");
System.out.println("Visibility is " + weather.getVisibility() + "m");
System.out.println("The pressure is " + weather.getPressure() + "hPa");
System.out.println("Cloud cover is " + weather.getCloudCover() + "%");
System.out.println("Precipitation in the last hour has been " + weather.getOneHourRainfall() + "mm of" +
" rain and " + weather.getOneHourSnowfall() + "mm of snow.");
System.out.println("If three-hour precipitation data is reported, it's " +
weather.getThreeHourRainfall() + "mm of rain and " + weather.getThreeHourSnowfall() + "mm of " +
"snow. (You might not want to trust those values if they match the 1-hour precipitation.)");
System.out.println("Precipitation in the last hour has been " + weather.getOneHourRainfall() + "mm of"
+ " rain and " + weather.getOneHourSnowfall() + "mm of snow.");
System.out.println("If three-hour precipitation data is reported, it's " + weather.getThreeHourRainfall()
+ "mm of rain and " + weather.getThreeHourSnowfall() + "mm of "
+ "snow. (You might not want to trust those values if they match the 1-hour precipitation.)");
}
public static void main(String... args) {
......@@ -263,6 +261,7 @@ public class Demonstration {
System.err.println("\t" + ioException.getMessage());
System.err.println("Caused by: " + ioException.getCause());
System.err.println("\t" + ioException.getCause().getMessage());
System.exit(1);
}
String dataSet = getDataSet(scanner);
......@@ -271,11 +270,11 @@ public class Demonstration {
System.out.println("Raw JSON: " + data);
if (data != null) {
System.out.println("Location: " + weather.getLatitude() + " latitude, " + weather.getLongitude() + " " +
"longitude");
System.out.println(
"Location: " + weather.getLatitude() + " latitude, " + weather.getLongitude() + " " + "longitude");
Date currentTimeStamp = weather.getTimestamp();
System.out.println("Current timestamp: " +
(currentTimeStamp == OpenWeatherConnector.IMPOSSIBLE_DATE ? "not present" : currentTimeStamp));
System.out.println("Current timestamp: "
+ (currentTimeStamp == OpenWeatherConnector.IMPOSSIBLE_DATE ? "not present" : currentTimeStamp));
System.out.println("Available timestamps: " + weather.getTimestamps());
switch (dataSet) {
......
......@@ -12,8 +12,8 @@ public interface Connection {
/**
* Retrieves data in JSON format.
*
* @param dataSpecification identifies the data to be retrieved; the nature of this String depends on the
* implementing class
* @param dataSpecification identifies the data to be retrieved; the nature of
* this String depends on the implementing class
* @return requested data
* @throws IOException if the data cannot be requested or delivered
* @throws ParseException if the data is not a properly-formatted JSON string
......
......@@ -36,14 +36,15 @@ public class FileConnection implements Connection {
*
* @param filename name of the file containing data
* @return requested data
* @throws IOException if the data cannot be requested or delivered; probably the most-common reason is that
* the requested file is not in the directory
* @throws IOException if the data cannot be requested or delivered; probably
* the most-common reason is that the requested file is
* not in the directory
* @throws ParseException if the data is not a properly-formatted JSON string
*/
public JSONObject get(String filename) throws IOException, ParseException {
JSONObject data;
try (InputStreamReader inputStreamReader = new InputStreamReader(Objects.requireNonNull(
FileConnection.class.getClassLoader().getResourceAsStream(directory + filename)))) {
try (InputStreamReader inputStreamReader = new InputStreamReader(Objects
.requireNonNull(FileConnection.class.getClassLoader().getResourceAsStream(directory + filename)))) {
data = (JSONObject) new JSONParser().parse(inputStreamReader);
} catch (NullPointerException originalException) {
throw new IOException("Could not find " + directory + filename + ".", originalException);
......
......@@ -23,14 +23,16 @@ public class RestConnection implements Connection {
/**
* Retrieves the specified API key from the {@code apikeys.json} file.
*
* @param apiKeyName name of the key to be retrieved
* @return the API key
* @throws IOException if no data stored in {@code apikeys.json} could be retrieved
* @throws IOException if no data stored in {@code apikeys.json} could be
* retrieved
*/
public static String getApiKey(String apiKeyName) throws IOException {
JSONObject apiKeyJson;
try (InputStreamReader inputStreamReader = new InputStreamReader(Objects.requireNonNull(
Demonstration.class.getClassLoader().getResourceAsStream(FILENAME)))) {
try (InputStreamReader inputStreamReader = new InputStreamReader(
Objects.requireNonNull(Demonstration.class.getClassLoader().getResourceAsStream(FILENAME)))) {
apiKeyJson = (JSONObject) new JSONParser().parse(inputStreamReader);
} catch (NullPointerException nullPointerException) {
FileNotFoundException newException = new FileNotFoundException("File " + FILENAME + " not found.");
......@@ -60,7 +62,8 @@ public class RestConnection implements Connection {
* @param protocol transfer protocol to be used, typically as "http"
* @param authority service provider, typically the server's fully-resolved name
* @param path filepath on the authority to the REST service
* @param apiKey token provided by service owner to authenticate requester and grant appropriate privileges
* @param apiKey token provided by service owner to authenticate requester
* and grant appropriate privileges
*/
public RestConnection(String protocol, String authority, String path, String apiKey) {
this.protocol = protocol;
......@@ -74,18 +77,15 @@ public class RestConnection implements Connection {
*
* @param query the REST query specifying the requested data
* @return requested data
* @throws IOException if the data cannot be requested or delivered, such as an incorrect URL or network problems
* @throws IOException if the data cannot be requested or delivered, such as
* an incorrect URL or network problems
* @throws ParseException if the data is not a properly-formatted JSON string
*/
public JSONObject get(String query) throws IOException, ParseException {
JSONObject data;
try {
URLConnection connection =
new URI(protocol,
authority,
path,
query + "&appid=" + apiKey,
null).toURL().openConnection();
URLConnection connection = new URI(protocol, authority, path, query + "&appid=" + apiKey, null).toURL()
.openConnection();
connection.setRequestProperty("Accept", "application/json");
InputStreamReader inputStreamReader = new InputStreamReader(connection.getInputStream());
data = (JSONObject) new JSONParser().parse(inputStreamReader);
......
......@@ -48,7 +48,8 @@ public class AirPollution_UnlNov24ToNov27Test {
@Test
public void testNO() {
// This is interesting. Normally a double, this report has NO as 0 instead of 0.0.
// This is interesting. Normally a double, this report has NO as 0 instead of
// 0.0.
double expectedValue = 0.0;
double actualValue = connector.getNitrogenMonoxide(timestamps.get(1));
assertEquals(expectedValue, actualValue, 0.0001);
......
......@@ -40,9 +40,8 @@ public class Forecast_UnlNov7ToNov12Test {
@Test
public void testWeather() {
Date timestamp = Sunday;
List<OpenWeatherConnector.WeatherCategory> expectedCategories = List.of(
OpenWeatherConnector.WeatherCategory.CLEAR
);
List<OpenWeatherConnector.WeatherCategory> expectedCategories = List
.of(OpenWeatherConnector.WeatherCategory.CLEAR);
List<String> expectedDescriptions = List.of("clear sky");
int expectedListSize = 1;
List<OpenWeatherConnector.WeatherCategory> actualCategories = connector.getWeatherCategories(timestamp);
......
......@@ -50,12 +50,12 @@ public class OneCall_WebsiteExampleTest {
List<String> expectedMinutes = List.of("Tue Apr 13 07:31:00 CDT 2021");
List<String> expectedHours = List.of("Tue Apr 13 07:00:00 CDT 2021");
List<String> expectedDays = List.of("Tue Apr 13 05:00:00 CDT 2021");
List<String> actualMinutes = connector.getTimestamps("minutely")
.stream().map(Date::toString).collect(Collectors.toList());
List<String> actualHours = connector.getTimestamps("hourly")
.stream().map(Date::toString).collect(Collectors.toList());
List<String> actualDays = connector.getTimestamps("daily")
.stream().map(Date::toString).collect(Collectors.toList());
List<String> actualMinutes = connector.getTimestamps("minutely").stream().map(Date::toString)
.collect(Collectors.toList());
List<String> actualHours = connector.getTimestamps("hourly").stream().map(Date::toString)
.collect(Collectors.toList());
List<String> actualDays = connector.getTimestamps("daily").stream().map(Date::toString)
.collect(Collectors.toList());
assertEquals(expectedMinutes, actualMinutes);
assertEquals(expectedHours, actualHours);
assertEquals(expectedDays, actualDays);
......@@ -135,9 +135,8 @@ public class OneCall_WebsiteExampleTest {
@Test
public void testWeatherForecast() {
List<OpenWeatherConnector.WeatherCategory> expectedCategories = List.of(
OpenWeatherConnector.WeatherCategory.CLOUDS
);
List<OpenWeatherConnector.WeatherCategory> expectedCategories = List
.of(OpenWeatherConnector.WeatherCategory.CLOUDS);
List<String> expectedDescriptions = List.of("few clouds");
int expectedListSize = 1;
List<OpenWeatherConnector.WeatherCategory> actualCategories = connector.getWeatherCategories(hourly);
......
......@@ -14,8 +14,10 @@ import static org.junit.Assert.assertEquals;
public class Weather_UnlOct24At0917Test {
private OpenWeatherConnector connector;
/* Demonstrates most fields; gust is distinct from wind speed; 3hr rain defaults to 1hr rain; no snow; multiple
weather categories */
/*
* Demonstrates most fields; gust is distinct from wind speed; 3hr rain defaults
* to 1hr rain; no snow; multiple weather categories
*/
@Before
public void setup() throws IOException {
......@@ -44,10 +46,8 @@ public class Weather_UnlOct24At0917Test {
@Test
public void testWeather() {
List<OpenWeatherConnector.WeatherCategory> expectedCategories = List.of(
OpenWeatherConnector.WeatherCategory.MIST,
OpenWeatherConnector.WeatherCategory.RAIN,
OpenWeatherConnector.WeatherCategory.THUNDERSTORM
);
OpenWeatherConnector.WeatherCategory.MIST, OpenWeatherConnector.WeatherCategory.RAIN,
OpenWeatherConnector.WeatherCategory.THUNDERSTORM);
List<String> expectedDescriptions = Arrays.asList("mist", "light rain", "thunderstorm with light rain");
int expectedListSize = 3;
List<OpenWeatherConnector.WeatherCategory> actualCategories = connector.getWeatherCategories();
......
......@@ -14,7 +14,10 @@ import static org.junit.Assert.*;
public class Weather_WebsiteExampleTest {
private OpenWeatherConnector connector;
/* Demonstrates most fields; gust defaults to wind speed; no rain or snow; one weather category */
/*
* Demonstrates most fields; gust defaults to wind speed; no rain or snow; one
* weather category
*/
@Before
public void setup() throws IOException {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment