CdhServer.java 文件源码

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

项目:cloudera-framework 作者:
@SuppressWarnings({"rawtypes", "LoopStatementThatDoesntLoop"})
private boolean assertTestRunner(String testClass) {
  try {
    RunWith runWith = Class.forName(testClass).getAnnotation(RunWith.class);
    if (runWith == null) {
      throw new RuntimeException("Missing [@" + RunWith.class.getCanonicalName() + "(" + TestRunner.class.getCanonicalName()
        + ".class)] on class [" + testClass + "]");
    }
    if (runWith.value().equals(Suite.class)) {
      SuiteClasses suiteClasses = Class.forName(testClass).getAnnotation(SuiteClasses.class);
      for (Class suiteTestClass : suiteClasses.value()) {
        return assertTestRunner(suiteTestClass.getCanonicalName());
      }
    } else if (!runWith.value().equals(TestRunner.class)) {
      throw new RuntimeException("Unsupported run with [" + runWith.value().getCanonicalName() + "] on class [" + testClass + "]");
    }
  } catch (Exception exception) {
    String message = "The test [" + testClass + "] included a rule [" + getClass().getCanonicalName() + "] but did not include a [@"
      + RunWith.class.getCanonicalName() + "(" + TestRunner.class.getCanonicalName() + ".class)] class annotation";
    if (LOG.isErrorEnabled()) {
      LOG.error(message, exception);
    }
    throw new RuntimeException(message, exception);
  }
  return true;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号