This repository was archived by the owner on May 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/test/java/com/mycompany/app Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 11package com .mycompany .app ;
22
3+ import org .graalvm .polyglot .Context ;
34import static org .junit .Assert .fail ;
5+ import org .junit .Assume ;
46import org .junit .BeforeClass ;
57import 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}
You can’t perform that action at this time.
0 commit comments