-
Notifications
You must be signed in to change notification settings - Fork 5
/
StorageInputTest.groovy
53 lines (44 loc) · 1.74 KB
/
StorageInputTest.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* © 2021. TU Dortmund University,
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
* Research group Distribution grid planning and operation
*/
package edu.ie3.datamodel.models.input.system
import edu.ie3.test.common.SystemParticipantTestData
import spock.lang.Specification
class StorageInputTest extends Specification {
def "A StorageInput copy method should work as expected"() {
given:
def storageInput = SystemParticipantTestData.storageInput
when:
def alteredUnit = storageInput.copy().type(SystemParticipantTestData.storageTypeInput).build()
then:
alteredUnit.with {
assert uuid == storageInput.uuid
assert operationTime == storageInput.operationTime
assert operator == storageInput.operator
assert id == storageInput.id
assert qCharacteristics == storageInput.qCharacteristics
assert type == SystemParticipantTestData.storageTypeInput
assert controllingEm == Optional.of(SystemParticipantTestData.emInput)
}
}
def "Scaling a StorageInput via builder should work as expected"() {
given:
def storageInput = SystemParticipantTestData.storageInput
when:
def alteredUnit = storageInput.copy().scale(2d).build()
then:
alteredUnit.with {
assert uuid == storageInput.uuid
assert operationTime == storageInput.operationTime
assert operator == storageInput.operator
assert id == storageInput.id
assert qCharacteristics == storageInput.qCharacteristics
assert type.sRated == storageInput.type.sRated * 2d
assert type.eStorage == storageInput.type.eStorage * 2d
assert type.pMax == storageInput.type.pMax * 2d
assert controllingEm == Optional.of(SystemParticipantTestData.emInput)
}
}
}