1 package io.atlassian.fugue.extensions.step;
2
3 import io.atlassian.fugue.Unit;
4 import org.junit.Test;
5
6 import java.util.Optional;
7
8 import static com.github.npathai.hamcrestopt.OptionalMatchers.isEmpty;
9 import static com.github.npathai.hamcrestopt.OptionalMatchers.isPresentAnd;
10 import static io.atlassian.fugue.Unit.Unit;
11 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysFalse;
12 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysFalse2;
13 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysFalse3;
14 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysFalse4;
15 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysFalse5;
16 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysFalse6;
17 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysTrue;
18 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysTrue2;
19 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysTrue3;
20 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysTrue4;
21 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysTrue5;
22 import static io.atlassian.fugue.extensions.step.TestUtils.alwaysTrue6;
23 import static java.util.Optional.empty;
24 import static java.util.Optional.of;
25 import static org.hamcrest.CoreMatchers.is;
26 import static org.junit.Assert.assertThat;
27
28 public class TestOptionalSteps {
29
30 private static final String STRING = "123456";
31 private static final String STRING_UPPERED = "QWERTY";
32 private static final String STRING_LOWERED = "qwerty";
33 private static final Long LONG = 123456L;
34 private static final Long LONGLONG = 123456123456L;
35
36 @Test public void test_1_step_success() {
37 Optional<Long> stepped = Steps.begin(of(STRING)).yield(Long::new);
38
39 assertThat(stepped, isPresentAnd(is(LONG)));
40 }
41
42 @Test public void test_1_step_failure() {
43 Optional<Unit> stepped = Steps.begin(empty()).yield(value1 -> Unit());
44
45 assertThat(stepped, isEmpty());
46 }
47
48 @Test public void test_1_step_filter_success() {
49 Optional<Long> stepped = Steps.begin(of(STRING)).filter(alwaysTrue()).yield(Long::new);
50
51 assertThat(stepped, isPresentAnd(is(LONG)));
52 }
53
54 @Test public void test_1_step_filter_failure() {
55 Optional<Long> stepped = Steps.begin(of(STRING)).filter(alwaysFalse()).yield(Long::new);
56
57 assertThat(stepped, isEmpty());
58 }
59
60 @Test public void test_2_step_success_functor() {
61 Optional<Long> stepped = Steps.begin(of(STRING)).then((firstValue) -> of(STRING)).yield((value1, value2) -> new Long(value1 + value2));
62
63 assertThat(stepped, isPresentAnd(is(LONGLONG)));
64 }
65
66 @Test public void test_2_step_success_supplier() {
67 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).yield((value1, value2) -> new Long(value1 + value2));
68
69 assertThat(stepped, isPresentAnd(is(LONGLONG)));
70 }
71
72 @Test public void test_2_step_failure_functor() {
73 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> empty()).yield((value1, value2) -> new Long(value1));
74
75 assertThat(stepped, isEmpty());
76 }
77
78 @Test public void test_2_step_failure_supplier() {
79 Optional<Long> stepped = Steps.begin(of(STRING)).then(Optional::empty).yield((value1, value2) -> new Long(value1));
80
81 assertThat(stepped, isEmpty());
82 }
83
84 @Test public void test_2_step_failure_1() {
85 Optional<Long> stepped = Steps.begin(empty()).then(() -> of(9)).yield((value1, value2) -> new Long(value2));
86
87 assertThat(stepped, isEmpty());
88 }
89
90 @Test public void test_2_step_filter_success() {
91 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(LONG)).filter(alwaysTrue2()).yield((v1, v2) -> v2);
92
93 assertThat(stepped, isPresentAnd(is(LONG)));
94 }
95
96 @Test public void test_2_step_filter_failure() {
97 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(LONG)).filter(alwaysFalse2()).yield((v1, v2) -> v2);
98
99 assertThat(stepped, isEmpty());
100 }
101
102 @Test public void test_2_step_filter_failure_1() {
103 Optional<Long> stepped = Steps.begin(of(STRING)).filter(alwaysFalse()).then(() -> of(LONG)).yield((v1, v2) -> v2);
104
105 assertThat(stepped, isEmpty());
106 }
107
108 @Test public void test_3_step_success_functor() {
109 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((v1, v2) -> of(88))
110 .yield((value1, value2, value3) -> new Long(value1 + value2));
111
112 assertThat(stepped, isPresentAnd(is(LONGLONG)));
113 }
114
115 @Test public void test_3_step_success_supplier() {
116 Optional<Long> stepped = Steps.begin(of(STRING)).then(Optional::of).then(() -> of(88))
117 .yield((value1, value2, value3) -> new Long(value1 + value2));
118
119 assertThat(stepped, isPresentAnd(is(LONGLONG)));
120 }
121
122 @Test public void test_3_step_failure_functor() {
123 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((v1, v2) -> empty())
124 .yield((value1, value2, value3) -> new Long(value1));
125
126 assertThat(stepped, isEmpty());
127 }
128
129 @Test public void test_3_step_failure_supplier() {
130 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(Optional::empty).yield((value1, value2, value3) -> new Long(value1));
131
132 assertThat(stepped, isEmpty());
133 }
134
135 @Test public void test_3_step_failure_1() {
136 Optional<Long> stepped = Steps.begin(empty()).then(() -> of(STRING)).then((v1, v2) -> of(LONG)).yield((value1, value2, value3) -> value3);
137
138 assertThat(stepped, isEmpty());
139 }
140
141 @Test public void test_3_step_failure_2() {
142 Optional<Long> stepped = Steps.begin(of(STRING)).then(Optional::empty).then((v1, v2) -> of(LONG))
143 .yield((value1, value2, value3) -> new Long(value1));
144
145 assertThat(stepped, isEmpty());
146 }
147
148 @Test public void test_3_step_filter_success() {
149 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(LONG)).then(() -> of(STRING_LOWERED)).filter(alwaysTrue3())
150 .yield((v1, v2, v3) -> v2);
151
152 assertThat(stepped, isPresentAnd(is(LONG)));
153 }
154
155 @Test public void test_3_step_filter_failure() {
156 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(LONG)).then(() -> of(STRING_LOWERED)).filter(alwaysFalse3())
157 .yield((v1, v2, v3) -> v2);
158
159 assertThat(stepped, isEmpty());
160 }
161
162 @Test public void test_3_step_filter_failure_1() {
163 Optional<Long> stepped = Steps.begin(of(STRING)).filter(alwaysFalse()).then(() -> of(LONG)).then(() -> of(STRING_LOWERED))
164 .yield((v1, v2, v3) -> v2);
165
166 assertThat(stepped, isEmpty());
167 }
168
169 @Test public void test_3_step_filter_failure_2() {
170 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(LONG)).filter(alwaysFalse2()).then(() -> of(STRING_LOWERED))
171 .yield((v1, v2, v3) -> v2);
172
173 assertThat(stepped, isEmpty());
174 }
175
176 @Test public void test_4_step_success_functor() {
177 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((first, second) -> of(first + second))
178 .then((v1, v2, v3) -> of(STRING)).yield((value1, value2, value3, value4) -> new Long(value3));
179
180 assertThat(stepped, isPresentAnd(is(LONGLONG)));
181 }
182
183 @Test public void test_4_step_success_supplier() {
184 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
185 .yield((value1, value2, value3, value4) -> new Long(value3));
186
187 assertThat(stepped, isPresentAnd(is(LONGLONG)));
188 }
189
190 @Test public void test_4_step_failure_functor() {
191 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((s, s2) -> of(STRING)).then((s, s2, s3) -> empty())
192 .yield((value1, value2, value3, value4) -> new Long(value1));
193
194 assertThat(stepped, isEmpty());
195 }
196
197 @Test public void test_4_step_failure_supplier() {
198 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING)).then(Optional::empty)
199 .yield((value1, value2, value3, value4) -> new Long(value1));
200
201 assertThat(stepped, isEmpty());
202 }
203
204 @Test public void test_4_step_failure_1() {
205 Optional<Long> stepped = Steps.begin(empty()).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
206 .yield((value1, value2, value3, value4) -> new Long(value3));
207
208 assertThat(stepped, isEmpty());
209 }
210
211 @Test public void test_4_step_failure_2() {
212 Optional<Long> stepped = Steps.begin(of(STRING)).then(Optional::empty).then(() -> of(STRING + STRING)).then(() -> of(STRING))
213 .yield((value1, value2, value3, value4) -> new Long(value3));
214
215 assertThat(stepped, isEmpty());
216 }
217
218 @Test public void test_4_step_failure_3() {
219 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(Optional::empty).then(() -> of(STRING))
220 .yield((value1, value2, value3, value4) -> new Long(value4));
221
222 assertThat(stepped, isEmpty());
223 }
224
225 @Test public void test_4_step_filter_success() {
226 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(LONG)).then(() -> of(STRING_LOWERED)).then(() -> of(true)).filter(alwaysTrue4())
227 .yield((v1, v2, v3, v4) -> v2);
228
229 assertThat(stepped, isPresentAnd(is(LONG)));
230 }
231
232 @Test public void test_4_step_filter_failure() {
233 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(LONG)).then(() -> of(STRING_LOWERED)).then(() -> of(true)).filter(alwaysFalse4())
234 .yield((v1, v2, v3, v4) -> v2);
235
236 assertThat(stepped, isEmpty());
237 }
238
239 @Test public void test_4_step_filter_failure_1() {
240 Optional<Long> stepped = Steps.begin(of(STRING)).filter(alwaysFalse()).then(() -> of(LONG)).then(() -> of(STRING_LOWERED)).then(() -> of(true))
241 .yield((v1, v2, v3, v4) -> v2);
242
243 assertThat(stepped, isEmpty());
244 }
245
246 @Test public void test_4_step_filter_failure_2() {
247 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(LONG)).filter(alwaysFalse2()).then(() -> of(STRING_LOWERED)).then(() -> of(true))
248 .yield((v1, v2, v3, v4) -> v2);
249
250 assertThat(stepped, isEmpty());
251 }
252
253 @Test public void test_4_step_filter_failure_3() {
254 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(LONG)).then(() -> of(STRING_LOWERED)).filter(alwaysFalse3()).then(() -> of(true))
255 .yield((v1, v2, v3, v4) -> v2);
256
257 assertThat(stepped, isEmpty());
258 }
259
260 @Test public void test_5_step_success_functor() {
261 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((first, second) -> of(first + second))
262 .then((v1, v2, v3) -> of(STRING)).then((v1, v2, v3, v4) -> of(STRING)).yield((value1, value2, value3, value4, value5) -> new Long(value3));
263
264 assertThat(stepped, isPresentAnd(is(LONGLONG)));
265 }
266
267 @Test public void test_5_step_success_supplier() {
268 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
269 .then(() -> of(STRING)).yield((value1, value2, value3, value4, value5) -> new Long(value3));
270
271 assertThat(stepped, isPresentAnd(is(LONGLONG)));
272 }
273
274 @Test public void test_5_step_failure_functor() {
275 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((first, second) -> of(first + second))
276 .then((v1, v2, v3) -> of(STRING)).then((v1, v2, v3, v4) -> empty()).yield((value1, value2, value3, value4, value5) -> new Long(value3));
277
278 assertThat(stepped, isEmpty());
279 }
280
281 @Test public void test_5_step_failure_supplier() {
282 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
283 .then(Optional::empty).yield((value1, value2, value3, value4, value5) -> new Long(value3));
284
285 assertThat(stepped, isEmpty());
286 }
287
288 @Test public void test_5_step_failure_1() {
289 Optional<Long> stepped = Steps.begin(empty()).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
290 .then(() -> of(STRING_LOWERED)).yield((value1, value2, value3, value4, value5) -> new Long(value3));
291
292 assertThat(stepped, isEmpty());
293 }
294
295 @Test public void test_5_step_failure_2() {
296 Optional<Long> stepped = Steps.begin(of(STRING)).then(Optional::empty).then(() -> of(STRING + STRING)).then(() -> of(STRING))
297 .then(() -> of(STRING_LOWERED)).yield((value1, value2, value3, value4, value5) -> new Long(value3));
298
299 assertThat(stepped, isEmpty());
300 }
301
302 @Test public void test_5_step_failure_3() {
303 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(Optional::empty).then(() -> of(STRING))
304 .then(() -> of(STRING_LOWERED)).yield((value1, value2, value3, value4, value5) -> new Long(value2));
305
306 assertThat(stepped, isEmpty());
307 }
308
309 @Test public void test_5_step_failure_4() {
310 Optional<Long> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(Optional::empty)
311 .then(() -> of(STRING_LOWERED)).yield((value1, value2, value3, value4, value5) -> new Long(value3));
312
313 assertThat(stepped, isEmpty());
314 }
315
316 @Test public void test_5_step_filter_success() {
317 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((first, second) -> of(first + second))
318 .then((v1, v2, v3) -> of(STRING)).then((v1, v2, v3, v4) -> of(STRING)).filter(alwaysTrue5())
319 .yield((value1, value2, value3, value4, value5) -> new Long(value3));
320
321 assertThat(stepped, isPresentAnd(is(LONGLONG)));
322 }
323
324 @Test public void test_5_step_filter_failure() {
325 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((first, second) -> of(first + second))
326 .then((v1, v2, v3) -> of(STRING)).then((v1, v2, v3, v4) -> of(STRING)).filter(alwaysFalse5())
327 .yield((value1, value2, value3, value4, value5) -> new Long(value3));
328
329 assertThat(stepped, isEmpty());
330 }
331
332 @Test public void test_5_step_filter_failure_1() {
333 Optional<Long> stepped = Steps.begin(of(STRING)).filter(alwaysFalse()).then(v -> of(STRING)).then((first, second) -> of(first + second))
334 .then((v1, v2, v3) -> of(STRING)).then((v1, v2, v3, v4) -> of(STRING)).yield((value1, value2, value3, value4, value5) -> new Long(value3));
335
336 assertThat(stepped, isEmpty());
337 }
338
339 @Test public void test_5_step_filter_failure_2() {
340 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).filter(alwaysFalse2()).then((first, second) -> of(first + second))
341 .then((v1, v2, v3) -> of(STRING)).then((v1, v2, v3, v4) -> of(STRING)).yield((value1, value2, value3, value4, value5) -> new Long(value3));
342
343 assertThat(stepped, isEmpty());
344 }
345
346 @Test public void test_5_step_filter_failure_3() {
347 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((first, second) -> of(first + second)).filter(alwaysFalse3())
348 .then((v1, v2, v3) -> of(STRING)).then((v1, v2, v3, v4) -> of(STRING)).yield((value1, value2, value3, value4, value5) -> new Long(value3));
349
350 assertThat(stepped, isEmpty());
351 }
352
353 @Test public void test_5_step_filter_failure_4() {
354 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((first, second) -> of(first + second))
355 .then((v1, v2, v3) -> of(STRING)).filter(alwaysFalse4()).then((v1, v2, v3, v4) -> of(STRING))
356 .yield((value1, value2, value3, value4, value5) -> new Long(value3));
357
358 assertThat(stepped, isEmpty());
359 }
360
361 @Test public void test_6_step_success_functor() {
362 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((first, second) -> of(first + second))
363 .then((v1, v2, v3) -> of(STRING)).then((v1, v2, v3, v4) -> of(STRING_UPPERED))
364 .then((first, second, third, fourth, fifth) -> of(STRING_LOWERED)).yield((value1, value2, value3, value4, value5, value6) -> new Long(value3));
365
366 assertThat(stepped, isPresentAnd(is(LONGLONG)));
367 }
368
369 @Test public void test_6_step_success_supplier() {
370 Optional<String> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
371 .then(() -> of(STRING_UPPERED)).then(() -> of(STRING_LOWERED)).yield((value1, value2, value3, value4, value5, value6) -> value6);
372
373 assertThat(stepped, isPresentAnd(is(STRING_LOWERED)));
374 }
375
376 @Test public void test_6_step_failure_functor() {
377 Optional<Long> stepped = Steps.begin(of(STRING)).then(v -> of(STRING)).then((first, second) -> of(first + second))
378 .then((v1, v2, v3) -> of(STRING)).then((v1, v2, v3, v4) -> of(STRING_UPPERED)).then((first, second, third, fourth, fifth) -> empty())
379 .yield((value1, value2, value3, value4, value5, value6) -> new Long(value3));
380
381 assertThat(stepped, isEmpty());
382 }
383
384 @Test public void test_6_step_failure_supplier() {
385 Optional<String> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
386 .then(() -> of(STRING_UPPERED)).then(Optional::empty).yield((value1, value2, value3, value4, value5, value6) -> value5);
387
388 assertThat(stepped, isEmpty());
389 }
390
391 @Test public void test_6_step_failure_1() {
392 Optional<String> stepped = Steps.begin(empty()).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
393 .then(() -> of(STRING_UPPERED)).then(() -> of(STRING_LOWERED)).yield((value1, value2, value3, value4, value5, value6) -> value6);
394
395 assertThat(stepped, isEmpty());
396 }
397
398 @Test public void test_6_step_failure_2() {
399 Optional<String> stepped = Steps.begin(of(LONG)).then(Optional::empty).then(() -> of(STRING + STRING)).then(() -> of(STRING))
400 .then(() -> of(STRING_UPPERED)).then(() -> of(STRING_LOWERED)).yield((value1, value2, value3, value4, value5, value6) -> value6);
401
402 assertThat(stepped, isEmpty());
403 }
404
405 @Test public void test_6_step_failure_3() {
406 Optional<String> stepped = Steps.begin(of(LONG)).then(() -> of(STRING)).then(Optional::empty).then(() -> of(STRING))
407 .then(() -> of(STRING_UPPERED)).then(() -> of(STRING_LOWERED)).yield((value1, value2, value3, value4, value5, value6) -> value6);
408
409 assertThat(stepped, isEmpty());
410 }
411
412 @Test public void test_6_step_failure_4() {
413 Optional<String> stepped = Steps.begin(of(LONG)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(Optional::empty)
414 .then(() -> of(STRING_UPPERED)).then(() -> of(STRING_LOWERED)).yield((value1, value2, value3, value4, value5, value6) -> value6);
415
416 assertThat(stepped, isEmpty());
417 }
418
419 @Test public void test_6_step_failure_5() {
420 Optional<String> stepped = Steps.begin(of(LONG)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
421 .then(Optional::empty).then(() -> of(STRING_LOWERED)).yield((value1, value2, value3, value4, value5, value6) -> value6);
422
423 assertThat(stepped, isEmpty());
424 }
425
426 @Test public void test_6_step_filter_success() {
427 Optional<String> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
428 .then(() -> of(STRING_UPPERED)).then(() -> of(STRING_LOWERED)).filter(alwaysTrue6())
429 .yield((value1, value2, value3, value4, value5, value6) -> value6);
430
431 assertThat(stepped, isPresentAnd(is(STRING_LOWERED)));
432 }
433
434 @Test public void test_6_step_filter_failure() {
435 Optional<String> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
436 .then(() -> of(STRING_UPPERED)).then(() -> of(STRING_LOWERED)).filter(alwaysFalse6())
437 .yield((value1, value2, value3, value4, value5, value6) -> value6);
438
439 assertThat(stepped, isEmpty());
440 }
441
442 @Test public void test_6_step_filter_failure_1() {
443 Optional<String> stepped = Steps.begin(of(STRING)).filter(alwaysFalse()).then(() -> of(STRING)).then(() -> of(STRING + STRING))
444 .then(() -> of(STRING)).then(() -> of(STRING_UPPERED)).then(() -> of(STRING_LOWERED))
445 .yield((value1, value2, value3, value4, value5, value6) -> value6);
446
447 assertThat(stepped, isEmpty());
448 }
449
450 @Test public void test_6_step_filter_failure_2() {
451 Optional<String> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).filter(alwaysFalse2()).then(() -> of(STRING + STRING))
452 .then(() -> of(STRING)).then(() -> of(STRING_UPPERED)).then(() -> of(STRING_LOWERED))
453 .yield((value1, value2, value3, value4, value5, value6) -> value6);
454
455 assertThat(stepped, isEmpty());
456 }
457
458 @Test public void test_6_step_filter_failure_3() {
459 Optional<String> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).filter(alwaysFalse3())
460 .then(() -> of(STRING)).then(() -> of(STRING_UPPERED)).then(() -> of(STRING_LOWERED))
461 .yield((value1, value2, value3, value4, value5, value6) -> value6);
462
463 assertThat(stepped, isEmpty());
464 }
465
466 @Test public void test_6_step_filter_failure_4() {
467 Optional<String> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
468 .filter(alwaysFalse4()).then(() -> of(STRING_UPPERED)).then(() -> of(STRING_LOWERED))
469 .yield((value1, value2, value3, value4, value5, value6) -> value6);
470
471 assertThat(stepped, isEmpty());
472 }
473
474 @Test public void test_6_step_filter_failure_5() {
475 Optional<String> stepped = Steps.begin(of(STRING)).then(() -> of(STRING)).then(() -> of(STRING + STRING)).then(() -> of(STRING))
476 .then(() -> of(STRING_UPPERED)).filter(alwaysFalse5()).then(() -> of(STRING_LOWERED))
477 .yield((value1, value2, value3, value4, value5, value6) -> value6);
478
479 assertThat(stepped, isEmpty());
480 }
481
482 }