public void finish() {
   if (currentTest != null && testNGResults != null) {
     final TestProxy failedToStart = testNGResults.getFailedToStart();
     if (failedToStart != null) {
       currentTest.addChild(failedToStart);
       currentTest.setTearDownFailure(true);
       testNGResults.setFailedToStart(null);
     }
   }
   currentTest = null;
 }
  public void addTestResult(TestResultMessage result) {
    if (testNGResults != null) {
      int exceptionMark = myExceptionalMark == -1 ? 0 : myExceptionalMark;

      if (currentTest != null) {
        final String stackTrace = result.getStackTrace();
        if (stackTrace != null && stackTrace.length() > 10) {
          exceptionMark = currentTest.getCurrentSize();
          // trim useless crud from stacktrace
          currentTest.appendStacktrace(result);
        }
        final TestProxy failedToStart = testNGResults.getFailedToStart();
        if (failedToStart != null) {
          currentTest.addChild(failedToStart);
        }
      }
      testNGResults.addTestResult(result, exceptionMark);
      myExceptionalMark = -1;
    }
  }
 @Override
 public void initUI() {
   super.initUI();
   final TestTreeView testTreeView = testNGResults.getTreeView();
   testTreeView
       .getSelectionModel()
       .addTreeSelectionListener(
           new TreeSelectionListener() {
             public void valueChanged(TreeSelectionEvent e) {
               getPrinter().updateOnTestSelected(testTreeView.getSelectedTest());
             }
           });
 }
 public void testStarted(TestResultMessage result) {
   if (testNGResults != null) {
     currentTest = testNGResults.testStarted(result);
   }
 }
 public void rebuildTree() {
   if (testNGResults != null) {
     testNGResults.rebuildTree();
   }
 }