@@ -6,6 +6,7 @@ import strikt.api.expectCatching
6
6
import strikt.api.expectThat
7
7
import strikt.api.expectThrows
8
8
import strikt.assertions.isA
9
+ import strikt.assertions.isEmpty
9
10
import strikt.assertions.isEqualTo
10
11
import strikt.assertions.isFailure
11
12
import strikt.assertions.isSuccess
@@ -22,7 +23,7 @@ class ContainerTest {
22
23
23
24
@Test
24
25
fun `Tank should be a Container` () {
25
- expectThat(Tank (3000000 )).isA<Container >()
26
+ expectThat(Tank (3000000 , emptyList() )).isA<Container >()
26
27
}
27
28
}
28
29
@@ -53,21 +54,21 @@ class ContainerTest {
53
54
@Test
54
55
fun `Tank should be created with 3000000 cL` () {
55
56
expectCatching {
56
- Tank (3000000 )
57
+ Tank (3000000 , emptyList() )
57
58
}.isSuccess()
58
59
}
59
60
60
61
@Test
61
62
fun `Tank should not be created with 1800000 cL` () {
62
63
expectCatching {
63
- Tank (1800000 )
64
+ Tank (1800000 , emptyList() )
64
65
}.isFailure()
65
66
}
66
67
67
68
@Test
68
69
fun `Tank should not be created with 12000000 cL` () {
69
70
expectCatching {
70
- Tank (12000000 )
71
+ Tank (12000000 , emptyList() )
71
72
}.isFailure()
72
73
}
73
74
}
@@ -100,38 +101,38 @@ class ContainerTest {
100
101
@Test
101
102
fun `should not be able to pour Tank in Tank` () {
102
103
expectThrows<IllegalArgumentException > {
103
- Tank (3000000 ) .containersNeededToPourIn(Tank (3000000 ))
104
+ Tank (3000000 , emptyList()) .containersNeededToPourIn(Tank (3000000 , emptyList() ))
104
105
}
105
106
}
106
107
107
108
@Test
108
109
fun `should be able to pour Tank in Barrel` () {
109
110
expectCatching {
110
- Tank (3000000 ).containersNeededToPourIn(Barrel (20000 ))
111
+ Tank (3000000 , emptyList() ).containersNeededToPourIn(Barrel (20000 ))
111
112
}.isSuccess()
112
113
.isEqualTo(150 )
113
114
}
114
115
115
116
@Test
116
117
fun `should be able to pour Tank in Magnum` () {
117
118
expectCatching {
118
- Tank (3000000 ).containersNeededToPourIn(Magnum ())
119
+ Tank (3000000 , emptyList() ).containersNeededToPourIn(Magnum ())
119
120
}.isSuccess()
120
121
.isEqualTo(20000 )
121
122
}
122
123
123
124
@Test
124
125
fun `should be able to pour Tank in Bottle` () {
125
126
expectCatching {
126
- Tank (3000000 ).containersNeededToPourIn(Bottle ())
127
+ Tank (3000000 , emptyList() ).containersNeededToPourIn(Bottle ())
127
128
}.isSuccess()
128
129
.isEqualTo(40000 )
129
130
}
130
131
131
132
@Test
132
133
fun `should not be able to pour Barrel in Tank` () {
133
134
expectThrows<IllegalArgumentException > {
134
- Barrel (20000 ).containersNeededToPourIn(Tank (3000000 ))
135
+ Barrel (20000 ).containersNeededToPourIn(Tank (3000000 , emptyList() ))
135
136
}
136
137
}
137
138
@@ -161,7 +162,7 @@ class ContainerTest {
161
162
@Test
162
163
fun `should not be able to pour Magnum in Tank` () {
163
164
expectThrows<IllegalArgumentException > {
164
- Magnum ().containersNeededToPourIn(Tank (3000000 ))
165
+ Magnum ().containersNeededToPourIn(Tank (3000000 , emptyList() ))
165
166
}
166
167
}
167
168
@@ -189,7 +190,7 @@ class ContainerTest {
189
190
@Test
190
191
fun `should not be able to pour Bottle in Tank` () {
191
192
expectThrows<IllegalArgumentException > {
192
- Bottle ().containersNeededToPourIn(Tank (3000000 ))
193
+ Bottle ().containersNeededToPourIn(Tank (3000000 , emptyList() ))
193
194
}
194
195
}
195
196
@@ -214,4 +215,36 @@ class ContainerTest {
214
215
}
215
216
}
216
217
}
218
+
219
+ @Nested
220
+ inner class Equipments {
221
+
222
+ @Test
223
+ fun `Tank equipments should be what I set it to` () {
224
+ expectThat(Tank (3000000 , listOf (" Porte" , " Contrôle de température" , " Dégustateur" ))) {
225
+ get { equipments }.isEqualTo(listOf (" Porte" , " Contrôle de température" , " Dégustateur" ))
226
+ }
227
+ }
228
+
229
+ @Test
230
+ fun `Barrel equipments should be Robinet, Bonde` () {
231
+ expectThat(Barrel (22500 )) {
232
+ get { equipments }.isEqualTo(listOf (" Robinet" , " Bonde" ))
233
+ }
234
+ }
235
+
236
+ @Test
237
+ fun `Magnum should not have equipments` () {
238
+ expectThat(Magnum ()) {
239
+ get { equipments }.isEmpty()
240
+ }
241
+ }
242
+
243
+ @Test
244
+ fun `Bottle should not have equipments` () {
245
+ expectThat(Bottle ()) {
246
+ get { equipments }.isEmpty()
247
+ }
248
+ }
249
+ }
217
250
}
0 commit comments