This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-io.git
commit 9f5d73aaa4964a308a39bc41da3e98753594178e Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue May 6 10:36:06 2025 -0400 Add org.apache.commons.io.function.IOStreamTest.testForEachOrderedAdaptParallel() --- .../java/org/apache/commons/io/function/IOStreamTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/org/apache/commons/io/function/IOStreamTest.java b/src/test/java/org/apache/commons/io/function/IOStreamTest.java index f55d673da..8e2b2982e 100644 --- a/src/test/java/org/apache/commons/io/function/IOStreamTest.java +++ b/src/test/java/org/apache/commons/io/function/IOStreamTest.java @@ -304,6 +304,21 @@ public void testForEachOrdered() throws IOException { assertEquals("AB", sb.toString()); } + @SuppressWarnings("resource") // custom stream not recognized by compiler warning machinery + @Test + public void testForEachOrderedAdaptParallel() throws IOException { + // compile vs type + assertThrows(IOException.class, () -> IOStream.adapt(Stream.of("A").parallel()).forEach(TestUtils.throwingIOConsumer())); + // compile vs inline + assertThrows(IOException.class, () -> IOStream.adapt(Stream.of("A").parallel()).forEach(e -> { + throw new IOException("Failure"); + })); + assertThrows(IOException.class, () -> IOStream.adapt(Stream.of("A", "B").parallel()).forEach(TestUtils.throwingIOConsumer())); + final StringBuilder sb = new StringBuilder(); + IOStream.adapt(Stream.of("A", "B").parallel()).forEachOrdered(sb::append); + assertEquals("AB", sb.toString()); + } + @SuppressWarnings("resource") // custom stream not recognized by compiler warning machinery @Test public void testForEachOrderedAsParallel() throws IOException {