Example #1
0
  /**
   * Loads the test plans.
   *
   * @param testClass
   * @throws InitializationError
   */
  private void loadTestPlans(Class<?> testClass) throws InitializationError {
    try {
      GatewayRestTestPlan annotation = testClass.getAnnotation(GatewayRestTestPlan.class);
      if (annotation == null) {
        throw new InitializationError("Missing @GatewayRestTestPlan annotation on test class.");
      } else {
        TestPlanInfo planInfo = new TestPlanInfo();
        planInfo.planPath = annotation.value();
        planInfo.name = new File(planInfo.planPath).getName();
        planInfo.plan = TestUtil.loadTestPlan(planInfo.planPath, testClass.getClassLoader());
        testPlans.add(planInfo);
      }
    } catch (Throwable e) {
      throw new InitializationError(e);
    }

    if (testPlans.isEmpty()) {
      throw new InitializationError(
          "No @GatewayRestTestPlan annotations found on test class: " + testClass);
    }
  }