コード例 #1
0
  public ExecutionResult(
      Sequence original_seq,
      int replacing_index,
      Sequence replacing_sequence,
      AbstractState replacing_profile,
      ExecutableSequence eseq_replaced) {
    FDUtils.checkNull(original_seq, "The original seq could not be null.");
    FDUtils.checkTrue(
        replacing_index >= 0 && replacing_index < original_seq.size(),
        "The replacing_index: "
            + replacing_index
            + " is not valid, the seq size: "
            + original_seq.size());
    FDUtils.checkNull(replacing_sequence, "the replacing_sequence could not be null.");
    FDUtils.checkNull(eseq_replaced, "The eseq_replaced could not be null.");

    this.original_sequence = original_seq;
    this.replacing_index = replacing_index;
    this.replacing_sequence = replacing_sequence;
    this.replacing_profile = replacing_profile;
    this.replaced_eSeq = eseq_replaced;

    // get the result,  about exceptional, failure, or not executed?

    // get the binary-profile
  }
コード例 #2
0
  public Throwable getThrownException() {
    if (this.cached_exception_thrown != null) {
      return this.cached_exception_thrown;
    }

    if (!hasExceptionThrown()) {
      this.cached_exception_thrown = null;
      return this.cached_exception_thrown;
    }

    int index_of_exception = -1;
    ExecutionOutcome[] outcomes = this.replaced_eSeq.getAllResults();
    for (int i = 0; i < outcomes.length; i++) {
      if (outcomes[i] instanceof ExceptionalExecution) {
        index_of_exception = i;
        ExceptionalExecution e = (ExceptionalExecution) outcomes[i];
        this.cached_exception_thrown = e.getException();
        break;
      }
    }

    int index_of_exception_in_original = index_of_exception - this.replacing_sequence.size() + 1;

    // check there must be exception
    FDUtils.checkTrue(
        this.replaced_eSeq.hasUnexpectedException(),
        "The replace_eSeq should have unexpected" + " exception.");
    FDUtils.checkNull(this.cached_exception_thrown, "The cached_exception could not be null.");
    // the statement must has exceptions, the last statement executed
    FDUtils.checkTrue(
        index_of_exception_in_original == this.indexOfExecuted(),
        "The index_of_exception: "
            + index_of_exception_in_original
            + " !=  this.indexOfExecuted(): "
            + this.indexOfExecuted());

    return this.cached_exception_thrown;
  }