On Mon, 10 Mar 2025 17:17:18 GMT, Jeremy Wood <d...@openjdk.org> wrote:

>> test/jdk/javax/imageio/plugins/jpeg/JpegWriterWriteNonOpaqueIndexColorModelTest.java
>>  line 81:
>> 
>>> 79:             e.printStackTrace();
>>> 80:             return false;
>>> 81:         }
>> 
>> Should an exception be allowed to escape? You throw an `Error` if the 
>> expected return value doesn't match.
>
> This is by design.
> 
> The main method resembles:
> 
>     public static void main(String[] args) throws IOException {
>         boolean b1 = testJpegWriter(Transparency.OPAQUE, "OPAQUE", true);
>         boolean b2 = testJpegWriter(Transparency.BITMASK, "BITMASK", false);
>         boolean b3 = testJpegWriter(Transparency.TRANSLUCENT, "TRANSLUCENT", 
> false);
>         if (!(b1 && b2 && b3))
>             throw new Error("Test failed");
>     }
> 
> 
> The intention here is to help log multiple failures at once. (Otherwise: if 
> there are two failures A and B, then you can only discover B after resolving 
> A.)

I see. Yet it still implies the `Error` isn't thrown in `result != 
expectedWriteReturnValue`… because if it is thrown, the test fails right away 
without running other cases.

It's fine, it's not expected to be thrown, right?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23884#discussion_r1987733487

Reply via email to