Skip to content

Commit d8451f5

Browse files
proposal for testing fields of EmInputFactory
1 parent 74da8a4 commit d8451f5

File tree

1 file changed

+55
-28
lines changed

1 file changed

+55
-28
lines changed

src/test/groovy/edu/ie3/datamodel/io/factory/input/EmInputFactoryTest.groovy

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,41 +28,68 @@ class EmInputFactoryTest extends Specification {
2828
def "An EmInputFactory should return the valid fields correctly"() {
2929
given:
3030
def inputFactory = new EmInputFactory()
31-
32-
def requiredFields = [
33-
"uuid",
34-
"id",
35-
"controlStrategy",
36-
"controllingEm"
37-
] as Set
38-
39-
def operationCombinations = [
40-
["operatesFrom"],
41-
["operatesUntil"],
31+
def validCombinations = [
4232
[
43-
"operatesFrom",
33+
"uuid",
34+
"id",
35+
"controlStrategy",
36+
"controllingEm"
37+
],
38+
[
39+
"uuid",
40+
"id",
41+
"controlStrategy",
42+
"controllingEm",
43+
"operatesFrom"
44+
],
45+
[
46+
"uuid",
47+
"id",
48+
"controlStrategy",
49+
"controllingEm",
4450
"operatesUntil"
4551
],
46-
["operator"],
47-
["operatesFrom", "operator"],
48-
["operatesUntil", "operator"],
4952
[
53+
"uuid",
54+
"id",
55+
"controlStrategy",
56+
"controllingEm",
5057
"operatesFrom",
51-
"operatesUntil",
58+
"operatesUntil"
59+
],
60+
[
61+
"uuid",
62+
"id",
63+
"controlStrategy",
64+
"controllingEm",
5265
"operator"
66+
],
67+
[
68+
"uuid",
69+
"id",
70+
"controlStrategy",
71+
"controllingEm",
72+
"operator",
73+
"operatesFrom"
74+
],
75+
[
76+
"uuid",
77+
"id",
78+
"controlStrategy",
79+
"controllingEm",
80+
"operator",
81+
"operatesUntil"
82+
],
83+
[
84+
"uuid",
85+
"id",
86+
"controlStrategy",
87+
"controllingEm",
88+
"operator",
89+
"operatesFrom",
90+
"operatesUntil"
5391
]
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),
65-
]
92+
].collect { it as Set }
6693

6794
when:
6895
def fieldCombinations = inputFactory.getFields(EmInput)

0 commit comments

Comments
 (0)