Elide GraalVM25.6.0-elide.4
All types
Versions and modules

ResultVerifier

Javainterfacein org.graalvm.polyglot.tcksince 0.30

public interface ResultVerifier extends Consumer<ResultVerifier.SnippetRun>
Extends

Allows a custom verification of a result of a snippet execution.

Methods3

void accept(ResultVerifier.SnippetRun)

accept

since 0.30
void accept(ResultVerifier.SnippetRun snippetRun) throws PolyglotException

Performs a verification of a result of a snippet execution. The custom ResultVerifier overrides the default snippet execution verification. The default verification tests that the result type is in bounds specified by the Snippet. The custom ResultVerifier can be used to do additional checking of a result or an execution exception throwing AssertionError in case of failed assertion. The custom ResultVerifier can hide an expected execution exception. For example the division operator snippet may provide a custom ResultVerifier hiding the execution exception for division by zero. To propagate the execution exception the ResultVerifier should re-throw it. The ResultVerifier can be used to resolve problems in the ErrorTypeTest by making the Snippet's parameter(s) more generic and restrict the required value in the verifier.

Parameters

snippetRunResultVerifier.SnippetRun
the snippet execution data. The SnippetRun provides the actual snippet parameters, the execution result, or the PolyglotException thrown by the execution. If the snippet execution throws an IllegalArgumentException, it's converted to PolyglotException.

Throws

PolyglotException
may propagate the PolyglotException from the snippetRun
AssertionErrorunchecked
may throw an AssertionError as a result of a verification

Overrides accept(T).

static ResultVerifier getDefaultResultVerifier()

getDefaultResultVerifier

staticsince 19.0
static ResultVerifier getDefaultResultVerifier()

Creates a default ResultVerifier. The default ResultVerifier tests that the result type is in bounds specified by the Snippet.

Returns

static ResultVerifier getIdentityFunctionDefaultResultVerifier()

getIdentityFunctionDefaultResultVerifier

staticsince 19.1.0
static ResultVerifier getIdentityFunctionDefaultResultVerifier()

Creates a default ResultVerifier for the IdentityFunctionTest. The returned ResultVerifier tests that the identity function does not change the parameter type.

Returns

ResultVerifier
the default ResultVerifier for IdentityFunctionTest.

Nested types

Inherited members

From interface Consumer

andThen