RFR: 8360411: [TEST] open/test/jdk/java/io/File/MaxPathLength.java Refactor extract method to encapsulate Windows specific test logic
Mikhail Yankelevich
myankelevich at openjdk.org
Wed Jul 9 18:23:41 UTC 2025
On Wed, 9 Jul 2025 12:11:10 GMT, Darragh Conway <duke at openjdk.org> wrote:
>> 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();`
After a second look, I can see that the `name` is used in the while loops. My bad, sorry.
The test is increasing the `name` length in `getNextName`, so it increases in each iteration. The test logic itself is in `testLongPath` and checks if the name is valid. So, in my opinion, checking the value of the name after the while loop probably will not be beneficial
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26193#discussion_r2195703732
More information about the core-libs-dev
mailing list