DisabledCondition.java 文件源码

java
阅读 49 收藏 0 点赞 0 评论 0

项目:bach 作者:
@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext extensionContext) {
  AnnotatedElement element = extensionContext.getElement().orElseThrow(AssertionError::new);
  Disabled disabled = findAnnotation(element, Disabled.class).orElseThrow(AssertionError::new);
  String name = disabled.value();
  String reason = name + "=" + System.getProperty(name);
  boolean result = Boolean.getBoolean(name);
  if (disabled.not()) {
    result = !result;
  }
  if (result) {
    return ConditionEvaluationResult.disabled(reason);
  }
  return ConditionEvaluationResult.enabled(reason);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号