RFR: 8350601: Miscellaneous updates to jpackage test lib [v3]

Alexander Matveev almatvee at openjdk.org
Tue Feb 25 01:16:51 UTC 2025


On Tue, 25 Feb 2025 01:02:13 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:

>> test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/TKitTest.java line 232:
>> 
>>> 230:             if ((expectedExceptionClass == null) == (expectedPath == null)) {
>>> 231:                 throw new IllegalArgumentException("Only one of `expectedPath` and `expectedExceptionClass` can be null");
>>> 232:             }
>> 
>> This one is confusing. It will evaluate to true if both != null. Did you mean "&&" instead of "=="?
>
>> This one is confusing. It will evaluate to true if both != null
> 
> Correct. They both shouldn't be `true`. One of them must be `true`, and another one must be `false`.
> 
>> Did you mean "&&" instead of "=="?
> 
> No. I meant `==` :)

If they both set to non-null value, then exception will be thrown since false == false. In this case exception message is confusing. Maybe change it to: `Only one of `expectedPath` and `expectedExceptionClass` should be set`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23754#discussion_r1968658398


More information about the core-libs-dev mailing list