-
Notifications
You must be signed in to change notification settings - Fork 5
/
JointGridContainerTest.groovy
60 lines (49 loc) · 2.06 KB
/
JointGridContainerTest.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
/*
* © 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 static edu.ie3.test.common.SystemParticipantTestData.emptySystemParticipants
import edu.ie3.test.common.GridTestData
import edu.ie3.test.common.SystemParticipantTestData
import spock.lang.Specification
class JointGridContainerTest extends Specification {
private static final GRID_NAME = "single_grid"
private static final RawGridElements RAW_GRID = new RawGridElements(
[GridTestData.nodeA] as Set,
[] as Set,
[] as Set,
[] as Set,
[] as Set,
[] as Set)
private static final GraphicElements GRAPHIC_ELEMENTS = new GraphicElements(
[] as Set,
[] as Set)
def "A single subgrid can be used to build a JointGridContainer"() {
when:
def jointGridContainer = new JointGridContainer(GRID_NAME, RAW_GRID, emptySystemParticipants, GRAPHIC_ELEMENTS)
then:
noExceptionThrown()
jointGridContainer.subGridTopologyGraph.vertexSet().size() == 1
}
def "A JointGridContainer's copy method should work as expected"() {
given:
def jointGridContainer = new JointGridContainer(GRID_NAME, RAW_GRID, emptySystemParticipants, GRAPHIC_ELEMENTS)
def rawGrid = new RawGridElements(List.of(GridTestData.lineAtoB, GridTestData.transformerAtoBtoC))
def systemParticipants = new SystemParticipants(List.of(SystemParticipantTestData.bmInput))
def graphics = new GraphicElements(Set.of(GridTestData.nodeGraphicD), Set.of(GridTestData.lineGraphicCtoD))
when:
def modifiedJointGridContainer = jointGridContainer.copy()
.gridName("new grid name")
.rawGrid(rawGrid)
.systemParticipants(systemParticipants)
.graphics(graphics)
.build()
then:
modifiedJointGridContainer.gridName == "new grid name"
modifiedJointGridContainer.rawGrid == rawGrid
modifiedJointGridContainer.systemParticipants == systemParticipants
modifiedJointGridContainer.graphics == graphics
}
}