Skip to content

Commit 48fb0ba

Browse files
committed
Improving test.
1 parent 44494c1 commit 48fb0ba

File tree

1 file changed

+30
-56
lines changed

1 file changed

+30
-56
lines changed

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

Lines changed: 30 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import edu.ie3.datamodel.utils.Try
1212
import spock.lang.Specification
1313

1414
import java.time.ZonedDateTime
15+
import java.util.stream.Collectors
1516

1617
class 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

Comments
 (0)