@@ -12,6 +12,7 @@ import edu.ie3.datamodel.utils.Try
1212import spock.lang.Specification
1313
1414import java.time.ZonedDateTime
15+ import java.util.stream.Collectors
1516
1617class EmInputFactoryTest extends Specification {
1718
@@ -27,67 +28,40 @@ class EmInputFactoryTest extends Specification {
2728 def " An EmInputFactory should return the valid fields correctly" () {
2829 given :
2930 def inputFactory = new EmInputFactory ()
30- def validCombinations = [
31- [
32- " uuid" ,
33- " id" ,
34- " controlStrategy" ,
35- " controllingEm"
36- ] as Set ,
37- [
38- " uuid" ,
39- " id" ,
40- " controlStrategy" ,
41- " controllingEm" ,
42- " operatesFrom"
43- ] as Set ,
44- [
45- " uuid" ,
46- " id" ,
47- " controlStrategy" ,
48- " controllingEm" ,
49- " operatesUntil"
50- ] as Set ,
31+
32+ def requiredFields = [
33+ " uuid" ,
34+ " id" ,
35+ " controlStrategy" ,
36+ " controllingEm"
37+ ] as Set
38+
39+ def operationCombinations = [
40+ [" operatesFrom" ],
41+ [" operatesUntil" ],
5142 [
52- " uuid" ,
53- " id" ,
54- " controlStrategy" ,
55- " controllingEm" ,
5643 " operatesFrom" ,
5744 " operatesUntil"
58- ] as Set ,
59- [
60- " uuid" ,
61- " id" ,
62- " controlStrategy" ,
63- " controllingEm" ,
64- " operator"
65- ] as Set ,
45+ ],
46+ [" operator" ],
47+ [" operatesFrom" , " operator" ],
48+ [" operatesUntil" , " operator" ],
6649 [
67- " uuid" ,
68- " id" ,
69- " controlStrategy" ,
70- " controllingEm" ,
71- " operator" ,
72- " operatesFrom"
73- ] as Set ,
74- [
75- " uuid" ,
76- " id" ,
77- " controlStrategy" ,
78- " controllingEm" ,
79- " operator" ,
80- " operatesUntil"
81- ] as Set ,
82- [
83- " uuid" ,
84- " id" ,
85- " controlStrategy" ,
86- " controllingEm" ,
87- " operator" ,
8850 " operatesFrom" ,
89- " operatesUntil"
90- ] as Set ,
51+ " operatesUntil" ,
52+ " operator"
53+ ]
54+ ]
55+
56+ def validCombinations = [
57+ requiredFields,
58+ requiredFields + operationCombinations. get(0 ),
59+ requiredFields + operationCombinations. get(1 ),
60+ requiredFields + operationCombinations. get(2 ),
61+ requiredFields + operationCombinations. get(3 ),
62+ requiredFields + operationCombinations. get(4 ),
63+ requiredFields + operationCombinations. get(5 ),
64+ requiredFields + operationCombinations. get(6 ),
9165 ]
9266
9367 when :
0 commit comments