use of org.junit.jupiter.api.condition.DisabledIf in project junit5 by junit-team.
the class ScriptExecutionCondition method createDisabledIfScriptOrNull.
private Script createDisabledIfScriptOrNull(AnnotatedElement annotatedElement) {
Optional<DisabledIf> disabled = findAnnotation(annotatedElement, DisabledIf.class);
if (!disabled.isPresent()) {
return null;
}
DisabledIf annotation = disabled.get();
String source = createSource(annotation.value());
return new Script(annotation, annotation.engine(), source, annotation.reason());
}
use of org.junit.jupiter.api.condition.DisabledIf in project junit5 by junit-team.
the class ScriptExecutionConditionTests method annotationDefaultValues.
@Test
@EnabledIf("true")
@DisabledIf("false")
void annotationDefaultValues(TestInfo info) {
EnabledIf e = info.getTestMethod().orElseThrow(Error::new).getDeclaredAnnotation(EnabledIf.class);
assertEquals("Nashorn", e.engine());
assertEquals("Script `{source}` evaluated to: {result}", e.reason());
DisabledIf d = info.getTestMethod().orElseThrow(Error::new).getDeclaredAnnotation(DisabledIf.class);
assertEquals("Nashorn", d.engine());
assertEquals("Script `{source}` evaluated to: {result}", d.reason());
}
Aggregations