@@ -3,6 +3,7 @@ package edu.ie3.simona.api.data.container
33import edu.ie3.datamodel.models.value.PValue
44import edu.ie3.simona.api.data.model.em.EmSetPoint
55import edu.ie3.simona.api.data.model.em.FlexOptionRequest
6+ import edu.ie3.simona.api.data.model.em.MultiFlexOptions
67import edu.ie3.simona.api.data.model.em.PowerLimitFlexOptions
78import spock.lang.Shared
89import spock.lang.Specification
@@ -12,8 +13,34 @@ import static edu.ie3.util.quantities.PowerSystemUnits.KILOWATT
1213
1314class ExtInputContainerTest extends Specification {
1415
15- @Shared
16- private UUID sender = UUID . randomUUID()
16+ def " An ExtInputContainer should return the tick correctly" () {
17+ expect :
18+ container. tick == expectedTick
19+ container. maybeNextTick == expectedMaybeNextTick
20+
21+ where :
22+ container | expectedTick | expectedMaybeNextTick
23+ new ExtInputContainer (0L ) | 0L | Optional . empty()
24+ new ExtInputContainer (0L , 900L ) | 0L | Optional . of(900L )
25+ }
26+
27+ def " An ExtInputContainer should check if it is empty correctly" () {
28+ expect :
29+ def container1 = new ExtInputContainer (0L )
30+ container1. empty
31+ container1. addPrimaryValue(UUID . randomUUID(), null )
32+ ! container1. empty
33+
34+ def container2 = new ExtInputContainer (0L )
35+ container2. empty
36+ container2. addFlexComMessage(null )
37+ ! container2. empty
38+
39+ def container3 = new ExtInputContainer (0L )
40+ container3. empty
41+ container3. addRequest(UUID . randomUUID())
42+ ! container3. empty
43+ }
1744
1845 def " An ExtInputContainer should add primary data correctly" () {
1946 given :
@@ -57,6 +84,21 @@ class ExtInputContainerTest extends Specification {
5784 container. flexOptions == [(receiver): [flexOptions]]
5885 }
5986
87+ def " An ExtInputContainer should add multi flex option data correctly" () {
88+ given :
89+ UUID receiver = UUID . randomUUID()
90+ UUID sender = UUID . randomUUID()
91+ def flexOptions = new PowerLimitFlexOptions (receiver, sender, Quantities . getQuantity(0d , KILOWATT ), Quantities . getQuantity(2d , KILOWATT ), Quantities . getQuantity(5d , KILOWATT ))
92+
93+ def container = new ExtInputContainer (0L )
94+
95+ when :
96+ container. addFlexOptions(new MultiFlexOptions (receiver, [flexOptions]))
97+
98+ then :
99+ container. flexOptions == [(receiver): [flexOptions]]
100+ }
101+
60102 def " An ExtInputContainer should add set point data correctly" () {
61103 given :
62104 UUID receiver = UUID . randomUUID()
0 commit comments