Skip to content

Commit 0bd8d29

Browse files
committed
Add org.apache.commons.io.function.IOStreamTest.testForEachOrderedAsParallel()
1 parent 027fa08 commit 0bd8d29

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/test/java/org/apache/commons/io/function/IOStreamTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,21 @@ public void testForEachOrdered() throws IOException {
285285
assertEquals("AB", sb.toString());
286286
}
287287

288+
@SuppressWarnings("resource") // custom stream not recognized by compiler warning machinery
289+
@Test
290+
public void testForEachOrderedAsParallel() throws IOException {
291+
// compile vs type
292+
assertThrows(IOException.class, () -> IOStream.of("A").parallel().forEach(TestUtils.throwingIOConsumer()));
293+
// compile vs inline
294+
assertThrows(IOException.class, () -> IOStream.of("A").parallel().forEach(e -> {
295+
throw new IOException("Failure");
296+
}));
297+
assertThrows(IOException.class, () -> IOStream.of("A", "B").parallel().forEach(TestUtils.throwingIOConsumer()));
298+
final StringBuilder sb = new StringBuilder();
299+
IOStream.of("A", "B").parallel().forEachOrdered(sb::append);
300+
assertEquals("AB", sb.toString());
301+
}
302+
288303
@SuppressWarnings("resource") // custom stream not recognized by compiler warning machinery
289304
@Test
290305
public void testIsParallel() {

0 commit comments

Comments
 (0)