diff --git a/README.md b/README.md
index 47b6ca4..a90c113 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@ Paid:
* Hourly Forecast 4 days
* Daily Forecast 16 days
* Climatic 30 days
+* Solar Radiation API
Other:
* Request timeout settings
diff --git a/docs/SNAPSHOT.md b/docs/SNAPSHOT.md
index 5a74194..10314a8 100644
--- a/docs/SNAPSHOT.md
+++ b/docs/SNAPSHOT.md
@@ -3,6 +3,7 @@
* Hourly forecast
* One Call API
* Daily forecast
+* Solar Radiation API
* 5 day / 3-hour forecast
* Air Pollution
* Geocoding API
@@ -344,7 +345,7 @@ You are able to set preferable options(via chain methods) and execute appropriat
| Method | Description |
|-------------------------------|--------------------------------------------------------------------------------|
-| `getCoordinate()` | Returns `Coordinate` object. Available fields: `latitude`, `longitude`. |
+| `getCoordinates()` | Returns `Coordinate` object. Available fields: `latitude`, `longitude`. |
| `getTimezone()` | Returns location timezone object. |
| `getTimezoneOffset()` | Returns zone offset. |
| `getCurrent()` | Returns `Current` object with current weather state if available. |
@@ -432,7 +433,7 @@ You are able to set preferable options(via chain methods) and execute appropriat
| Method | Description |
|-------------------------------|-------------------------------------------------------------------------------|
-| `getCoordinate()` | Returns `Coordinate` object. Available fields: `latitude`, `longitude`. |
+| `getCoordinates()` | Returns `Coordinate` object. Available fields: `latitude`, `longitude`. |
| `getTimezone()` | Returns location timezone object. |
| `getTimezoneOffset()` | Returns zone offset. |
| `getHistoricalWeather()` | Returns `HistoricalWeather` object with historical weather state. |
@@ -495,7 +496,7 @@ final AirPollutionDetails airPollutionDetails = openWeatherClient
| Method | Description |
|-------------------------------|---------------------------------------------------------------------------|
-| `getCoordinate()` | Returns `Coordinate` object. Available fields: `latitude`, `longitude`. |
+| `getCoordinates()` | Returns `Coordinate` object. Available fields: `latitude`, `longitude`. |
| `getAirPollutionRecords()` | Returns list of `AirPollutionRecord` objects. |
`com.github.prominence.openweathermap.api.model.air.pollution.AirPollutionRecord`'s useful public methods(setters are not listed):
diff --git a/src/main/java/com/github/prominence/openweathermap/api/OpenWeatherMapClient.java b/src/main/java/com/github/prominence/openweathermap/api/OpenWeatherMapClient.java
index 3981fd6..7698d4a 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/OpenWeatherMapClient.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/OpenWeatherMapClient.java
@@ -32,6 +32,7 @@ import com.github.prominence.openweathermap.api.request.forecast.free.FiveDayThr
import com.github.prominence.openweathermap.api.request.forecast.hourly.FourDaysHourlyForecastRequester;
import com.github.prominence.openweathermap.api.request.geocoding.GeocodingRequester;
import com.github.prominence.openweathermap.api.request.onecall.OneCallWeatherRequester;
+import com.github.prominence.openweathermap.api.request.radiation.SolarRadiationRequester;
import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherRequester;
import static com.github.prominence.openweathermap.api.enums.SubscriptionPlan.*;
@@ -106,6 +107,11 @@ public class OpenWeatherMapClient {
return new ClimaticForecastRequester(new RequestSettings(apiKey, timeoutSettings));
}
+ @SubscriptionAvailability(plans = SPECIAL)
+ public SolarRadiationRequester solarRadiation() {
+ return new SolarRadiationRequester(new RequestSettings(apiKey, timeoutSettings));
+ }
+
/**
* 5 Day / 3 Hour Forecast API.
* @return requester for retrieving 5 day/3-hour weather forecast information.
diff --git a/src/main/java/com/github/prominence/openweathermap/api/deserializer/forecast/climatic/ClimaticForecastLocationDeserializer.java b/src/main/java/com/github/prominence/openweathermap/api/deserializer/forecast/climatic/ClimaticForecastLocationDeserializer.java
index 97fe05d..7344b85 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/deserializer/forecast/climatic/ClimaticForecastLocationDeserializer.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/deserializer/forecast/climatic/ClimaticForecastLocationDeserializer.java
@@ -41,7 +41,7 @@ public class ClimaticForecastLocationDeserializer extends JsonDeserializer {
+ @Override
+ public SolarRadiationRecord deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JacksonException {
+ final JsonNode rootNode = jsonParser.getCodec().readTree(jsonParser);
+
+ SolarRadiationRecord record = new SolarRadiationRecord();
+ final JsonNode radiationNode = rootNode.get("radiation");
+ record.setMeasurementTime(JsonDeserializationUtils.parseDateTime(rootNode.get("dt")));
+ record.setCloudSkyGlobalHorizontalIrradiance(radiationNode.get("ghi").asDouble());
+ record.setCloudSkyDirectNormalIrradiance(radiationNode.get("dni").asDouble());
+ record.setCloudSkyDiffuseHorizontalIrradiance(radiationNode.get("dhi").asDouble());
+ record.setClearSkyGlobalHorizontalIrradiance(radiationNode.get("ghi_cs").asDouble());
+ record.setClearSkyDirectNormalIrradiance(radiationNode.get("dni_cs").asDouble());
+ record.setClearSkyDiffuseHorizontalIrradiance(radiationNode.get("dhi_cs").asDouble());
+ return record;
+ }
+}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/deserializer/weather/WeatherLocationDeserializer.java b/src/main/java/com/github/prominence/openweathermap/api/deserializer/weather/WeatherLocationDeserializer.java
index d0ddbde..5f60eaf 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/deserializer/weather/WeatherLocationDeserializer.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/deserializer/weather/WeatherLocationDeserializer.java
@@ -77,7 +77,7 @@ public class WeatherLocationDeserializer extends JsonDeserializer {
final JsonNode coordNode = rootNode.get("coord");
if (coordNode != null) {
- location.setCoordinate(objectMapper.readValue(objectMapper.treeAsTokens(coordNode), Coordinates.class));
+ location.setCoordinates(objectMapper.readValue(objectMapper.treeAsTokens(coordNode), Coordinates.class));
}
return location;
diff --git a/src/main/java/com/github/prominence/openweathermap/api/enums/SubscriptionPlan.java b/src/main/java/com/github/prominence/openweathermap/api/enums/SubscriptionPlan.java
index 0de8a7f..e96f693 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/enums/SubscriptionPlan.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/enums/SubscriptionPlan.java
@@ -27,11 +27,6 @@ package com.github.prominence.openweathermap.api.enums;
* More information at official website.
*/
public enum SubscriptionPlan {
- /**
- * Free subscription plan.
- */
- FREE,
-
/**
* An alias that represents any of paid plans: startup, developer, professional or enterprise.
*/
@@ -57,6 +52,12 @@ public enum SubscriptionPlan {
*/
ENTERPRISE,
+ /**
+ * Special subscription plan. You should contact a manager to get an access.
+ */
+ SPECIAL,
+
+
/**
* All existing subscription plans.
*/
diff --git a/src/main/java/com/github/prominence/openweathermap/api/mapper/AirPollutionResponseMapper.java b/src/main/java/com/github/prominence/openweathermap/api/mapper/AirPollutionResponseMapper.java
index 94d5fd3..a0aabb4 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/mapper/AirPollutionResponseMapper.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/mapper/AirPollutionResponseMapper.java
@@ -61,7 +61,7 @@ public class AirPollutionResponseMapper {
private AirPollutionDetails mapToAirPollution(JsonNode rootNode) {
final AirPollutionDetails airPollutionDetails = new AirPollutionDetails();
- airPollutionDetails.setCoordinate(parseCoordinate(rootNode.get("coord")));
+ airPollutionDetails.setCoordinates(parseCoordinate(rootNode.get("coord")));
final List sampleList = new ArrayList<>();
final JsonNode sampleListNode = rootNode.get("list");
diff --git a/src/main/java/com/github/prominence/openweathermap/api/mapper/FiveDayThreeHourStepForecastResponseMapper.java b/src/main/java/com/github/prominence/openweathermap/api/mapper/FiveDayThreeHourStepForecastResponseMapper.java
index 3a7d693..369dc9e 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/mapper/FiveDayThreeHourStepForecastResponseMapper.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/mapper/FiveDayThreeHourStepForecastResponseMapper.java
@@ -207,7 +207,7 @@ public class FiveDayThreeHourStepForecastResponseMapper {
final JsonNode coordNode = rootNode.get("coord");
if (coordNode != null) {
- location.setCoordinate(parseCoordinate(coordNode));
+ location.setCoordinates(parseCoordinate(coordNode));
}
final JsonNode populationNode = rootNode.get("population");
diff --git a/src/main/java/com/github/prominence/openweathermap/api/mapper/OneCallWeatherResponseMapper.java b/src/main/java/com/github/prominence/openweathermap/api/mapper/OneCallWeatherResponseMapper.java
index 4af0cb1..643894f 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/mapper/OneCallWeatherResponseMapper.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/mapper/OneCallWeatherResponseMapper.java
@@ -111,7 +111,7 @@ public class OneCallWeatherResponseMapper extends AbstractMapper {
private CurrentWeatherData mapToCurrent(JsonNode rootNode) throws IOException {
final CurrentWeatherData currentData = new CurrentWeatherData();
- currentData.setCoordinate(objectMapper.readValue(objectMapper.treeAsTokens(rootNode), Coordinates.class));
+ currentData.setCoordinates(objectMapper.readValue(objectMapper.treeAsTokens(rootNode), Coordinates.class));
currentData.setTimezone(parseZoneId(rootNode.get("timezone")));
currentData.setTimezoneOffset(parseZoneOffset(rootNode.get("timezone_offset")));
@@ -261,7 +261,7 @@ public class OneCallWeatherResponseMapper extends AbstractMapper {
private HistoricalWeatherData mapToHistorical(JsonNode rootNode) throws IOException {
final HistoricalWeatherData historicalData = new HistoricalWeatherData();
- historicalData.setCoordinate(Coordinates.of(rootNode.get("lat").asDouble(), rootNode.get("lon").asDouble()));
+ historicalData.setCoordinates(Coordinates.of(rootNode.get("lat").asDouble(), rootNode.get("lon").asDouble()));
historicalData.setTimezone(parseZoneId(rootNode.get("timezone")));
historicalData.setTimezoneOffset(parseZoneOffset(rootNode.get("timezone_offset")));
historicalData.setHistoricalWeather(parseHistoricalWeather(rootNode.get("current")));
diff --git a/src/main/java/com/github/prominence/openweathermap/api/mapper/SolarRadiationResponseMapper.java b/src/main/java/com/github/prominence/openweathermap/api/mapper/SolarRadiationResponseMapper.java
new file mode 100644
index 0000000..f99a3b9
--- /dev/null
+++ b/src/main/java/com/github/prominence/openweathermap/api/mapper/SolarRadiationResponseMapper.java
@@ -0,0 +1,49 @@
+package com.github.prominence.openweathermap.api.mapper;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.github.prominence.openweathermap.api.deserializer.CoordinatesDeserializer;
+import com.github.prominence.openweathermap.api.deserializer.radiation.SolarRadiationRecordDeserializer;
+import com.github.prominence.openweathermap.api.model.Coordinates;
+import com.github.prominence.openweathermap.api.model.radiation.SolarRadiation;
+import com.github.prominence.openweathermap.api.model.radiation.SolarRadiationRecord;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SolarRadiationResponseMapper extends AbstractMapper {
+
+ public SolarRadiationResponseMapper() {
+ final SimpleModule module = new SimpleModule();
+ module.addDeserializer(SolarRadiationRecord.class, new SolarRadiationRecordDeserializer());
+ module.addDeserializer(Coordinates.class, new CoordinatesDeserializer());
+ objectMapper.registerModule(module);
+ }
+
+ public SolarRadiation mapToObject(String jsonResponse) {
+ SolarRadiation solarRadiation;
+ try {
+ final JsonNode root = objectMapper.readTree(jsonResponse);
+ solarRadiation = mapToObject(root);
+ } catch (IOException e) {
+ throw new RuntimeException("Cannot parse SolarRadiation response", e);
+ }
+
+ return solarRadiation;
+ }
+
+ private SolarRadiation mapToObject(JsonNode rootNode) throws IOException {
+ final SolarRadiation solarRadiation = new SolarRadiation();
+ solarRadiation.setCoordinates(objectMapper.readValue(objectMapper.treeAsTokens(rootNode.get("coord")), Coordinates.class));
+
+ final JsonNode listRecordsNode = rootNode.get("list");
+ List radiationRecords = new ArrayList<>();
+ for (JsonNode recordNode : listRecordsNode) {
+ radiationRecords.add(objectMapper.readValue(objectMapper.treeAsTokens(recordNode), SolarRadiationRecord.class));
+ }
+ solarRadiation.setSolarRadiationRecords(radiationRecords);
+
+ return solarRadiation;
+ }
+}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/model/air/pollution/AirPollutionDetails.java b/src/main/java/com/github/prominence/openweathermap/api/model/air/pollution/AirPollutionDetails.java
index 7afc9e4..ba6fbf4 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/model/air/pollution/AirPollutionDetails.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/model/air/pollution/AirPollutionDetails.java
@@ -41,7 +41,7 @@ public class AirPollutionDetails {
*
* @return the coordinate
*/
- public Coordinates getCoordinate() {
+ public Coordinates getCoordinates() {
return coordinates;
}
@@ -50,7 +50,7 @@ public class AirPollutionDetails {
*
* @param coordinates the coordinate
*/
- public void setCoordinate(Coordinates coordinates) {
+ public void setCoordinates(Coordinates coordinates) {
this.coordinates = coordinates;
}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/model/forecast/climatic/Location.java b/src/main/java/com/github/prominence/openweathermap/api/model/forecast/climatic/Location.java
index f541191..1730300 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/model/forecast/climatic/Location.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/model/forecast/climatic/Location.java
@@ -127,7 +127,7 @@ public class Location {
* Returns location coordinates.
* @return location coordinates.
*/
- public Coordinates getCoordinate() {
+ public Coordinates getCoordinates() {
return coordinates;
}
@@ -135,7 +135,7 @@ public class Location {
* Sets location coordinates.
* @param coordinates location coordinates
*/
- public void setCoordinate(Coordinates coordinates) {
+ public void setCoordinates(Coordinates coordinates) {
this.coordinates = coordinates;
}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/model/forecast/daily/Location.java b/src/main/java/com/github/prominence/openweathermap/api/model/forecast/daily/Location.java
index 4cb0beb..788473f 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/model/forecast/daily/Location.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/model/forecast/daily/Location.java
@@ -127,7 +127,7 @@ public class Location {
* Returns location coordinates.
* @return location coordinates.
*/
- public Coordinates getCoordinate() {
+ public Coordinates getCoordinates() {
return coordinates;
}
@@ -135,7 +135,7 @@ public class Location {
* Sets location coordinates.
* @param coordinates location coordinates
*/
- public void setCoordinate(Coordinates coordinates) {
+ public void setCoordinates(Coordinates coordinates) {
this.coordinates = coordinates;
}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/model/forecast/free/Location.java b/src/main/java/com/github/prominence/openweathermap/api/model/forecast/free/Location.java
index e45c629..387cb1d 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/model/forecast/free/Location.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/model/forecast/free/Location.java
@@ -162,7 +162,7 @@ public class Location {
* Returns location coordinates.
* @return location coordinates.
*/
- public Coordinates getCoordinate() {
+ public Coordinates getCoordinates() {
return coordinates;
}
@@ -170,7 +170,7 @@ public class Location {
* Sets location coordinates.
* @param coordinates location coordinates
*/
- public void setCoordinate(Coordinates coordinates) {
+ public void setCoordinates(Coordinates coordinates) {
this.coordinates = coordinates;
}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/model/forecast/hourly/Location.java b/src/main/java/com/github/prominence/openweathermap/api/model/forecast/hourly/Location.java
index 2a3a738..a13f16e 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/model/forecast/hourly/Location.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/model/forecast/hourly/Location.java
@@ -160,7 +160,7 @@ public class Location {
* Returns location coordinates.
* @return location coordinates.
*/
- public Coordinates getCoordinate() {
+ public Coordinates getCoordinates() {
return coordinates;
}
@@ -168,7 +168,7 @@ public class Location {
* Sets location coordinates.
* @param coordinates location coordinates
*/
- public void setCoordinate(Coordinates coordinates) {
+ public void setCoordinates(Coordinates coordinates) {
this.coordinates = coordinates;
}
@Override
diff --git a/src/main/java/com/github/prominence/openweathermap/api/model/onecall/current/CurrentWeatherData.java b/src/main/java/com/github/prominence/openweathermap/api/model/onecall/current/CurrentWeatherData.java
index 3057dd8..a437ca4 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/model/onecall/current/CurrentWeatherData.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/model/onecall/current/CurrentWeatherData.java
@@ -49,7 +49,7 @@ public class CurrentWeatherData {
*
* @return the coordinate
*/
- public Coordinates getCoordinate() {
+ public Coordinates getCoordinates() {
return coordinates;
}
@@ -58,7 +58,7 @@ public class CurrentWeatherData {
*
* @param coordinates the coordinate
*/
- public void setCoordinate(Coordinates coordinates) {
+ public void setCoordinates(Coordinates coordinates) {
this.coordinates = coordinates;
}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/model/onecall/historical/HistoricalWeatherData.java b/src/main/java/com/github/prominence/openweathermap/api/model/onecall/historical/HistoricalWeatherData.java
index 5fa7f6f..f89c8eb 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/model/onecall/historical/HistoricalWeatherData.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/model/onecall/historical/HistoricalWeatherData.java
@@ -45,7 +45,7 @@ public class HistoricalWeatherData {
*
* @return the coordinate
*/
- public Coordinates getCoordinate() {
+ public Coordinates getCoordinates() {
return coordinates;
}
@@ -54,7 +54,7 @@ public class HistoricalWeatherData {
*
* @param coordinates the coordinate
*/
- public void setCoordinate(Coordinates coordinates) {
+ public void setCoordinates(Coordinates coordinates) {
this.coordinates = coordinates;
}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/model/radiation/SolarRadiation.java b/src/main/java/com/github/prominence/openweathermap/api/model/radiation/SolarRadiation.java
new file mode 100644
index 0000000..c5b907f
--- /dev/null
+++ b/src/main/java/com/github/prominence/openweathermap/api/model/radiation/SolarRadiation.java
@@ -0,0 +1,48 @@
+package com.github.prominence.openweathermap.api.model.radiation;
+
+import com.github.prominence.openweathermap.api.model.Coordinates;
+
+import java.util.List;
+import java.util.Objects;
+
+public class SolarRadiation {
+ private Coordinates coordinates;
+ List solarRadiationRecords;
+
+ public Coordinates getCoordinates() {
+ return coordinates;
+ }
+
+ public void setCoordinates(Coordinates coordinates) {
+ this.coordinates = coordinates;
+ }
+
+ public List getSolarRadiationRecords() {
+ return solarRadiationRecords;
+ }
+
+ public void setSolarRadiationRecords(List solarRadiationRecords) {
+ this.solarRadiationRecords = solarRadiationRecords;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ SolarRadiation that = (SolarRadiation) o;
+ return Objects.equals(coordinates, that.coordinates) && Objects.equals(solarRadiationRecords, that.solarRadiationRecords);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(coordinates, solarRadiationRecords);
+ }
+
+ @Override
+ public String toString() {
+ return "SolarRadiation{" +
+ "coordinates=" + coordinates +
+ ", solarRadiationRecords=" + solarRadiationRecords +
+ '}';
+ }
+}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/model/radiation/SolarRadiationRecord.java b/src/main/java/com/github/prominence/openweathermap/api/model/radiation/SolarRadiationRecord.java
new file mode 100644
index 0000000..dd6c71a
--- /dev/null
+++ b/src/main/java/com/github/prominence/openweathermap/api/model/radiation/SolarRadiationRecord.java
@@ -0,0 +1,98 @@
+package com.github.prominence.openweathermap.api.model.radiation;
+
+import java.time.LocalDateTime;
+import java.util.Objects;
+
+public class SolarRadiationRecord {
+ private LocalDateTime measurementTime;
+
+ private Double ghi;
+ private Double dni;
+ private Double dhi;
+
+ private Double ghi_cs;
+ private Double dni_cs;
+ private Double dhi_cs;
+
+ public LocalDateTime getMeasurementTime() {
+ return measurementTime;
+ }
+
+ public void setMeasurementTime(LocalDateTime measurementTime) {
+ this.measurementTime = measurementTime;
+ }
+
+ public Double getCloudSkyGlobalHorizontalIrradiance() {
+ return ghi;
+ }
+
+ public void setCloudSkyGlobalHorizontalIrradiance(Double ghi) {
+ this.ghi = ghi;
+ }
+
+ public Double getCloudSkyDirectNormalIrradiance() {
+ return dni;
+ }
+
+ public void setCloudSkyDirectNormalIrradiance(Double dni) {
+ this.dni = dni;
+ }
+
+ public Double getCloudSkyDiffuseHorizontalIrradiance() {
+ return dhi;
+ }
+
+ public void setCloudSkyDiffuseHorizontalIrradiance(Double dhi) {
+ this.dhi = dhi;
+ }
+
+ public Double getClearSkyGlobalHorizontalIrradiance() {
+ return ghi_cs;
+ }
+
+ public void setClearSkyGlobalHorizontalIrradiance(Double ghi_cs) {
+ this.ghi_cs = ghi_cs;
+ }
+
+ public Double getClearSkyDirectNormalIrradiance() {
+ return dni_cs;
+ }
+
+ public void setClearSkyDirectNormalIrradiance(Double dni_cs) {
+ this.dni_cs = dni_cs;
+ }
+
+ public Double getClearSkyDiffuseHorizontalIrradiance() {
+ return dhi_cs;
+ }
+
+ public void setClearSkyDiffuseHorizontalIrradiance(Double dhi_cs) {
+ this.dhi_cs = dhi_cs;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ SolarRadiationRecord that = (SolarRadiationRecord) o;
+ return Objects.equals(measurementTime, that.measurementTime) && Objects.equals(ghi, that.ghi) && Objects.equals(dni, that.dni) && Objects.equals(dhi, that.dhi) && Objects.equals(ghi_cs, that.ghi_cs) && Objects.equals(dni_cs, that.dni_cs) && Objects.equals(dhi_cs, that.dhi_cs);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(measurementTime, ghi, dni, dhi, ghi_cs, dni_cs, dhi_cs);
+ }
+
+ @Override
+ public String toString() {
+ return "SolarRadiationRecord{" +
+ "measurementTime=" + measurementTime +
+ ", ghi=" + ghi +
+ ", dni=" + dni +
+ ", dhi=" + dhi +
+ ", ghi_cs=" + ghi_cs +
+ ", dni_cs=" + dni_cs +
+ ", dhi_cs=" + dhi_cs +
+ '}';
+ }
+}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/model/weather/Location.java b/src/main/java/com/github/prominence/openweathermap/api/model/weather/Location.java
index fae0cd7..ef63e2f 100644
--- a/src/main/java/com/github/prominence/openweathermap/api/model/weather/Location.java
+++ b/src/main/java/com/github/prominence/openweathermap/api/model/weather/Location.java
@@ -174,7 +174,7 @@ public class Location {
*
* @return location coordinates.
*/
- public Coordinates getCoordinate() {
+ public Coordinates getCoordinates() {
return coordinates;
}
@@ -183,7 +183,7 @@ public class Location {
*
* @param coordinates location coordinates
*/
- public void setCoordinate(Coordinates coordinates) {
+ public void setCoordinates(Coordinates coordinates) {
this.coordinates = coordinates;
}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/request/radiation/CurrentSolarRadiationRequester.java b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/CurrentSolarRadiationRequester.java
new file mode 100644
index 0000000..b45fc1f
--- /dev/null
+++ b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/CurrentSolarRadiationRequester.java
@@ -0,0 +1,18 @@
+package com.github.prominence.openweathermap.api.request.radiation;
+
+import com.github.prominence.openweathermap.api.model.Coordinates;
+import com.github.prominence.openweathermap.api.request.RequestSettings;
+
+public class CurrentSolarRadiationRequester {
+ private final RequestSettings requestSettings;
+
+ public CurrentSolarRadiationRequester(RequestSettings requestSettings) {
+ this.requestSettings = requestSettings;
+ }
+
+ public SolarRadiationRequestCustomizer byCoordinates(Coordinates coordinates) {
+ requestSettings.putRequestParameter("lat", String.valueOf(coordinates.getLatitude()));
+ requestSettings.putRequestParameter("lon", String.valueOf(coordinates.getLongitude()));
+ return new SolarRadiationRequestCustomizer(requestSettings);
+ }
+}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/request/radiation/ForecastSolarRadiationRequester.java b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/ForecastSolarRadiationRequester.java
new file mode 100644
index 0000000..e7c37d8
--- /dev/null
+++ b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/ForecastSolarRadiationRequester.java
@@ -0,0 +1,18 @@
+package com.github.prominence.openweathermap.api.request.radiation;
+
+import com.github.prominence.openweathermap.api.model.Coordinates;
+import com.github.prominence.openweathermap.api.request.RequestSettings;
+
+public class ForecastSolarRadiationRequester {
+ private final RequestSettings requestSettings;
+
+ public ForecastSolarRadiationRequester(RequestSettings requestSettings) {
+ this.requestSettings = requestSettings;
+ }
+
+ public SolarRadiationRequestCustomizer byCoordinates(Coordinates coordinates) {
+ requestSettings.putRequestParameter("lat", String.valueOf(coordinates.getLatitude()));
+ requestSettings.putRequestParameter("lon", String.valueOf(coordinates.getLongitude()));
+ return new SolarRadiationRequestCustomizer(requestSettings);
+ }
+}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/request/radiation/HistoricalSolarRadiationRequester.java b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/HistoricalSolarRadiationRequester.java
new file mode 100644
index 0000000..e01412f
--- /dev/null
+++ b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/HistoricalSolarRadiationRequester.java
@@ -0,0 +1,23 @@
+package com.github.prominence.openweathermap.api.request.radiation;
+
+import com.github.prominence.openweathermap.api.model.Coordinates;
+import com.github.prominence.openweathermap.api.request.RequestSettings;
+
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+
+public class HistoricalSolarRadiationRequester {
+ private final RequestSettings requestSettings;
+
+ public HistoricalSolarRadiationRequester(RequestSettings requestSettings) {
+ this.requestSettings = requestSettings;
+ }
+
+ public SolarRadiationRequestCustomizer byCoordinates(Coordinates coordinates, LocalDateTime startDate, LocalDateTime endDate) {
+ requestSettings.putRequestParameter("lat", String.valueOf(coordinates.getLatitude()));
+ requestSettings.putRequestParameter("lon", String.valueOf(coordinates.getLongitude()));
+ requestSettings.putRequestParameter("start", String.valueOf(startDate.atZone(ZoneId.systemDefault()).toEpochSecond()));
+ requestSettings.putRequestParameter("end", String.valueOf(endDate.atZone(ZoneId.systemDefault()).toEpochSecond()));
+ return new SolarRadiationRequestCustomizer(requestSettings);
+ }
+}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationAsyncRequestTerminator.java b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationAsyncRequestTerminator.java
new file mode 100644
index 0000000..97fde0f
--- /dev/null
+++ b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationAsyncRequestTerminator.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2021 Alexey Zinchenko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package com.github.prominence.openweathermap.api.request.radiation;
+
+import com.github.prominence.openweathermap.api.mapper.SolarRadiationResponseMapper;
+import com.github.prominence.openweathermap.api.model.radiation.SolarRadiation;
+import com.github.prominence.openweathermap.api.request.RequestSettings;
+import com.github.prominence.openweathermap.api.utils.RequestUtils;
+
+import java.util.concurrent.CompletableFuture;
+
+class SolarRadiationAsyncRequestTerminator {
+ private final RequestSettings requestSettings;
+
+ public SolarRadiationAsyncRequestTerminator(RequestSettings requestSettings) {
+ this.requestSettings = requestSettings;
+ }
+
+ public CompletableFuture asJava() {
+ return CompletableFuture.supplyAsync(() -> new SolarRadiationResponseMapper().mapToObject(getRawResponse()));
+ }
+
+ public CompletableFuture asJSON() {
+ return CompletableFuture.supplyAsync(this::getRawResponse);
+ }
+
+ private String getRawResponse() {
+ return RequestUtils.getResponse(requestSettings);
+ }
+}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationRequestCustomizer.java b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationRequestCustomizer.java
new file mode 100644
index 0000000..aafb978
--- /dev/null
+++ b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationRequestCustomizer.java
@@ -0,0 +1,19 @@
+package com.github.prominence.openweathermap.api.request.radiation;
+
+import com.github.prominence.openweathermap.api.request.RequestSettings;
+
+public class SolarRadiationRequestCustomizer {
+ private final RequestSettings requestSettings;
+
+ public SolarRadiationRequestCustomizer(RequestSettings requestSettings) {
+ this.requestSettings = requestSettings;
+ }
+
+ public SolarRadiationRequestTerminator retrieve() {
+ return new SolarRadiationRequestTerminator(requestSettings);
+ }
+
+ public SolarRadiationAsyncRequestTerminator retrieveAsync() {
+ return new SolarRadiationAsyncRequestTerminator(requestSettings);
+ }
+}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationRequestTerminator.java b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationRequestTerminator.java
new file mode 100644
index 0000000..55a1699
--- /dev/null
+++ b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationRequestTerminator.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2021 Alexey Zinchenko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package com.github.prominence.openweathermap.api.request.radiation;
+
+import com.github.prominence.openweathermap.api.mapper.SolarRadiationResponseMapper;
+import com.github.prominence.openweathermap.api.model.radiation.SolarRadiation;
+import com.github.prominence.openweathermap.api.request.RequestSettings;
+import com.github.prominence.openweathermap.api.utils.RequestUtils;
+
+class SolarRadiationRequestTerminator {
+ private final RequestSettings requestSettings;
+
+ public SolarRadiationRequestTerminator(RequestSettings requestSettings) {
+ this.requestSettings = requestSettings;
+ }
+
+ public SolarRadiation asJava() {
+ return new SolarRadiationResponseMapper().mapToObject(getRawResponse());
+ }
+
+ public String asJSON() {
+ return getRawResponse();
+ }
+
+ private String getRawResponse() {
+ return RequestUtils.getResponse(requestSettings);
+ }
+}
diff --git a/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationRequester.java b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationRequester.java
new file mode 100644
index 0000000..d47652d
--- /dev/null
+++ b/src/main/java/com/github/prominence/openweathermap/api/request/radiation/SolarRadiationRequester.java
@@ -0,0 +1,26 @@
+package com.github.prominence.openweathermap.api.request.radiation;
+
+import com.github.prominence.openweathermap.api.request.RequestSettings;
+
+public class SolarRadiationRequester {
+ private final RequestSettings requestSettings;
+
+ public SolarRadiationRequester(RequestSettings requestSettings) {
+ this.requestSettings = requestSettings;
+ this.requestSettings.appendToURL("data/2.5/solar_radiation");
+ }
+
+ public CurrentSolarRadiationRequester current() {
+ return new CurrentSolarRadiationRequester(requestSettings);
+ }
+
+ public ForecastSolarRadiationRequester forecast() {
+ requestSettings.appendToURL("/forecast");
+ return new ForecastSolarRadiationRequester(requestSettings);
+ }
+
+ public HistoricalSolarRadiationRequester historical() {
+ requestSettings.appendToURL("/history");
+ return new HistoricalSolarRadiationRequester(requestSettings);
+ }
+}
diff --git a/src/test/java/com/github/prominence/openweathermap/api/mapper/ClimaticForecastResponseMapperTest.java b/src/test/java/com/github/prominence/openweathermap/api/mapper/ClimaticForecastResponseMapperTest.java
index 3f97f38..ac9df48 100644
--- a/src/test/java/com/github/prominence/openweathermap/api/mapper/ClimaticForecastResponseMapperTest.java
+++ b/src/test/java/com/github/prominence/openweathermap/api/mapper/ClimaticForecastResponseMapperTest.java
@@ -72,7 +72,7 @@ class ClimaticForecastResponseMapperTest {
final Location location = forecast.getLocation();
assertNotNull(location);
- assertEquals(Coordinates.of(51.5073, -0.1277), location.getCoordinate());
+ assertEquals(Coordinates.of(51.5073, -0.1277), location.getCoordinates());
assertEquals(2643743, location.getId());
assertEquals("London", location.getName());
assertEquals("GB", location.getCountryCode());
diff --git a/src/test/java/com/github/prominence/openweathermap/api/mapper/CurrentWeatherResponseMapperTest.java b/src/test/java/com/github/prominence/openweathermap/api/mapper/CurrentWeatherResponseMapperTest.java
index 3bdc899..b387ecd 100644
--- a/src/test/java/com/github/prominence/openweathermap/api/mapper/CurrentWeatherResponseMapperTest.java
+++ b/src/test/java/com/github/prominence/openweathermap/api/mapper/CurrentWeatherResponseMapperTest.java
@@ -1096,7 +1096,7 @@ public class CurrentWeatherResponseMapperTest {
Weather weather = mapper.mapToWeather(jsonString);
- assertNotNull(weather.getLocation().getCoordinate());
+ assertNotNull(weather.getLocation().getCoordinates());
assertNotNull(weather.getLocation().getCountryCode());
// without coordinates and country code
@@ -1144,7 +1144,7 @@ public class CurrentWeatherResponseMapperTest {
}
""";
weather = mapper.mapToWeather(jsonString);
- assertNull(weather.getLocation().getCoordinate());
+ assertNull(weather.getLocation().getCoordinates());
assertNull(weather.getLocation().getCountryCode());
// coordinates without latitude
@@ -1196,7 +1196,7 @@ public class CurrentWeatherResponseMapperTest {
}
""";
weather = mapper.mapToWeather(jsonString);
- assertNull(weather.getLocation().getCoordinate());
+ assertNull(weather.getLocation().getCoordinates());
assertNotNull(weather.getLocation().getCountryCode());
// coordinates without longitude
@@ -1248,7 +1248,7 @@ public class CurrentWeatherResponseMapperTest {
}
""";
weather = mapper.mapToWeather(jsonString);
- assertNull(weather.getLocation().getCoordinate());
+ assertNull(weather.getLocation().getCoordinates());
assertNotNull(weather.getLocation().getCountryCode());
}
}
\ No newline at end of file
diff --git a/src/test/java/com/github/prominence/openweathermap/api/mapper/DailyForecastResponseMapperTest.java b/src/test/java/com/github/prominence/openweathermap/api/mapper/DailyForecastResponseMapperTest.java
index 081ee6d..c533e6c 100644
--- a/src/test/java/com/github/prominence/openweathermap/api/mapper/DailyForecastResponseMapperTest.java
+++ b/src/test/java/com/github/prominence/openweathermap/api/mapper/DailyForecastResponseMapperTest.java
@@ -79,7 +79,7 @@ class DailyForecastResponseMapperTest {
final Location location = forecast.getLocation();
assertNotNull(location);
- assertEquals(Coordinates.of(51.5085, -0.1258), location.getCoordinate());
+ assertEquals(Coordinates.of(51.5085, -0.1258), location.getCoordinates());
assertEquals(2643743, location.getId());
assertEquals("London", location.getName());
assertEquals("GB", location.getCountryCode());
diff --git a/src/test/java/com/github/prominence/openweathermap/api/mapper/HourlyForecastResponseMapperTest.java b/src/test/java/com/github/prominence/openweathermap/api/mapper/HourlyForecastResponseMapperTest.java
index 63f34f9..aa41fb6 100644
--- a/src/test/java/com/github/prominence/openweathermap/api/mapper/HourlyForecastResponseMapperTest.java
+++ b/src/test/java/com/github/prominence/openweathermap/api/mapper/HourlyForecastResponseMapperTest.java
@@ -109,7 +109,7 @@ class HourlyForecastResponseMapperTest {
final Location location = hourlyForecast.getLocation();
assertEquals(2643743, location.getId());
assertEquals("London", location.getName());
- assertEquals(Coordinates.of(51.5085, -0.1258), location.getCoordinate());
+ assertEquals(Coordinates.of(51.5085, -0.1258), location.getCoordinates());
assertEquals("GB", location.getCountryCode());
assertEquals(ZoneOffset.ofTotalSeconds(0), location.getZoneOffset());
assertEquals(LocalDateTime.ofInstant(Instant.ofEpochSecond(1568958164), TimeZone.getDefault().toZoneId()), location.getSunriseTime());
diff --git a/src/test/java/com/github/prominence/openweathermap/api/mapper/SolarRadiationResponseMapperTest.java b/src/test/java/com/github/prominence/openweathermap/api/mapper/SolarRadiationResponseMapperTest.java
new file mode 100644
index 0000000..83fd3c6
--- /dev/null
+++ b/src/test/java/com/github/prominence/openweathermap/api/mapper/SolarRadiationResponseMapperTest.java
@@ -0,0 +1,56 @@
+package com.github.prominence.openweathermap.api.mapper;
+
+import com.github.prominence.openweathermap.api.model.Coordinates;
+import com.github.prominence.openweathermap.api.model.radiation.SolarRadiation;
+import com.github.prominence.openweathermap.api.model.radiation.SolarRadiationRecord;
+import com.github.prominence.openweathermap.api.utils.TestMappingUtils;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class SolarRadiationResponseMapperTest {
+
+ @Test
+ void mapToObject() {
+ final String jsonResponse = """
+ {
+ "coord": {
+ "lon": -114.6244,
+ "lat": 32.7243
+ },
+ "list": [
+ {
+ "radiation": {
+ "ghi": 206.68,
+ "dni": 2.27,
+ "dhi": 204.83,
+ "ghi_cs": 826.71,
+ "dni_cs": 885.47,
+ "dhi_cs": 114.93
+ },
+ "dt": 1618232400
+ }
+ ]
+ }
+ """;
+
+ final SolarRadiation solarRadiation = new SolarRadiationResponseMapper().mapToObject(jsonResponse);
+ assertNotNull(solarRadiation);
+
+ assertEquals(Coordinates.of(32.7243, -114.6244), solarRadiation.getCoordinates());
+
+ final List records = solarRadiation.getSolarRadiationRecords();
+ assertEquals(1, records.size());
+
+ final SolarRadiationRecord record = records.get(0);
+ assertEquals(TestMappingUtils.parseDateTime(1618232400), record.getMeasurementTime());
+ assertEquals(206.68, record.getCloudSkyGlobalHorizontalIrradiance());
+ assertEquals(2.27, record.getCloudSkyDirectNormalIrradiance());
+ assertEquals(204.83, record.getCloudSkyDiffuseHorizontalIrradiance());
+ assertEquals(826.71, record.getClearSkyGlobalHorizontalIrradiance());
+ assertEquals(885.47, record.getClearSkyDirectNormalIrradiance());
+ assertEquals(114.93, record.getClearSkyDiffuseHorizontalIrradiance());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/github/prominence/openweathermap/api/model/air/pollution/AirPollutionDetailsUnitTest.java b/src/test/java/com/github/prominence/openweathermap/api/model/air/pollution/AirPollutionDetailsUnitTest.java
index d98661e..db2f901 100644
--- a/src/test/java/com/github/prominence/openweathermap/api/model/air/pollution/AirPollutionDetailsUnitTest.java
+++ b/src/test/java/com/github/prominence/openweathermap/api/model/air/pollution/AirPollutionDetailsUnitTest.java
@@ -35,12 +35,12 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals;
public class AirPollutionDetailsUnitTest {
@Test
- public void getCoordinate() {
+ public void getCoordinates() {
final AirPollutionDetails airPollutionDetails = new AirPollutionDetails();
final Coordinates coordinates = Coordinates.of(22.3, 44.2);
- airPollutionDetails.setCoordinate(coordinates);
+ airPollutionDetails.setCoordinates(coordinates);
- assertEquals(coordinates, airPollutionDetails.getCoordinate());
+ assertEquals(coordinates, airPollutionDetails.getCoordinates());
}
@Test
@@ -66,11 +66,11 @@ public class AirPollutionDetailsUnitTest {
assertEquals(first, second);
- first.setCoordinate(coordinates);
+ first.setCoordinates(coordinates);
assertNotEquals(first, second);
- second.setCoordinate(coordinates);
+ second.setCoordinates(coordinates);
assertEquals(first, second);
@@ -91,7 +91,7 @@ public class AirPollutionDetailsUnitTest {
assertEquals(first.hashCode(), second.hashCode());
- first.setCoordinate(coordinates);
+ first.setCoordinates(coordinates);
assertNotEquals(first.hashCode(), second.hashCode());
}
diff --git a/src/test/java/com/github/prominence/openweathermap/api/model/forecast/free/LocationUnitTest.java b/src/test/java/com/github/prominence/openweathermap/api/model/forecast/free/LocationUnitTest.java
index 103a5dc..839bb2d 100644
--- a/src/test/java/com/github/prominence/openweathermap/api/model/forecast/free/LocationUnitTest.java
+++ b/src/test/java/com/github/prominence/openweathermap/api/model/forecast/free/LocationUnitTest.java
@@ -96,9 +96,9 @@ public class LocationUnitTest {
public void whenSetCoordinate_thenValueIsSet() {
final Location location = Location.withValues(33, "test");
final Coordinates coordinates = Coordinates.of(33.2, 64.2);
- location.setCoordinate(coordinates);
+ location.setCoordinates(coordinates);
- assertEquals(coordinates, location.getCoordinate());
+ assertEquals(coordinates, location.getCoordinates());
}
@Test
@@ -115,7 +115,7 @@ public class LocationUnitTest {
assertNotEquals("", location.toString());
- location.setCoordinate(Coordinates.of(33.2, 56.3));
+ location.setCoordinates(Coordinates.of(33.2, 56.3));
assertNotEquals("", location.toString());
@@ -203,11 +203,11 @@ public class LocationUnitTest {
final Coordinates coordinates = Coordinates.of(33.5, -22.4);
- one.setCoordinate(coordinates);
+ one.setCoordinates(coordinates);
assertNotEquals(one, two);
- two.setCoordinate(coordinates);
+ two.setCoordinates(coordinates);
assertEquals(one, two);
diff --git a/src/test/java/com/github/prominence/openweathermap/api/model/onecall/current/CurrentWeatherDataUnitTest.java b/src/test/java/com/github/prominence/openweathermap/api/model/onecall/current/CurrentWeatherDataUnitTest.java
index 749c26c..38017e5 100644
--- a/src/test/java/com/github/prominence/openweathermap/api/model/onecall/current/CurrentWeatherDataUnitTest.java
+++ b/src/test/java/com/github/prominence/openweathermap/api/model/onecall/current/CurrentWeatherDataUnitTest.java
@@ -35,12 +35,12 @@ import static org.junit.jupiter.api.Assertions.*;
public class CurrentWeatherDataUnitTest {
@Test
- public void getCoordinate() {
+ public void getCoordinates() {
final CurrentWeatherData currentWeatherData = new CurrentWeatherData();
final Coordinates coordinates = Coordinates.of(11.2, 43.2);
- currentWeatherData.setCoordinate(coordinates);
+ currentWeatherData.setCoordinates(coordinates);
- assertEquals(coordinates, currentWeatherData.getCoordinate());
+ assertEquals(coordinates, currentWeatherData.getCoordinates());
}
@Test
@@ -126,11 +126,11 @@ public class CurrentWeatherDataUnitTest {
assertEquals(first, second);
- first.setCoordinate(coordinates);
+ first.setCoordinates(coordinates);
assertNotEquals(first, second);
- second.setCoordinate(coordinates);
+ second.setCoordinates(coordinates);
assertEquals(first, second);
@@ -198,7 +198,7 @@ public class CurrentWeatherDataUnitTest {
assertEquals(first.hashCode(), second.hashCode());
- first.setCoordinate(Coordinates.of(11, 42));
+ first.setCoordinates(Coordinates.of(11, 42));
assertNotEquals(first.hashCode(), second.hashCode());
}
@@ -206,7 +206,7 @@ public class CurrentWeatherDataUnitTest {
@Test
public void getToString() {
final CurrentWeatherData currentWeatherData = new CurrentWeatherData();
- currentWeatherData.setCoordinate(Coordinates.of(32, 22));
+ currentWeatherData.setCoordinates(Coordinates.of(32, 22));
assertNotNull(currentWeatherData.toString());
assertNotEquals("", currentWeatherData.toString());
diff --git a/src/test/java/com/github/prominence/openweathermap/api/model/onecall/historical/HistoricalWeatherDataUnitTest.java b/src/test/java/com/github/prominence/openweathermap/api/model/onecall/historical/HistoricalWeatherDataUnitTest.java
index 7f51b3d..b3ee4ab 100644
--- a/src/test/java/com/github/prominence/openweathermap/api/model/onecall/historical/HistoricalWeatherDataUnitTest.java
+++ b/src/test/java/com/github/prominence/openweathermap/api/model/onecall/historical/HistoricalWeatherDataUnitTest.java
@@ -34,12 +34,12 @@ import static org.junit.jupiter.api.Assertions.*;
public class HistoricalWeatherDataUnitTest {
@Test
- public void getCoordinate() {
+ public void getCoordinates() {
final HistoricalWeatherData historicalWeatherData = new HistoricalWeatherData();
final Coordinates coordinates = Coordinates.of(11.2, 43.2);
- historicalWeatherData.setCoordinate(coordinates);
+ historicalWeatherData.setCoordinates(coordinates);
- assertEquals(coordinates, historicalWeatherData.getCoordinate());
+ assertEquals(coordinates, historicalWeatherData.getCoordinates());
}
@Test
@@ -95,11 +95,11 @@ public class HistoricalWeatherDataUnitTest {
assertEquals(first, second);
- first.setCoordinate(coordinates);
+ first.setCoordinates(coordinates);
assertNotEquals(first, second);
- second.setCoordinate(coordinates);
+ second.setCoordinates(coordinates);
assertEquals(first, second);
@@ -143,7 +143,7 @@ public class HistoricalWeatherDataUnitTest {
assertEquals(first.hashCode(), second.hashCode());
- first.setCoordinate(Coordinates.of(11, 42));
+ first.setCoordinates(Coordinates.of(11, 42));
assertNotEquals(first.hashCode(), second.hashCode());
}
@@ -151,7 +151,7 @@ public class HistoricalWeatherDataUnitTest {
@Test
public void getToString() {
final HistoricalWeatherData historicalWeatherData = new HistoricalWeatherData();
- historicalWeatherData.setCoordinate(Coordinates.of(32, 22));
+ historicalWeatherData.setCoordinates(Coordinates.of(32, 22));
assertNotNull(historicalWeatherData.toString());
assertNotEquals("", historicalWeatherData.toString());
diff --git a/src/test/java/com/github/prominence/openweathermap/api/model/weather/LocationUnitTest.java b/src/test/java/com/github/prominence/openweathermap/api/model/weather/LocationUnitTest.java
index 4bccf86..a93c862 100644
--- a/src/test/java/com/github/prominence/openweathermap/api/model/weather/LocationUnitTest.java
+++ b/src/test/java/com/github/prominence/openweathermap/api/model/weather/LocationUnitTest.java
@@ -96,9 +96,9 @@ public class LocationUnitTest {
public void whenSetCoordinate_thenValueIsSet() {
final Location location = Location.withValues(33, "test");
final Coordinates coordinates = Coordinates.of(33.2, 64.2);
- location.setCoordinate(coordinates);
+ location.setCoordinates(coordinates);
- assertEquals(coordinates, location.getCoordinate());
+ assertEquals(coordinates, location.getCoordinates());
}
@Test
@@ -107,7 +107,7 @@ public class LocationUnitTest {
assertNotEquals("", location.toString());
- location.setCoordinate(Coordinates.of(33.2, 56.3));
+ location.setCoordinates(Coordinates.of(33.2, 56.3));
assertNotEquals("", location.toString());
@@ -191,11 +191,11 @@ public class LocationUnitTest {
final Coordinates coordinates = Coordinates.of(33.5, -22.4);
- one.setCoordinate(coordinates);
+ one.setCoordinates(coordinates);
assertNotEquals(one, two);
- two.setCoordinate(coordinates);
+ two.setCoordinates(coordinates);
assertEquals(one, two);
}
diff --git a/src/test/java/com/github/prominence/openweathermap/api/request/forecast/free/FiveDayThreeHourStepForecastResponseMapperUnitTest.java b/src/test/java/com/github/prominence/openweathermap/api/request/forecast/free/FiveDayThreeHourStepForecastResponseMapperUnitTest.java
index abed39b..61f2fe5 100644
--- a/src/test/java/com/github/prominence/openweathermap/api/request/forecast/free/FiveDayThreeHourStepForecastResponseMapperUnitTest.java
+++ b/src/test/java/com/github/prominence/openweathermap/api/request/forecast/free/FiveDayThreeHourStepForecastResponseMapperUnitTest.java
@@ -145,27 +145,27 @@ public class FiveDayThreeHourStepForecastResponseMapperUnitTest {
assertNotNull(forecast);
assertNotNull(forecast.getLocation());
- assertNotNull(forecast.getLocation().getCoordinate());
+ assertNotNull(forecast.getLocation().getCoordinates());
jsonString = "{\"cod\":\"200\",\"message\":0,\"cnt\":15,\"list\":[{\"dt\":1618002000,\"main\":{\"temp\":3.77,\"feels_like\":-0.66,\"temp_min\":3.59,\"temp_max\":3.77,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":994,\"humidity\":64,\"temp_kf\":0.18},\"weather\":[{\"id\":802,\"main\":\"Clouds\",\"description\":\"scattered clouds\",\"icon\":\"03n\"}],\"clouds\":{\"all\":47},\"wind\":{\"speed\":5.99,\"deg\":194},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-09 21:00:00\"},{\"dt\":1618012800,\"main\":{\"temp\":3.12,\"feels_like\":-1.31,\"temp_min\":2.89,\"temp_max\":3.12,\"pressure\":1020,\"sea_level\":1020,\"grnd_level\":994,\"humidity\":69,\"temp_kf\":0.23},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":77},\"wind\":{\"speed\":5.61,\"deg\":192},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 00:00:00\"},{\"dt\":1618023600,\"main\":{\"temp\":2.13,\"feels_like\":-2.49,\"temp_min\":2.01,\"temp_max\":2.13,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":993,\"humidity\":75,\"temp_kf\":0.12},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":94},\"wind\":{\"speed\":5.46,\"deg\":188},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 03:00:00\"},{\"dt\":1618034400,\"main\":{\"temp\":3.74,\"feels_like\":-1.01,\"temp_min\":3.74,\"temp_max\":3.74,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":994,\"humidity\":70,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":96},\"wind\":{\"speed\":6.75,\"deg\":189},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 06:00:00\"},{\"dt\":1618045200,\"main\":{\"temp\":8.81,\"feels_like\":5.15,\"temp_min\":8.81,\"temp_max\":8.81,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":993,\"humidity\":53,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":61},\"wind\":{\"speed\":7.91,\"deg\":198},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 09:00:00\"},{\"dt\":1618056000,\"main\":{\"temp\":11.76,\"feels_like\":10.19,\"temp_min\":11.76,\"temp_max\":11.76,\"pressure\":1018,\"sea_level\":1018,\"grnd_level\":993,\"humidity\":46,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":64},\"wind\":{\"speed\":8.24,\"deg\":210},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 12:00:00\"},{\"dt\":1618066800,\"main\":{\"temp\":11.48,\"feels_like\":10.09,\"temp_min\":11.48,\"temp_max\":11.48,\"pressure\":1018,\"sea_level\":1018,\"grnd_level\":993,\"humidity\":54,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":86},\"wind\":{\"speed\":5.45,\"deg\":213},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 15:00:00\"},{\"dt\":1618077600,\"main\":{\"temp\":9.1,\"feels_like\":7.02,\"temp_min\":9.1,\"temp_max\":9.1,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":994,\"humidity\":66,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":92},\"wind\":{\"speed\":3.74,\"deg\":186},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 18:00:00\"},{\"dt\":1618088400,\"main\":{\"temp\":7.53,\"feels_like\":5.06,\"temp_min\":7.53,\"temp_max\":7.53,\"pressure\":1020,\"sea_level\":1020,\"grnd_level\":995,\"humidity\":71,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":95},\"wind\":{\"speed\":3.83,\"deg\":199},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 21:00:00\"},{\"dt\":1618099200,\"main\":{\"temp\":6.68,\"feels_like\":4.64,\"temp_min\":6.68,\"temp_max\":6.68,\"pressure\":1022,\"sea_level\":1022,\"grnd_level\":996,\"humidity\":77,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":92},\"wind\":{\"speed\":2.84,\"deg\":206},\"visibility\":10000,\"pop\":0.02,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-11 00:00:00\"},{\"dt\":1618110000,\"main\":{\"temp\":5.83,\"feels_like\":3.27,\"temp_min\":5.83,\"temp_max\":5.83,\"pressure\":1023,\"sea_level\":1023,\"grnd_level\":997,\"humidity\":81,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":96},\"wind\":{\"speed\":3.34,\"deg\":186},\"visibility\":10000,\"pop\":0.02,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-11 03:00:00\"},{\"dt\":1618120800,\"main\":{\"temp\":7.31,\"feels_like\":4.64,\"temp_min\":7.31,\"temp_max\":7.31,\"pressure\":1024,\"sea_level\":1024,\"grnd_level\":998,\"humidity\":76,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":98},\"wind\":{\"speed\":4.12,\"deg\":196},\"visibility\":10000,\"pop\":0.02,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 06:00:00\"},{\"dt\":1618131600,\"main\":{\"temp\":11,\"feels_like\":9.83,\"temp_min\":11,\"temp_max\":11,\"pressure\":1025,\"sea_level\":1025,\"grnd_level\":1000,\"humidity\":64,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":4.69,\"deg\":194},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 09:00:00\"},{\"dt\":1618142400,\"main\":{\"temp\":14.78,\"feels_like\":13.59,\"temp_min\":14.78,\"temp_max\":14.78,\"pressure\":1025,\"sea_level\":1025,\"grnd_level\":1000,\"humidity\":49,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":5.6,\"deg\":190},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 12:00:00\"},{\"dt\":1618153200,\"main\":{\"temp\":14.58,\"feels_like\":13.4,\"temp_min\":14.58,\"temp_max\":14.58,\"pressure\":1025,\"sea_level\":1025,\"grnd_level\":1000,\"humidity\":50,\"temp_kf\":0},\"weather\":[{\"id\":802,\"main\":\"Clouds\",\"description\":\"scattered clouds\",\"icon\":\"03d\"}],\"clouds\":{\"all\":30},\"wind\":{\"speed\":4.77,\"deg\":177},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 15:00:00\"}],\"city\":{\"id\":350001514,\"name\":\"Minsk\",\"coord\":{\"lon\":27.5619}}}";
forecast = new FiveDayThreeHourStepForecastResponseMapper(UnitSystem.METRIC).mapToForecast(jsonString);
assertNotNull(forecast);
assertNotNull(forecast.getLocation());
- assertNull(forecast.getLocation().getCoordinate());
+ assertNull(forecast.getLocation().getCoordinates());
jsonString = "{\"cod\":\"200\",\"message\":0,\"cnt\":15,\"list\":[{\"dt\":1618002000,\"main\":{\"temp\":3.77,\"feels_like\":-0.66,\"temp_min\":3.59,\"temp_max\":3.77,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":994,\"humidity\":64,\"temp_kf\":0.18},\"weather\":[{\"id\":802,\"main\":\"Clouds\",\"description\":\"scattered clouds\",\"icon\":\"03n\"}],\"clouds\":{\"all\":47},\"wind\":{\"speed\":5.99,\"deg\":194},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-09 21:00:00\"},{\"dt\":1618012800,\"main\":{\"temp\":3.12,\"feels_like\":-1.31,\"temp_min\":2.89,\"temp_max\":3.12,\"pressure\":1020,\"sea_level\":1020,\"grnd_level\":994,\"humidity\":69,\"temp_kf\":0.23},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":77},\"wind\":{\"speed\":5.61,\"deg\":192},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 00:00:00\"},{\"dt\":1618023600,\"main\":{\"temp\":2.13,\"feels_like\":-2.49,\"temp_min\":2.01,\"temp_max\":2.13,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":993,\"humidity\":75,\"temp_kf\":0.12},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":94},\"wind\":{\"speed\":5.46,\"deg\":188},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 03:00:00\"},{\"dt\":1618034400,\"main\":{\"temp\":3.74,\"feels_like\":-1.01,\"temp_min\":3.74,\"temp_max\":3.74,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":994,\"humidity\":70,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":96},\"wind\":{\"speed\":6.75,\"deg\":189},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 06:00:00\"},{\"dt\":1618045200,\"main\":{\"temp\":8.81,\"feels_like\":5.15,\"temp_min\":8.81,\"temp_max\":8.81,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":993,\"humidity\":53,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":61},\"wind\":{\"speed\":7.91,\"deg\":198},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 09:00:00\"},{\"dt\":1618056000,\"main\":{\"temp\":11.76,\"feels_like\":10.19,\"temp_min\":11.76,\"temp_max\":11.76,\"pressure\":1018,\"sea_level\":1018,\"grnd_level\":993,\"humidity\":46,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":64},\"wind\":{\"speed\":8.24,\"deg\":210},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 12:00:00\"},{\"dt\":1618066800,\"main\":{\"temp\":11.48,\"feels_like\":10.09,\"temp_min\":11.48,\"temp_max\":11.48,\"pressure\":1018,\"sea_level\":1018,\"grnd_level\":993,\"humidity\":54,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":86},\"wind\":{\"speed\":5.45,\"deg\":213},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 15:00:00\"},{\"dt\":1618077600,\"main\":{\"temp\":9.1,\"feels_like\":7.02,\"temp_min\":9.1,\"temp_max\":9.1,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":994,\"humidity\":66,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":92},\"wind\":{\"speed\":3.74,\"deg\":186},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 18:00:00\"},{\"dt\":1618088400,\"main\":{\"temp\":7.53,\"feels_like\":5.06,\"temp_min\":7.53,\"temp_max\":7.53,\"pressure\":1020,\"sea_level\":1020,\"grnd_level\":995,\"humidity\":71,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":95},\"wind\":{\"speed\":3.83,\"deg\":199},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 21:00:00\"},{\"dt\":1618099200,\"main\":{\"temp\":6.68,\"feels_like\":4.64,\"temp_min\":6.68,\"temp_max\":6.68,\"pressure\":1022,\"sea_level\":1022,\"grnd_level\":996,\"humidity\":77,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":92},\"wind\":{\"speed\":2.84,\"deg\":206},\"visibility\":10000,\"pop\":0.02,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-11 00:00:00\"},{\"dt\":1618110000,\"main\":{\"temp\":5.83,\"feels_like\":3.27,\"temp_min\":5.83,\"temp_max\":5.83,\"pressure\":1023,\"sea_level\":1023,\"grnd_level\":997,\"humidity\":81,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":96},\"wind\":{\"speed\":3.34,\"deg\":186},\"visibility\":10000,\"pop\":0.02,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-11 03:00:00\"},{\"dt\":1618120800,\"main\":{\"temp\":7.31,\"feels_like\":4.64,\"temp_min\":7.31,\"temp_max\":7.31,\"pressure\":1024,\"sea_level\":1024,\"grnd_level\":998,\"humidity\":76,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":98},\"wind\":{\"speed\":4.12,\"deg\":196},\"visibility\":10000,\"pop\":0.02,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 06:00:00\"},{\"dt\":1618131600,\"main\":{\"temp\":11,\"feels_like\":9.83,\"temp_min\":11,\"temp_max\":11,\"pressure\":1025,\"sea_level\":1025,\"grnd_level\":1000,\"humidity\":64,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":4.69,\"deg\":194},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 09:00:00\"},{\"dt\":1618142400,\"main\":{\"temp\":14.78,\"feels_like\":13.59,\"temp_min\":14.78,\"temp_max\":14.78,\"pressure\":1025,\"sea_level\":1025,\"grnd_level\":1000,\"humidity\":49,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":5.6,\"deg\":190},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 12:00:00\"},{\"dt\":1618153200,\"main\":{\"temp\":14.58,\"feels_like\":13.4,\"temp_min\":14.58,\"temp_max\":14.58,\"pressure\":1025,\"sea_level\":1025,\"grnd_level\":1000,\"humidity\":50,\"temp_kf\":0},\"weather\":[{\"id\":802,\"main\":\"Clouds\",\"description\":\"scattered clouds\",\"icon\":\"03d\"}],\"clouds\":{\"all\":30},\"wind\":{\"speed\":4.77,\"deg\":177},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 15:00:00\"}],\"city\":{\"id\":350001514,\"name\":\"Minsk\",\"coord\":{\"lat\":53.9023}}}";
forecast = new FiveDayThreeHourStepForecastResponseMapper(UnitSystem.METRIC).mapToForecast(jsonString);
assertNotNull(forecast);
assertNotNull(forecast.getLocation());
- assertNull(forecast.getLocation().getCoordinate());
+ assertNull(forecast.getLocation().getCoordinates());
jsonString = "{\"cod\":\"200\",\"message\":0,\"cnt\":15,\"list\":[{\"dt\":1618002000,\"main\":{\"temp\":3.77,\"feels_like\":-0.66,\"temp_min\":3.59,\"temp_max\":3.77,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":994,\"humidity\":64,\"temp_kf\":0.18},\"weather\":[{\"id\":802,\"main\":\"Clouds\",\"description\":\"scattered clouds\",\"icon\":\"03n\"}],\"clouds\":{\"all\":47},\"wind\":{\"speed\":5.99,\"deg\":194},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-09 21:00:00\"},{\"dt\":1618012800,\"main\":{\"temp\":3.12,\"feels_like\":-1.31,\"temp_min\":2.89,\"temp_max\":3.12,\"pressure\":1020,\"sea_level\":1020,\"grnd_level\":994,\"humidity\":69,\"temp_kf\":0.23},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":77},\"wind\":{\"speed\":5.61,\"deg\":192},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 00:00:00\"},{\"dt\":1618023600,\"main\":{\"temp\":2.13,\"feels_like\":-2.49,\"temp_min\":2.01,\"temp_max\":2.13,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":993,\"humidity\":75,\"temp_kf\":0.12},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":94},\"wind\":{\"speed\":5.46,\"deg\":188},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 03:00:00\"},{\"dt\":1618034400,\"main\":{\"temp\":3.74,\"feels_like\":-1.01,\"temp_min\":3.74,\"temp_max\":3.74,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":994,\"humidity\":70,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":96},\"wind\":{\"speed\":6.75,\"deg\":189},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 06:00:00\"},{\"dt\":1618045200,\"main\":{\"temp\":8.81,\"feels_like\":5.15,\"temp_min\":8.81,\"temp_max\":8.81,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":993,\"humidity\":53,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":61},\"wind\":{\"speed\":7.91,\"deg\":198},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 09:00:00\"},{\"dt\":1618056000,\"main\":{\"temp\":11.76,\"feels_like\":10.19,\"temp_min\":11.76,\"temp_max\":11.76,\"pressure\":1018,\"sea_level\":1018,\"grnd_level\":993,\"humidity\":46,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":64},\"wind\":{\"speed\":8.24,\"deg\":210},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 12:00:00\"},{\"dt\":1618066800,\"main\":{\"temp\":11.48,\"feels_like\":10.09,\"temp_min\":11.48,\"temp_max\":11.48,\"pressure\":1018,\"sea_level\":1018,\"grnd_level\":993,\"humidity\":54,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":86},\"wind\":{\"speed\":5.45,\"deg\":213},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-10 15:00:00\"},{\"dt\":1618077600,\"main\":{\"temp\":9.1,\"feels_like\":7.02,\"temp_min\":9.1,\"temp_max\":9.1,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":994,\"humidity\":66,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":92},\"wind\":{\"speed\":3.74,\"deg\":186},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 18:00:00\"},{\"dt\":1618088400,\"main\":{\"temp\":7.53,\"feels_like\":5.06,\"temp_min\":7.53,\"temp_max\":7.53,\"pressure\":1020,\"sea_level\":1020,\"grnd_level\":995,\"humidity\":71,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":95},\"wind\":{\"speed\":3.83,\"deg\":199},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-10 21:00:00\"},{\"dt\":1618099200,\"main\":{\"temp\":6.68,\"feels_like\":4.64,\"temp_min\":6.68,\"temp_max\":6.68,\"pressure\":1022,\"sea_level\":1022,\"grnd_level\":996,\"humidity\":77,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":92},\"wind\":{\"speed\":2.84,\"deg\":206},\"visibility\":10000,\"pop\":0.02,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-11 00:00:00\"},{\"dt\":1618110000,\"main\":{\"temp\":5.83,\"feels_like\":3.27,\"temp_min\":5.83,\"temp_max\":5.83,\"pressure\":1023,\"sea_level\":1023,\"grnd_level\":997,\"humidity\":81,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":96},\"wind\":{\"speed\":3.34,\"deg\":186},\"visibility\":10000,\"pop\":0.02,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2021-04-11 03:00:00\"},{\"dt\":1618120800,\"main\":{\"temp\":7.31,\"feels_like\":4.64,\"temp_min\":7.31,\"temp_max\":7.31,\"pressure\":1024,\"sea_level\":1024,\"grnd_level\":998,\"humidity\":76,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":98},\"wind\":{\"speed\":4.12,\"deg\":196},\"visibility\":10000,\"pop\":0.02,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 06:00:00\"},{\"dt\":1618131600,\"main\":{\"temp\":11,\"feels_like\":9.83,\"temp_min\":11,\"temp_max\":11,\"pressure\":1025,\"sea_level\":1025,\"grnd_level\":1000,\"humidity\":64,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":4.69,\"deg\":194},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 09:00:00\"},{\"dt\":1618142400,\"main\":{\"temp\":14.78,\"feels_like\":13.59,\"temp_min\":14.78,\"temp_max\":14.78,\"pressure\":1025,\"sea_level\":1025,\"grnd_level\":1000,\"humidity\":49,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":5.6,\"deg\":190},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 12:00:00\"},{\"dt\":1618153200,\"main\":{\"temp\":14.58,\"feels_like\":13.4,\"temp_min\":14.58,\"temp_max\":14.58,\"pressure\":1025,\"sea_level\":1025,\"grnd_level\":1000,\"humidity\":50,\"temp_kf\":0},\"weather\":[{\"id\":802,\"main\":\"Clouds\",\"description\":\"scattered clouds\",\"icon\":\"03d\"}],\"clouds\":{\"all\":30},\"wind\":{\"speed\":4.77,\"deg\":177},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2021-04-11 15:00:00\"}],\"city\":{\"id\":350001514,\"name\":\"Minsk\",\"coord\":{}}}";
forecast = new FiveDayThreeHourStepForecastResponseMapper(UnitSystem.METRIC).mapToForecast(jsonString);
assertNotNull(forecast);
assertNotNull(forecast.getLocation());
- assertNull(forecast.getLocation().getCoordinate());
+ assertNull(forecast.getLocation().getCoordinates());
}
}
\ No newline at end of file