use of org.junit.jupiter.engine.script.Script in project junit5 by junit-team.
the class ScriptExecutionEvaluatorTests method computeConditionEvaluationResultFailsForUnsupportedAnnotationType.
private void computeConditionEvaluationResultFailsForUnsupportedAnnotationType(Class<? extends Annotation> type) {
Script script = new Script(type, "annotation", "engine", "source", "reason");
Exception e = assertThrows(ScriptEvaluationException.class, () -> evaluator.computeConditionEvaluationResult(script, "!"));
String expected = "Unsupported annotation type: " + type;
String actual = e.getMessage();
assertEquals(expected, actual);
}
use of org.junit.jupiter.engine.script.Script in project junit5 by junit-team.
the class ScriptExecutionEvaluatorTests method getJUnitConfigurationParameterWithJavaScriptAndCheckForNull.
@Test
void getJUnitConfigurationParameterWithJavaScriptAndCheckForNull() {
Script script = script(DisabledIf.class, "junitConfigurationParameter.get('XXX') == null");
ConditionEvaluationResult result = evaluate(script);
assertTrue(result.isDisabled());
//
assertThat(result.getReason()).contains("Script `junitConfigurationParameter.get('XXX') == null` evaluated to: true");
}
use of org.junit.jupiter.engine.script.Script in project junit5 by junit-team.
the class ScriptExecutionEvaluatorTests method defaultConditionEvaluationResultProperties.
@Test
void defaultConditionEvaluationResultProperties() {
Script script = script(EnabledIf.class, "true");
ConditionEvaluationResult result = evaluate(script);
assertFalse(result.isDisabled());
assertThat(result.toString()).contains("ConditionEvaluationResult", "enabled", "true", "reason");
}
Aggregations