test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FileAssociations.java
branchJDK-8200758-branch
changeset 58888 d802578912f3
parent 58696 61c44899b4eb
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FileAssociations.java	Thu Oct 31 11:11:42 2019 -0400
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FileAssociations.java	Thu Oct 31 11:18:41 2019 -0400
@@ -34,7 +34,7 @@
         setDescription("jpackage test extention");
     }
 
-    public void createFile() {
+    private void createFile() {
         Map<String, String> entries = new HashMap<>(Map.of(
             "extension", suffixName,
             "mime-type", getMime(),
@@ -65,18 +65,28 @@
         return this;
     }
 
-    public Path getPropertiesFile() {
+    Path getPropertiesFile() {
         return file;
     }
 
-    public String getSuffix() {
+    String getSuffix() {
         return "." + suffixName;
     }
 
-    public String getMime() {
+    String getMime() {
         return "application/x-jpackage-" + suffixName;
     }
 
+    public void applyTo(PackageTest test) {
+        test.notForTypes(PackageType.MAC_DMG, () -> {
+            test.addInitializer(cmd -> {
+                createFile();
+                cmd.addArguments("--file-associations", getPropertiesFile());
+            });
+            test.addHelloAppFileAssociationsVerifier(this);
+        });
+    }
+
     private Path file;
     final private String suffixName;
     private String description;