RFR: 8378111: Migrate java/util/jar tests to JUnit

Andrey Turbanov aturbanov at openjdk.org
Thu Feb 19 20:52:03 UTC 2026


On Thu, 19 Feb 2026 20:18:17 GMT, Justin Lu <jlu at openjdk.org> wrote:

> This PR migrates the java/util/jar tests to use _JUnit_.
> 
> https://github.com/openjdk/jdk/commit/afe0aeee746bccbbe4bc6c9a8cd2302228ecc2f6 includes changes for _testNG_ based tests.
> https://github.com/openjdk/jdk/commit/c5a7f75840f96fa77ec3ed7faa713990adb84de6 includes changes for `main` based tests.
> 
> Before: Framework-based tests: 125 = 125 TestNG + 0 JUnit.
> After: Framework-based tests: 174 = 0 TestNG + 174 JUnit

test/jdk/java/util/jar/JarFile/JarNoManifest.java line 42:

> 40:     @Test
> 41:     void absentManifestTest() throws IOException {
> 42:         File f = new File(System.getProperty("test.src","."), "no-manifest.jar");

Suggestion:

        File f = new File(System.getProperty("test.src", "."), "no-manifest.jar");

test/jdk/java/util/jar/JarFile/SorryClosed.java line 41:

> 39: public class SorryClosed {
> 40: 
> 41:     private static final File file = new File(System.getProperty("test.src","."), "test.jar");

Suggestion:

    private static final File file = new File(System.getProperty("test.src", "."), "test.jar");

test/jdk/java/util/jar/JarFile/TurkCert.java line 50:

> 48:     @Test
> 49:     void turkishLocaleTest() throws IOException {
> 50:         File f = new File(System.getProperty("test.src","."), "test.jar");

Suggestion:

        File f = new File(System.getProperty("test.src", "."), "test.jar");

test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java line 66:

> 64:     private static final Random RANDOM = RandomFactory.getRandom();
> 65: 
> 66:     private static final String userdir = System.getProperty("user.dir",".");

Suggestion:

    private static final String userdir = System.getProperty("user.dir", ".");

test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java line 67:

> 65: 
> 66:     private static final String userdir = System.getProperty("user.dir",".");
> 67:     private static final CreateMultiReleaseTestJars creator =  new CreateMultiReleaseTestJars();

Suggestion:

    private static final CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars();

test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarSecurity.java line 56:

> 54:     static final int MAJOR_VERSION = Runtime.version().major();
> 55: 
> 56:     private static final String userdir = System.getProperty("user.dir",".");

Suggestion:

    private static final String userdir = System.getProperty("user.dir", ".");

test/jdk/java/util/jar/JarInputStream/TestIndexedJarWithBadSignature.java line 51:

> 49:             assertThrows(SecurityException.class, () -> {
> 50:                 JarEntry je1;
> 51:                 while((je1 = jis.getNextJarEntry()) != null) {

Suggestion:

                while ((je1 = jis.getNextJarEntry()) != null) {

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29828#discussion_r2830086526
PR Review Comment: https://git.openjdk.org/jdk/pull/29828#discussion_r2830094967
PR Review Comment: https://git.openjdk.org/jdk/pull/29828#discussion_r2830079233
PR Review Comment: https://git.openjdk.org/jdk/pull/29828#discussion_r2830081400
PR Review Comment: https://git.openjdk.org/jdk/pull/29828#discussion_r2830082170
PR Review Comment: https://git.openjdk.org/jdk/pull/29828#discussion_r2830084626
PR Review Comment: https://git.openjdk.org/jdk/pull/29828#discussion_r2830083314


More information about the core-libs-dev mailing list