Skip to content

Commit d244eed

Browse files
use object.equals
1 parent 7982e5f commit d244eed

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

src/test/groovy/edu/ie3/datamodel/io/factory/timeseries/CosmoTimeBasedWeatherValueFactoryTest.groovy

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ class CosmoTimeBasedWeatherValueFactoryTest extends Specification {
4545
def model = factory.buildModel(data)
4646

4747
then:
48-
model.time == expectedResults.time
49-
model.value == expectedResults.value
48+
model.equals(expectedResults)
5049
}
5150

5251
def "A PsdmTimeBasedWeatherValueFactory should be able to create time series values"() {
@@ -78,8 +77,7 @@ class CosmoTimeBasedWeatherValueFactoryTest extends Specification {
7877
def model = factory.buildModel(data)
7978

8079
then:
81-
model.time == expectedResults.time
82-
model.value == expectedResults.value
80+
model.equals(expectedResults)
8381
}
8482

8583
def "A PsdmTimeBasedWeatherValueFactory should throw FactoryException if required field is missing"() {
@@ -135,7 +133,6 @@ class CosmoTimeBasedWeatherValueFactoryTest extends Specification {
135133
def model = factory.buildModel(data)
136134

137135
then:
138-
assert model.time == expectedResults.time
139-
assert model.value != expectedResults.value
136+
!model.equals(expectedResults)
140137
}
141138
}

src/test/groovy/edu/ie3/datamodel/io/factory/timeseries/TimeBasedSimpleValueFactoryTest.groovy

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ class TimeBasedSimpleValueFactoryTest extends Specification {
131131
)
132132

133133
expect:
134-
factory.buildModel(data).time == expected.time
135-
factory.buildModel(data).value == expected.value
134+
factory.buildModel(data).equals(expected)
136135
}
137136

138137
def "The simple time based value factory builds correct heat and active power value"() {
@@ -151,8 +150,7 @@ class TimeBasedSimpleValueFactoryTest extends Specification {
151150
)
152151

153152
expect:
154-
factory.buildModel(data).time == expected.time
155-
factory.buildModel(data).value == expected.value
153+
factory.buildModel(data).equals(expected)
156154
}
157155

158156
def "The simple time based value factory builds correct heat demand value"() {
@@ -170,8 +168,7 @@ class TimeBasedSimpleValueFactoryTest extends Specification {
170168
)
171169

172170
expect:
173-
factory.buildModel(data).time == expected.time
174-
factory.buildModel(data).value == expected.value
171+
factory.buildModel(data).equals(expected)
175172
}
176173

177174
def "The simple time based value factory builds correct apparent power value"() {
@@ -190,8 +187,7 @@ class TimeBasedSimpleValueFactoryTest extends Specification {
190187
)
191188

192189
expect:
193-
factory.buildModel(data).time == expected.time
194-
factory.buildModel(data).value == expected.value
190+
factory.buildModel(data).equals(expected)
195191
}
196192

197193
def "The simple time based value factory builds correct active power value"() {
@@ -209,8 +205,7 @@ class TimeBasedSimpleValueFactoryTest extends Specification {
209205
)
210206

211207
expect:
212-
factory.buildModel(data).time == expected.time
213-
factory.buildModel(data).value == expected.value
208+
factory.buildModel(data).equals(expected)
214209
}
215210

216211
def "The simple time based value factory throws a FactoryException upon build request, if a class is not supported"() {

0 commit comments

Comments
 (0)