-
Notifications
You must be signed in to change notification settings - Fork 5
/
SystemParticipantsTest.groovy
92 lines (83 loc) · 4.6 KB
/
SystemParticipantsTest.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* © 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.container
import edu.ie3.test.common.SystemParticipantTestData
import spock.lang.Specification
class SystemParticipantsTest extends Specification {
def "A valid collection of asset entities can be used to build a valid instance of SystemParticipants"() {
given:
def systemParticipants = new SystemParticipants(
Collections.singleton(SystemParticipantTestData.bmInput),
Collections.singleton(SystemParticipantTestData.chpInput),
Collections.emptySet(),
Collections.singleton(SystemParticipantTestData.evInput),
Collections.singleton(SystemParticipantTestData.fixedFeedInInput),
Collections.singleton(SystemParticipantTestData.hpInput),
Collections.singleton(SystemParticipantTestData.loadInput),
Collections.singleton(SystemParticipantTestData.pvInput),
Collections.singleton(SystemParticipantTestData.storageInput),
Collections.singleton(SystemParticipantTestData.wecInput),
Collections.singleton(SystemParticipantTestData.emInput)
)
when:
def newlyCreatedSystemParticipants = new SystemParticipants(systemParticipants.allEntitiesAsList())
then:
newlyCreatedSystemParticipants == systemParticipants
}
def "A SystemParticipants' copy method should work as expected"() {
given:
def systemParticipants = new SystemParticipants(
Collections.singleton(SystemParticipantTestData.bmInput),
Collections.singleton(SystemParticipantTestData.chpInput),
Collections.singleton(SystemParticipantTestData.evcsInput),
Collections.singleton(SystemParticipantTestData.evInput),
Collections.singleton(SystemParticipantTestData.fixedFeedInInput),
Collections.singleton(SystemParticipantTestData.hpInput),
Collections.singleton(SystemParticipantTestData.loadInput),
Collections.singleton(SystemParticipantTestData.pvInput),
Collections.singleton(SystemParticipantTestData.storageInput),
Collections.singleton(SystemParticipantTestData.wecInput),
Collections.singleton(SystemParticipantTestData.emInput)
)
def modifiedBmInput = SystemParticipantTestData.bmInput.copy().id("modified").build()
def modifiedChpInput = SystemParticipantTestData.chpInput.copy().id("modified").build()
def modifiedEvCSInput = SystemParticipantTestData.evcsInput.copy().id("modified").build()
def modifiedEvInput = SystemParticipantTestData.evInput.copy().id("modified").build()
def modifiedFixedFeedInInput = SystemParticipantTestData.fixedFeedInInput.copy().id("modified").build()
def modifiedHpInput = SystemParticipantTestData.hpInput.copy().id("modified").build()
def modifiedLoadInput = SystemParticipantTestData.loadInput.copy().id("modified").build()
def modifiedPvInput = SystemParticipantTestData.pvInput.copy().id("modified").build()
def modifiedStorageInput = SystemParticipantTestData.storageInput.copy().id("modified").build()
def modifiedWecInput = SystemParticipantTestData.wecInput.copy().id("modified").build()
def modifiedEmInput = SystemParticipantTestData.emInput.copy().id("modified").build()
when:
def modifiedSystemParticipants = systemParticipants.copy()
.bmPlants(Set.of(modifiedBmInput))
.chpPlants(Set.of(modifiedChpInput))
.evCS(Set.of(modifiedEvCSInput))
.evs(Set.of(modifiedEvInput))
.fixedFeedIn(Set.of(modifiedFixedFeedInInput))
.heatPumps(Set.of(modifiedHpInput))
.loads(Set.of(modifiedLoadInput))
.pvPlants(Set.of(modifiedPvInput))
.storages(Set.of(modifiedStorageInput))
.wecPlants(Set.of(modifiedWecInput))
.emSystems(Set.of(modifiedEmInput))
.build()
then:
modifiedSystemParticipants.bmPlants.first() == modifiedBmInput
modifiedSystemParticipants.chpPlants.first() == modifiedChpInput
modifiedSystemParticipants.evCS.first() == modifiedEvCSInput
modifiedSystemParticipants.evs.first() == modifiedEvInput
modifiedSystemParticipants.fixedFeedIns.first() == modifiedFixedFeedInInput
modifiedSystemParticipants.heatPumps.first() == modifiedHpInput
modifiedSystemParticipants.loads.first() == modifiedLoadInput
modifiedSystemParticipants.pvPlants.first() == modifiedPvInput
modifiedSystemParticipants.storages.first() == modifiedStorageInput
modifiedSystemParticipants.wecPlants.first() == modifiedWecInput
modifiedSystemParticipants.emSystems.first() == modifiedEmInput
}
}