|
4 | 4 |
|
5 | 5 | package org.mozilla.javascript.tests; |
6 | 6 |
|
7 | | -import static org.junit.jupiter.api.Assumptions.assumeTrue; |
| 7 | +import static org.junit.jupiter.api.Assumptions.assumeFalse; |
8 | 8 |
|
9 | 9 | import org.junit.jupiter.api.Test; |
10 | 10 | import org.mozilla.javascript.Context; |
11 | 11 | import org.mozilla.javascript.ContextFactory; |
12 | 12 | import org.mozilla.javascript.Script; |
13 | 13 | import org.mozilla.javascript.TopLevel; |
| 14 | +import org.mozilla.javascript.testutils.Utils; |
14 | 15 |
|
15 | 16 | /** |
16 | 17 | * Takes care that the name of the method generated for a function "looks like" the original |
@@ -94,18 +95,12 @@ public void doTest(final String scriptCode) throws Exception { |
94 | 95 | // Stack traces seem to be showing up differently in Java 21. Since |
95 | 96 | // this is not something that we can control, we're going to ignore |
96 | 97 | // these tests in that case. |
97 | | - assumeTrue(isJava21(), () -> "Skipping test: Java 21 or higher"); |
| 98 | + assumeFalse(Utils.isJavaVersionAtLeast(21), () -> "Skipping test: Java 21 or higher"); |
98 | 99 | try (Context cx = ContextFactory.getGlobal().enterContext()) { |
99 | 100 | TopLevel topScope = cx.initStandardObjects(); |
100 | 101 | topScope.put("javaNameGetter", topScope, new JavaNameGetter()); |
101 | 102 | Script script = cx.compileString(scriptCode, "myScript", 1, null); |
102 | 103 | script.exec(cx, topScope, topScope); |
103 | 104 | } |
104 | 105 | } |
105 | | - |
106 | | - private static boolean isJava21() { |
107 | | - String[] v = System.getProperty("java.version").split("\\."); |
108 | | - int version = Integer.parseInt(v[0]); |
109 | | - return version >= 21; |
110 | | - } |
111 | 106 | } |
0 commit comments