Minor improvements to jpackage test lib:
1. There are a few dependencies on java.io.File in jpackage test library. They can be fairly easily eliminated. java.io.File.pathSeparator may be still used.
2. TKit.assert...() functions allow additional messages appended to log records. But some of these functions (e.g.: TKit.assertTrue(), TKit.assertEquals()) don't use TKit.concatMessages() function to build log string, instead they use String.format() [1]. This results in the wrong output if the additional log message is an empty string or null. E.g.:
`TKit.assertTrue(true, "Foo")` and `TKit.assertTrue(false, "Foo")` calls will output:
---
TRACE: assertTrue(): Foo <<<< Correct, output as expected
ERROR: Failed: Foo <<<< Correct, output as expected
---
`TKit.assertTrue(true, null)` and `TKit.assertTrue(false, null)` calls will output:
---
TRACE: assertTrue(): null <<<< This is wrong, should be "TRACE: assertTrue()"
ERROR: Failed <<<< Correct, output as expected
---
[1] https://github.com/openjdk/jdk/blob/52c0b09b62ca82f7e0cbe910cb92243131f06765/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java#L676
1. There are a few dependencies on java.io.File in jpackage test library. They can be fairly easily eliminated. java.io.File.pathSeparator may be still used.
2. TKit.assert...() functions allow additional messages appended to log records. But some of these functions (e.g.: TKit.assertTrue(), TKit.assertEquals()) don't use TKit.concatMessages() function to build log string, instead they use String.format() [1]. This results in the wrong output if the additional log message is an empty string or null. E.g.:
`TKit.assertTrue(true, "Foo")` and `TKit.assertTrue(false, "Foo")` calls will output:
---
TRACE: assertTrue(): Foo <<<< Correct, output as expected
ERROR: Failed: Foo <<<< Correct, output as expected
---
`TKit.assertTrue(true, null)` and `TKit.assertTrue(false, null)` calls will output:
---
TRACE: assertTrue(): null <<<< This is wrong, should be "TRACE: assertTrue()"
ERROR: Failed <<<< Correct, output as expected
---
[1] https://github.com/openjdk/jdk/blob/52c0b09b62ca82f7e0cbe910cb92243131f06765/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java#L676
- links to
-
Commit(master) openjdk/jdk/95a00f8a
-
Review(master) openjdk/jdk/21995