Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.

Commit 478d18a

Browse files
author
Jaroslav Tulach
committed
Skip tests when running on plain JDK8
1 parent 53deae3 commit 478d18a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/test/java/com/mycompany/app/AppTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.mycompany.app;
22

3+
import org.graalvm.polyglot.Context;
34
import static org.junit.Assert.fail;
5+
import org.junit.Assume;
46
import org.junit.BeforeClass;
57
import org.junit.Test;
68

@@ -14,6 +16,7 @@ public static void nashornBenchmark() throws Exception {
1416

1517
@Test
1618
public void testGraalPolyglotSpeed() throws Exception {
19+
assertGraalVMOrJDK11();
1720
long graalJS = App.benchGraalPolyglotContext();
1821
if (nashorn < graalJS) {
1922
fail(String.format("Graal.js (%d ms) should be faster than Nashorn (%d ms).", graalJS, nashorn));
@@ -22,9 +25,18 @@ public void testGraalPolyglotSpeed() throws Exception {
2225

2326
@Test
2427
public void testGraalScriptEngineSpeed() throws Exception {
28+
assertGraalVMOrJDK11();
2529
long graalJS = App.benchGraalScriptEngine();
2630
if (nashorn < graalJS) {
2731
fail(String.format("Graal.js (%d ms) should be faster than Nashorn (%d ms).", graalJS, nashorn));
2832
}
2933
}
34+
35+
private void assertGraalVMOrJDK11() {
36+
try {
37+
Context.create().close();
38+
} catch (IllegalStateException ex) {
39+
Assume.assumeNoException("Download GraalVM.org or use JDK11!", ex);
40+
}
41+
}
3042
}

0 commit comments

Comments
 (0)