Skip to content

Commit

Permalink
Use jdk.jpackage.test.Annotations.Parameter annotation to parameteriz…
Browse files Browse the repository at this point in the history
…e packaging type in the test
  • Loading branch information
alexeysemenyukoracle committed Oct 16, 2024
1 parent 7e3ad9c commit 20f3015
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions test/jdk/tools/jpackage/share/InOutPathTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import jdk.jpackage.internal.ApplicationLayout;
import jdk.jpackage.internal.PackageFile;
import jdk.jpackage.test.Annotations;
import jdk.jpackage.test.Annotations.Parameter;
import jdk.jpackage.test.Annotations.Test;
import jdk.jpackage.test.Functional.ThrowingConsumer;
import jdk.jpackage.test.JPackageCommand;
Expand All @@ -57,28 +58,27 @@ public final class InOutPathTest {
public static Collection input() {
List<Object[]> data = new ArrayList<>();

for (boolean appImage : List.of(true, false)) {
data.addAll(List.of(new Object[][]{
{appImage, wrap(InOutPathTest::outputDirInInputDir, "--dest:subdir")},
{appImage, wrap(InOutPathTest::outputDirSameAsInputDir, "--dest:same")},
{appImage, wrap(InOutPathTest::tempDirInInputDir, "--temp")},
{appImage, wrap(cmd -> {
outputDirInInputDir(cmd);
tempDirInInputDir(cmd);
}, "--dest:subdir and --temp")},
}));
}
data.addAll(List.of(new Object[][]{
{wrap(InOutPathTest::outputDirInInputDir, "--dest:subdir")},
{wrap(InOutPathTest::outputDirSameAsInputDir, "--dest:same")},
{wrap(InOutPathTest::tempDirInInputDir, "--temp")},
{wrap(cmd -> {
outputDirInInputDir(cmd);
tempDirInInputDir(cmd);
}, "--dest:subdir and --temp")},
}));

return data;
}

public InOutPathTest(Boolean appImage, Envelope configure) {
this.appImage = appImage;
public InOutPathTest(Envelope configure) {
this.configure = configure.value;
}

@Test
public void test() throws Throwable {
@Parameter("true")
@Parameter("false")
public void test(boolean appImage) throws Throwable {
runTest(appImage, configure);
}

Expand Down Expand Up @@ -171,7 +171,6 @@ public String toString() {
}
}

private final boolean appImage;
private final ThrowingConsumer<JPackageCommand> configure;

private final static String JAR_NAME = "duke.jar";
Expand Down

0 comments on commit 20f3015

Please sign in to comment.