|
15 | 15 |
|
16 | 16 | import java.util.ArrayList; |
17 | 17 | import java.util.List; |
| 18 | +import java.util.NoSuchElementException; |
18 | 19 |
|
19 | 20 | /** |
20 | 21 | * @author Pierre Lecerf (pierre.lecerf@illuin.tech) |
@@ -140,6 +141,28 @@ public void testPipeline__shouldCompile_currentStream() |
140 | 141 | Assertions.assertEquals("input->stream(input)", collector.get()); |
141 | 142 | } |
142 | 143 |
|
| 144 | + @Test |
| 145 | + public void testPipeline__shouldCompile_currentMissing() |
| 146 | + { |
| 147 | + StringCollector collector = new StringCollector(); |
| 148 | + Pipeline<Object> pipeline = Assertions.assertDoesNotThrow(() -> createPipeline_current_missing("test-current-missing", collector)); |
| 149 | + |
| 150 | + Assertions.assertDoesNotThrow(() -> pipeline.run("input")); |
| 151 | + Assertions.assertDoesNotThrow(pipeline::close); |
| 152 | + |
| 153 | + Assertions.assertNull(collector.get()); |
| 154 | + } |
| 155 | + |
| 156 | + @Test |
| 157 | + public void testPipeline__shouldCompile_currentMissingRequired() |
| 158 | + { |
| 159 | + StringCollector collector = new StringCollector(); |
| 160 | + Pipeline<Object> pipeline = Assertions.assertDoesNotThrow(() -> createPipeline_current_missingRequired("test-current-missing-required", collector)); |
| 161 | + |
| 162 | + Assertions.assertThrows(NoSuchElementException.class, () -> pipeline.run("input")); |
| 163 | + Assertions.assertDoesNotThrow(pipeline::close); |
| 164 | + } |
| 165 | + |
143 | 166 | @Test |
144 | 167 | public void testPipeline__shouldCompile_currentNamed() |
145 | 168 | { |
@@ -211,6 +234,28 @@ public void testPipeline__shouldCompile_latestStream() |
211 | 234 |
|
212 | 235 | Assertions.assertEquals("input->stream(input)", collector.get()); |
213 | 236 | } |
| 237 | + |
| 238 | + @Test |
| 239 | + public void testPipeline__shouldCompile_latestMissing() |
| 240 | + { |
| 241 | + StringCollector collector = new StringCollector(); |
| 242 | + Pipeline<Object> pipeline = Assertions.assertDoesNotThrow(() -> createPipeline_latest_missing("test-latest-missing", collector)); |
| 243 | + |
| 244 | + Assertions.assertDoesNotThrow(() -> pipeline.run("input")); |
| 245 | + Assertions.assertDoesNotThrow(pipeline::close); |
| 246 | + |
| 247 | + Assertions.assertNull(collector.get()); |
| 248 | + } |
| 249 | + |
| 250 | + @Test |
| 251 | + public void testPipeline__shouldCompile_latestMissingRequired() |
| 252 | + { |
| 253 | + StringCollector collector = new StringCollector(); |
| 254 | + Pipeline<Object> pipeline = Assertions.assertDoesNotThrow(() -> createPipeline_latest_missingRequired("test-latest-missing-required", collector)); |
| 255 | + |
| 256 | + Assertions.assertThrows(NoSuchElementException.class, () -> pipeline.run("input")); |
| 257 | + Assertions.assertDoesNotThrow(pipeline::close); |
| 258 | + } |
214 | 259 |
|
215 | 260 | @Test |
216 | 261 | public void testPipeline__shouldCompile_latestNamed() |
@@ -426,6 +471,20 @@ public static Pipeline<Object> createPipeline_currentNamed(String name, StringCo |
426 | 471 | .build(); |
427 | 472 | } |
428 | 473 |
|
| 474 | + public static Pipeline<Object> createPipeline_current_missing(String name, StringCollector collector) |
| 475 | + { |
| 476 | + return Pipeline.of(name) |
| 477 | + .registerSink(new SinkWithInputAndCurrent<>(collector)) |
| 478 | + .build(); |
| 479 | + } |
| 480 | + |
| 481 | + public static Pipeline<Object> createPipeline_current_missingRequired(String name, StringCollector collector) |
| 482 | + { |
| 483 | + return Pipeline.of(name) |
| 484 | + .registerSink(new SinkWithInputAndCurrent.Required<>(collector)) |
| 485 | + .build(); |
| 486 | + } |
| 487 | + |
429 | 488 | public static Pipeline<Object> createPipeline_currentOptionalNamed(String name, StringCollector collector) |
430 | 489 | { |
431 | 490 | return Pipeline.of(name) |
@@ -474,6 +533,20 @@ public static Pipeline<Object> createPipeline_latestNamed(String name, StringCol |
474 | 533 | .build(); |
475 | 534 | } |
476 | 535 |
|
| 536 | + public static Pipeline<Object> createPipeline_latest_missing(String name, StringCollector collector) |
| 537 | + { |
| 538 | + return Pipeline.of(name) |
| 539 | + .registerSink(new SinkWithInputAndLatest<>(collector)) |
| 540 | + .build(); |
| 541 | + } |
| 542 | + |
| 543 | + public static Pipeline<Object> createPipeline_latest_missingRequired(String name, StringCollector collector) |
| 544 | + { |
| 545 | + return Pipeline.of(name) |
| 546 | + .registerSink(new SinkWithInputAndLatest.Required<>(collector)) |
| 547 | + .build(); |
| 548 | + } |
| 549 | + |
477 | 550 | public static Pipeline<Object> createPipeline_latestOptionalNamed(String name, StringCollector collector) |
478 | 551 | { |
479 | 552 | return Pipeline.of(name) |
|
0 commit comments