RFR: 8360411: [TEST] open/test/jdk/java/io/File/MaxPathLength.java Refactor extract method to encapsulate Windows specific test logic

Darragh Conway duke at openjdk.org
Wed Jul 9 15:30:13 UTC 2025


On Tue, 8 Jul 2025 16:34:47 GMT, Mikhail Yankelevich <myankelevich at openjdk.org> wrote:

>> Refactored extract method to encapsulate Windows specific test logic
>
> test/jdk/java/io/File/MaxPathLength.java line 200:
> 
>> 198:             String name = fileName;
>> 199:             while (name.length() < MAX_LENGTH) {
>> 200:                 testLongPath (20, name, false);
> 
> Nitpick: do you think there is a need for a space before the `(`? Looks odd imo. But as the whole file uses this, I'm fine with you leaving this as is

Yeah, was just being coherent

> test/jdk/java/io/File/MaxPathLength.java line 202:
> 
>> 200:                 testLongPath (20, name, false);
>> 201:                 testLongPath (20, name, true);
>> 202:                 name = getNextName(name);
> 
> Name doesn't seem to be used after. Do you think it might be beneficial to add an assert here to check if the result is the same as expected ?
> Same applies to the main method

I agree it would be beneficial. 

Would this be a valid assert to add after those while loops?

`assert name.length() >= MAX_LENGTH : "Unexpected final name length: " + name.length();`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26193#discussion_r2194837326
PR Review Comment: https://git.openjdk.org/jdk/pull/26193#discussion_r2194858448


More information about the core-libs-dev mailing list