예제 #1
0
 protected void evaluateExpectations() {
   for (SlimTable.Expectation e : expectations) {
     try {
       e.evaluateExpectation(instructionResults);
     } catch (Throwable ex) {
       exceptions.addException("ABORT", exceptionToString(ex));
       exceptionOccurred(ex);
     }
   }
 }
예제 #2
0
    @SuppressWarnings("unchecked")
    private void addInstructionResult(Object instruction) {
      TestExecutionReport.InstructionResult instructionResult =
          new TestExecutionReport.InstructionResult();
      testResult.instructions.add(instructionResult);

      List<Object> instructionList = (List<Object>) instruction;
      String id = (String) (instructionList.get(0));
      Object result = results.get(id);

      instructionResult.instruction = instruction.toString();
      instructionResult.slimResult = (result != null) ? result.toString() : "";
      for (SlimTable.Expectation expectation : expectations) {
        if (expectation.getInstructionTag().equals(id)) {
          try {
            TestExecutionReport.Expectation expectationResult =
                new TestExecutionReport.Expectation();
            instructionResult.addExpectation(expectationResult);
            expectationResult.instructionId = expectation.getInstructionTag();
            expectationResult.col = Integer.toString(expectation.getCol());
            expectationResult.row = Integer.toString(expectation.getRow());
            expectationResult.type = expectation.getClass().getSimpleName();
            expectationResult.actual = expectation.getActual();
            expectationResult.expected = expectation.getExpected();
            String message = expectation.getEvaluationMessage();
            expectationResult.evaluationMessage = message;
            expectationResult.status = expectationStatus(message);
          } catch (Throwable e) {
            e.printStackTrace();
          }
        }
      }
    }