diff --git a/CHANGELOG.md b/CHANGELOG.md index 71ef88a3d..20391b0e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed the issues with rtd for Cylindrical thermal storage [#1273](https://github.com/ie3-institute/PowerSystemDataModel/issues/1273) - Updated Controlling_em for all the loads in readthedocs[#1447](https://github.com/ie3-institute/PowerSystemDataModel/issues/1447) - Included a doFirst clause into `checkJavaVersion.gradle` [#1462](https://github.com/ie3-institute/PowerSystemDataModel/issues/1462) +- Fixed `EnergyPriceValue.equals()` [#1479](https://github.com/ie3-institute/PowerSystemDataModel/issues/1479) ### Changed - Updated CI-Pipeline to run task `Deploy` and `Staging` only for `Main` [#1403](https://github.com/ie3-institute/PowerSystemDataModel/issues/1403) diff --git a/src/main/java/edu/ie3/datamodel/models/value/EnergyPriceValue.java b/src/main/java/edu/ie3/datamodel/models/value/EnergyPriceValue.java index 3cf8dafd8..475b1b226 100644 --- a/src/main/java/edu/ie3/datamodel/models/value/EnergyPriceValue.java +++ b/src/main/java/edu/ie3/datamodel/models/value/EnergyPriceValue.java @@ -32,12 +32,14 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; EnergyPriceValue that = (EnergyPriceValue) o; - return Objects.equals(price, that.price); + + return Objects.equals(price.getValue().doubleValue(), that.price.getValue().doubleValue()) + && Objects.equals(price.getUnit(), that.price.getUnit()); } @Override public int hashCode() { - return Objects.hash(price); + return Objects.hash(price.getValue().doubleValue(), price.getUnit()); } @Override diff --git a/src/test/groovy/edu/ie3/datamodel/io/factory/timeseries/TimeBasedSimpleValueFactoryTest.groovy b/src/test/groovy/edu/ie3/datamodel/io/factory/timeseries/TimeBasedSimpleValueFactoryTest.groovy index 385073e97..7e44776c7 100644 --- a/src/test/groovy/edu/ie3/datamodel/io/factory/timeseries/TimeBasedSimpleValueFactoryTest.groovy +++ b/src/test/groovy/edu/ie3/datamodel/io/factory/timeseries/TimeBasedSimpleValueFactoryTest.groovy @@ -17,8 +17,6 @@ import spock.lang.Shared import spock.lang.Specification import tech.units.indriya.quantity.Quantities -import java.time.ZoneId - class TimeBasedSimpleValueFactoryTest extends Specification { @Shared TimeUtil defaultTimeUtil @@ -110,7 +108,7 @@ class TimeBasedSimpleValueFactoryTest extends Specification { ) expect: - factory.buildModel(data) == expected + Objects.equals(factory.buildModel(data),expected) } def "The simple time based value factory builds correct heat and apparent power value"() {