diff -r 9173598d4a08 test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java Wed Jun 10 12:15:41 2020 -0400 +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java Wed Jun 10 13:10:18 2020 -0400 @@ -565,14 +565,32 @@ } if (cmd.isPackageUnpacked()) { - final Path appImageFile = AppImageFile.getPathInAppImage( - Path.of("")); + final Path appImageFileName = AppImageFile.getPathInAppImage( + Path.of("")).getFileName(); try (Stream walk = ThrowingSupplier.toSupplier( () -> Files.walk(cmd.unpackedPackageDirectory())).get()) { - walk.filter(path -> path.getFileName().equals(appImageFile)) - .findFirst() - .ifPresent(path -> TKit.assertPathExists(path, false)); + List appImageFiles = walk + .filter(path -> path.getFileName().equals(appImageFileName)) + .map(Path::toString) + .collect(Collectors.toList()); + if (TKit.isOSX()) { + List expected = List.of( + AppImageFile.getPathInAppImage( + cmd.unpackedPackageDirectory()).toString()); + TKit.assertStringListEquals(expected, appImageFiles, + String.format( + "Check there is only one file with [%s] name in the package", + appImageFileName)); + } else { + TKit.assertStringListEquals(List.of(), appImageFiles, + String.format( + "Check there are no files with [%s] name in the package", + appImageFileName)); + } } + } else if (TKit.isOSX()) { + TKit.assertFileExists(AppImageFile.getPathInAppImage( + cmd.appInstallationDirectory())); } else { TKit.assertPathExists(AppImageFile.getPathInAppImage( cmd.appInstallationDirectory()), false);