On Sat, 15 Apr 2023 10:24:58 GMT, Lance Andersen <[email protected]> wrote:
>> test/jdk/jdk/nio/zipfs/ZipFSDirectoryExceptionMessageTest.java line 96:
>>
>>> 94: var file = zipfs.getPath(DIRECTORY_NAME);
>>> 95: var x = assertThrows(FileSystemException.class, () ->
>>> Files.newInputStream(file));
>>> 96: assertEquals(DIR_EXCEPTION_MESSAGE, x.getMessage());
>>
>> FYI, test doesn't need to depend the exception message. Checking
>> FileSystemException::getOtherFile returns null would be a more robust way of
>> checking that it didn't provide a second file by mistake, e.g.
>>
>> try {
>> Files.newInputStream(DIRECTORY_NAME);
>> fail();
>> } catch (FileSystemException e) {
>> assertNull(e.getOtherFile());
>> } catch (IOException ioe) {
>> // allowed
>> }
>
> added validation for other file being null but also kept the existing
> validation of the message
Okay, although I assume this test will fail if it throws a more general
IOException (it's allowed to do that) or there is any adjustment to the error
message.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13482#discussion_r1167784301