@Test public void testEquals() { Temperature temperature = new Temperature(32.0, TemperatureType.CELSIUS); Pressure pressure = new Pressure(1020, PressureType.H_PA); PrecipitationDuration precipitationDuration = new PrecipitationDuration(1.0, DurationType.HOUR); PrecipitationHeight precipitationHeight = new PrecipitationHeight(2.0, LengthType.CENTIMETER); SunshineDuration sunshineDuration = new SunshineDuration(3.14, DurationType.HOUR); WindSpeed windSpeed = new WindSpeed(1.1, SpeedType.KILOMETER_PER_HOUR); WindDirection windDirection = new WindDirection(45.0, AngleType.DEGREE); int cloudCoverInPercent = 12; TotalSolarRadiation totalSolarRadiation = new TotalSolarRadiation(38.9, RadiationType.JOULE_PER_SQUARE_CENTIMETER); Location location = new Location("Erlangen", Location.UNKNOWN, null); Instant timestamp = Instant.ofEpochSecond(1534332000); ExtendedWeather other = new ExtendedWeather( "42", temperature, pressure, 45, precipitationDuration, precipitationHeight, sunshineDuration, windSpeed, windDirection, cloudCoverInPercent, totalSolarRadiation, timestamp, location ); Assert.assertEquals(weather, other); }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ExtendedWeather)) return false; if (!super.equals(o)) return false; ExtendedWeather that = (ExtendedWeather) o; return cloudCoverInPercent == that.cloudCoverInPercent && Objects.equals(precipitationDuration, that.precipitationDuration) && Objects.equals(precipitationHeight, that.precipitationHeight) && Objects.equals(sunshineDuration, that.sunshineDuration) && Objects.equals(windSpeed, that.windSpeed) && Objects.equals(windDirection, that.windDirection) && Objects.equals(totalSolarRadiation, that.totalSolarRadiation); }
ExtendedWeather extends Weather { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ExtendedWeather)) return false; if (!super.equals(o)) return false; ExtendedWeather that = (ExtendedWeather) o; return cloudCoverInPercent == that.cloudCoverInPercent && Objects.equals(precipitationDuration, that.precipitationDuration) && Objects.equals(precipitationHeight, that.precipitationHeight) && Objects.equals(sunshineDuration, that.sunshineDuration) && Objects.equals(windSpeed, that.windSpeed) && Objects.equals(windDirection, that.windDirection) && Objects.equals(totalSolarRadiation, that.totalSolarRadiation); } }
ExtendedWeather extends Weather { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ExtendedWeather)) return false; if (!super.equals(o)) return false; ExtendedWeather that = (ExtendedWeather) o; return cloudCoverInPercent == that.cloudCoverInPercent && Objects.equals(precipitationDuration, that.precipitationDuration) && Objects.equals(precipitationHeight, that.precipitationHeight) && Objects.equals(sunshineDuration, that.sunshineDuration) && Objects.equals(windSpeed, that.windSpeed) && Objects.equals(windDirection, that.windDirection) && Objects.equals(totalSolarRadiation, that.totalSolarRadiation); } @JsonCreator  ExtendedWeather(
		@JsonProperty("stationId") String stationId,
		@JsonProperty("temperature") Temperature temperature,
		@JsonProperty("pressure") Pressure pressure,
		@JsonProperty("humidityInPercent") int humidityInPercent,
		@JsonProperty("precipitationDuration") PrecipitationDuration precipitationDuration,
		@JsonProperty("precipitationHeight") PrecipitationHeight precipitationHeight,
		@JsonProperty("sunshineDuration") SunshineDuration sunshineDuration,
		@JsonProperty("windSpeed") WindSpeed windSpeed,
		@JsonProperty("windDirection") WindDirection windDirection,
		@JsonProperty("cloudCoverInPercent") int cloudCoverInPercent,
		@JsonProperty("totalSolarRadiation") TotalSolarRadiation totalSolarRadiation,
		@JsonProperty("timestamp") Instant timestamp,
		@JsonProperty("location") Location location); }
ExtendedWeather extends Weather { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ExtendedWeather)) return false; if (!super.equals(o)) return false; ExtendedWeather that = (ExtendedWeather) o; return cloudCoverInPercent == that.cloudCoverInPercent && Objects.equals(precipitationDuration, that.precipitationDuration) && Objects.equals(precipitationHeight, that.precipitationHeight) && Objects.equals(sunshineDuration, that.sunshineDuration) && Objects.equals(windSpeed, that.windSpeed) && Objects.equals(windDirection, that.windDirection) && Objects.equals(totalSolarRadiation, that.totalSolarRadiation); } @JsonCreator  ExtendedWeather(
		@JsonProperty("stationId") String stationId,
		@JsonProperty("temperature") Temperature temperature,
		@JsonProperty("pressure") Pressure pressure,
		@JsonProperty("humidityInPercent") int humidityInPercent,
		@JsonProperty("precipitationDuration") PrecipitationDuration precipitationDuration,
		@JsonProperty("precipitationHeight") PrecipitationHeight precipitationHeight,
		@JsonProperty("sunshineDuration") SunshineDuration sunshineDuration,
		@JsonProperty("windSpeed") WindSpeed windSpeed,
		@JsonProperty("windDirection") WindDirection windDirection,
		@JsonProperty("cloudCoverInPercent") int cloudCoverInPercent,
		@JsonProperty("totalSolarRadiation") TotalSolarRadiation totalSolarRadiation,
		@JsonProperty("timestamp") Instant timestamp,
		@JsonProperty("location") Location location); PrecipitationDuration getPrecipitationDuration(); PrecipitationHeight getPrecipitationHeight(); SunshineDuration getSunshineDuration(); WindSpeed getWindSpeed(); WindDirection getWindDirection(); int getCloudCoverInPercent(); TotalSolarRadiation getTotalSolarRadiation(); @Override boolean equals(Object o); @Override int hashCode(); }
ExtendedWeather extends Weather { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ExtendedWeather)) return false; if (!super.equals(o)) return false; ExtendedWeather that = (ExtendedWeather) o; return cloudCoverInPercent == that.cloudCoverInPercent && Objects.equals(precipitationDuration, that.precipitationDuration) && Objects.equals(precipitationHeight, that.precipitationHeight) && Objects.equals(sunshineDuration, that.sunshineDuration) && Objects.equals(windSpeed, that.windSpeed) && Objects.equals(windDirection, that.windDirection) && Objects.equals(totalSolarRadiation, that.totalSolarRadiation); } @JsonCreator  ExtendedWeather(
		@JsonProperty("stationId") String stationId,
		@JsonProperty("temperature") Temperature temperature,
		@JsonProperty("pressure") Pressure pressure,
		@JsonProperty("humidityInPercent") int humidityInPercent,
		@JsonProperty("precipitationDuration") PrecipitationDuration precipitationDuration,
		@JsonProperty("precipitationHeight") PrecipitationHeight precipitationHeight,
		@JsonProperty("sunshineDuration") SunshineDuration sunshineDuration,
		@JsonProperty("windSpeed") WindSpeed windSpeed,
		@JsonProperty("windDirection") WindDirection windDirection,
		@JsonProperty("cloudCoverInPercent") int cloudCoverInPercent,
		@JsonProperty("totalSolarRadiation") TotalSolarRadiation totalSolarRadiation,
		@JsonProperty("timestamp") Instant timestamp,
		@JsonProperty("location") Location location); PrecipitationDuration getPrecipitationDuration(); PrecipitationHeight getPrecipitationHeight(); SunshineDuration getSunshineDuration(); WindSpeed getWindSpeed(); WindDirection getWindDirection(); int getCloudCoverInPercent(); TotalSolarRadiation getTotalSolarRadiation(); @Override boolean equals(Object o); @Override int hashCode();  }