public class Utils extends Object
| Modifier and Type | Field and Description |
|---|---|
static int[] |
DEFAULT_OPT_LEVELS
The default set of levels to run tests at.
|
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertEcmaError_1_8(String expectedMessage,
String script)
Execute the provided script and assert an
EcmaError. |
static void |
assertEcmaError(String expectedMessage,
String script)
Execute the provided script and assert an
EcmaError. |
static void |
assertEcmaErrorES6(String expectedMessage,
String script)
Execute the provided script and assert an
EcmaError. |
static void |
assertEvaluatorException_1_8(String expectedMessage,
String script)
Execute the provided script and assert an
EvaluatorException. |
static void |
assertEvaluatorExceptionES6(String expectedMessage,
String script)
Execute the provided script and assert an
EvaluatorException. |
static <T extends Exception> |
assertException(ContextFactory contextFactory,
int languageVersion,
Class<T> expectedThrowable,
String expectedMessage,
String js) |
static <T extends Exception> |
assertException(int languageVersion,
Class<T> expectedThrowable,
String expectedMessage,
String js) |
static void |
assertWithAllModes_1_4(Object expected,
String script)
Execute the provided script and assert the result.
|
static void |
assertWithAllModes_1_5(Object expected,
String script)
Execute the provided script and assert the result.
|
static void |
assertWithAllModes_1_8(Object expected,
String script)
Execute the provided script and assert the result.
|
static void |
assertWithAllModes_ES6(Object expected,
String script)
Execute the provided script and assert the result.
|
static void |
assertWithAllModes_ES6(String message,
Object expected,
String script)
Execute the provided script and assert the result.
|
static void |
assertWithAllModes(ContextFactory contextFactory,
int languageVersion,
String message,
Object expected,
String script)
Execute the provided script and assert the result.
|
static void |
assertWithAllModes(int languageVersion,
String message,
Object expected,
String script)
Execute the provided script and assert the result.
|
static void |
assertWithAllModes(Object expected,
String script)
Execute the provided script and assert the result.
|
static void |
assertWithAllModesTopLevelScope_ES6(Object expected,
String script) |
static ContextFactory |
contextFactoryWithFeatures(int... features) |
static int[] |
getTestOptLevels()
If the TEST_OPTLEVEL system property is set, then return an array containing only that one
integer.
|
static boolean |
isJavaVersionAtLeast(int desiredVersion) |
static void |
runWithAllModes(ContextAction<?> action)
Runs the action successively with interpreted and optimized mode
|
static void |
runWithAllModes(ContextFactory contextFactory,
ContextAction<?> action)
Runs the action successively with interpreted and optimized mode
|
static void |
runWithMode(ContextAction<?> action,
boolean interpretedMode)
Runs the provided action at the given interpretation mode
|
static void |
runWithMode(ContextFactory contextFactory,
ContextAction<?> action,
boolean interpretedMode)
Runs the provided action at the given interpretation mode
|
public static final int[] DEFAULT_OPT_LEVELS
public static void runWithAllModes(ContextAction<?> action)
public static void runWithAllModes(ContextFactory contextFactory, ContextAction<?> action)
public static void runWithMode(ContextAction<?> action, boolean interpretedMode)
public static void runWithMode(ContextFactory contextFactory, ContextAction<?> action, boolean interpretedMode)
public static int[] getTestOptLevels()
public static boolean isJavaVersionAtLeast(int desiredVersion)
public static void assertWithAllModes(Object expected, String script)
expected - the expected resultscript - the javascript script to executepublic static void assertWithAllModes_1_4(Object expected, String script)
Context.VERSION_1_4.expected - the expected resultscript - the javascript script to executepublic static void assertWithAllModes_1_5(Object expected, String script)
Context.VERSION_1_5.expected - the expected resultscript - the javascript script to executepublic static void assertWithAllModes_1_8(Object expected, String script)
Context.VERSION_1_8.expected - the expected resultscript - the javascript script to executepublic static void assertWithAllModes_ES6(Object expected, String script)
Context.VERSION_ES6.expected - the expected resultscript - the javascript script to executepublic static void assertWithAllModes_ES6(String message, Object expected, String script)
Context.VERSION_ES6.message - the message to be used if this failsexpected - the expected resultscript - the javascript script to executepublic static void assertWithAllModes(int languageVersion,
String message,
Object expected,
String script)
languageVersion - the language version constant from @Context or -1 to not
change the language version at allmessage - the message to be used if this failsexpected - the expected resultscript - the javascript script to executepublic static void assertWithAllModes(ContextFactory contextFactory, int languageVersion, String message, Object expected, String script)
contextFactory - a user defined ContextFactorylanguageVersion - the language version constant from @Context or -1 to not
change the language version at allmessage - the message to be used if this failsexpected - the expected resultscript - the javascript script to executepublic static void assertWithAllModesTopLevelScope_ES6(Object expected, String script)
public static void assertEvaluatorException_1_8(String expectedMessage, String script)
EvaluatorException. The error message of
the EvaluatorException has to start with the provided expectedMessage. Before the
execution the language version is set to Context.VERSION_1_8.expectedMessage - the expected resultscript - the javascript script to executepublic static void assertEvaluatorExceptionES6(String expectedMessage, String script)
EvaluatorException. The error message of
the EvaluatorException has to start with the provided expectedMessage. Before the
execution the language version is set to Context.VERSION_ES6.expectedMessage - the expected resultscript - the javascript script to executepublic static void assertEcmaError(String expectedMessage, String script)
EcmaError. The error message of the EcmaError has to start with the provided expectedMessage.expectedMessage - the expected resultscript - the javascript script to executepublic static void assertEcmaError_1_8(String expectedMessage, String script)
EcmaError. The error message of the EcmaError has to start with the provided expectedMessage. Before the execution the language
version is set to Context.VERSION_1_8.expectedMessage - the expected resultscript - the javascript script to executepublic static void assertEcmaErrorES6(String expectedMessage, String script)
EcmaError. The error message of the EcmaError has to start with the provided expectedMessage. Before the execution the language
version is set to Context.VERSION_1_8.expectedMessage - the expected resultscript - the javascript script to executepublic static <T extends Exception> void assertException(int languageVersion, Class<T> expectedThrowable, String expectedMessage, String js)
public static <T extends Exception> void assertException(ContextFactory contextFactory, int languageVersion, Class<T> expectedThrowable, String expectedMessage, String js)
public static ContextFactory contextFactoryWithFeatures(int... features)
features - the features to enable in addition to the already enabled featured from the
ContextFactoryContextFactory with all provided features enabledCopyright © 2025 HtmlUnit. All rights reserved.