On Sat, 9 May 2026 21:06:57 GMT, sstremler <[email protected]> wrote:

>> Refactor stream-related tests from TestNG to JUnit.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> sstremler has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Use JUnit-specific assertions if possible

test/jdk/java/util/regex/PatternStreamTest.java line 51:

> 49: import java.util.stream.OpTestCase;
> 50: import java.util.stream.Stream;
> 51: import java.util.stream.TestData;

This 'import java.util.stream.TestData;' seems useless.

test/jdk/java/util/regex/PatternStreamTest.java line 55:

> 53: import static org.junit.jupiter.api.Assertions.assertEquals;
> 54: import static org.junit.jupiter.api.Assertions.assertThrows;
> 55: import static org.junit.jupiter.api.Assertions.fail;

After remove all the 'Maybe we can use 'assertThrows' instead of 'try{ ... 
fail()} catch{}''. This 'import fail' can be removed.

test/jdk/java/util/regex/PatternStreamTest.java line 256:

> 254:         try {
> 255:             m.replaceFirst(mr -> { m.reset(); return "Y"; });
> 256:             fail();

Maybe we can use 'assertThrows' instead of 'try{ ... fail()} catch{}'

test/jdk/java/util/regex/PatternStreamTest.java line 264:

> 262:         try {
> 263:             m.replaceAll(mr -> { m.reset(); return "Y"; });
> 264:             fail();

Maybe we can use 'assertThrows' instead of 'try{ ... fail()} catch{}'

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/30954#discussion_r3361368843
PR Review Comment: https://git.openjdk.org/jdk/pull/30954#discussion_r3361382100
PR Review Comment: https://git.openjdk.org/jdk/pull/30954#discussion_r3361378007
PR Review Comment: https://git.openjdk.org/jdk/pull/30954#discussion_r3361378347

Reply via email to