@@ -12,6 +12,7 @@ import edu.ie3.datamodel.utils.Try
12
12
import spock.lang.Specification
13
13
14
14
import java.time.ZonedDateTime
15
+ import java.util.stream.Collectors
15
16
16
17
class EmInputFactoryTest extends Specification {
17
18
@@ -27,67 +28,40 @@ class EmInputFactoryTest extends Specification {
27
28
def " An EmInputFactory should return the valid fields correctly" () {
28
29
given :
29
30
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" ],
51
42
[
52
- " uuid" ,
53
- " id" ,
54
- " controlStrategy" ,
55
- " controllingEm" ,
56
43
" operatesFrom" ,
57
44
" 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" ],
66
49
[
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" ,
88
50
" 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 ),
91
65
]
92
66
93
67
when :
0 commit comments