On Tue, 29 Jul 2025 17:56:00 GMT, David Beaumont <[email protected]> wrote:
>> test/jdk/jdk/internal/jimage/JImageReadTest.java line 350:
>>
>>> 348: try (ImageReader badReader = ImageReader.open(imageFile,
>>> otherOrder)) {
>>> 349: Assert.fail("Reader should not be openable with the wrong
>>> byte order.");
>>> 350: } catch (IOException expected) {
>>
>> In passing, you can use `assertThrows(IOException.class(), () ->
>> ImageReader.open(..))` here if you want.
>
> I don't think I can, can I? That method takes a Runnable, not some sort of
> Callable that throws E.
The construct that Alan suggested works fine here. The fact that
ImageReader.open() returns some value shouldn't matter here. I gave this a try
locally and the use of `assertThrows(...)` with `ImageReader.open(...)` works
as expected.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26054#discussion_r2245485105