예제 #1
0
  /**
   * @return next test from test matrix: {varArgs, noVarArgs} x TestCase.rtypes x
   *     TestCase.THROWABLES x {1, .., maxArgs } x {1, .., maxDrops}
   */
  public CatchExceptionTest nextTest() {
    if (constructor < constructorSize) {
      return createTest();
    }
    constructor = 0;
    count++;
    if (!Helper.IS_THOROUGH && count > Helper.TEST_LIMIT) {
      System.out.println("test limit is exceeded");
      return null;
    }
    if (dropArgs <= currentMaxDrops) {
      if (dropArgs == 1) {
        if (Helper.IS_THOROUGH || Helper.RNG.nextBoolean()) {
          ++dropArgs;
          return createTest();
        } else if (Helper.IS_VERBOSE) {
          System.out.printf("argsCount=%d : \"drop\" scenarios are skipped%n", args);
        }
      } else {
        ++dropArgs;
        return createTest();
      }
    }

    if (args <= maxArgs) {
      dropArgs = 1;
      currentMaxDrops = Math.min(args, maxDrops);
      ++args;
      return createTest();
    }
    return null;
  }
예제 #2
0
 private CatchExceptionTest createTest() {
   if (!Helper.IS_THOROUGH) {
     return new CatchExceptionTest(
         TestCase.CONSTRUCTORS.get(constructor++).get(), Helper.RNG.nextBoolean(), args, dropArgs);
   } else {
     if (isVararg) {
       isVararg = false;
       return new CatchExceptionTest(
           TestCase.CONSTRUCTORS.get(constructor++).get(), isVararg, args, dropArgs);
     } else {
       isVararg = true;
       return new CatchExceptionTest(
           TestCase.CONSTRUCTORS.get(constructor).get(), isVararg, args, dropArgs);
     }
   }
 }