/**
  * @param \Exception $e
  */
 public function paintException(\Exception $e)
 {
     parent::paintException($e);
     $this->writeError(get_class($e) . ': ' . $e->getMessage() . PHP_EOL . PHP_EOL . $e->getFile() . ':' . $e->getLine() . PHP_EOL . FailureTrace::buildFailureTrace($e->getTrace()), null, $e->getFile(), $e->getLine(), $e->getMessage());
 }
 /**
  * @param \PHPUnit_Framework_Test $test
  * @param \Exception              $e
  * @param float                   $time
  * @param string                  $failureOrError
  */
 protected function writeFailureOrError(\PHPUnit_Framework_Test $test, \Exception $e, $time, $failureOrError)
 {
     $testIsArtificial = false;
     if (!$this->testStarted) {
         $this->startTest($test);
         $testIsArtificial = true;
     }
     if ($test instanceof \PHPUnit_Framework_SelfDescribing) {
         $message = $test->toString() . "\n\n";
     } else {
         $message = '';
     }
     $message .= \PHPUnit_Framework_TestFailure::exceptionToString($e) . "\n";
     if ($test instanceof \PHPUnit_Framework_Warning) {
         $testClass = new \ReflectionClass($this->currentTestClassName);
         $file = $testClass->getFileName();
         $line = 1;
     } elseif ($test instanceof \PHPUnit_Framework_WarningTestCase && preg_match('/^No tests found in class "([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)"\\.$/', $test->getMessage(), $matches)) {
         $testClass = new \ReflectionClass($this->currentTestClassName);
         $file = $testClass->getFileName();
         $line = 1;
     } else {
         list($file, $line) = FailureTrace::findFileAndLineOfFailureOrError($this->testTargetRepository->getRequiredSuperTypes(), $e, new \ReflectionClass($test));
     }
     $trace = \PHPUnit_Util_Filter::getFilteredStacktrace($e, true);
     $this->junitXMLWriter->{'write' . $failureOrError}($message . $trace, get_class($e), $file, $line, $message);
     if ($testIsArtificial) {
         $this->endTest($test, 0);
     }
 }
 /**
  * @param \PHPSpec\Runner\ReporterEvent $reporterEvent
  * @param string $failureOrError
  */
 protected function renderFailureOrError(ReporterEvent $reporterEvent, $failureOrError)
 {
     list($file, $line) = FailureTrace::findFileAndLineOfFailureOrError($this->testTargetRepository->getRequiredSuperTypes(), $reporterEvent->exception, new \ReflectionClass($this->testSuite->getExampleGroupClass($this->currentExampleGroupName)));
     $failureTrace = FailureTrace::buildFailureTrace($reporterEvent->exception->getTrace());
     $this->junitXMLWriter->{'write' . $failureOrError}($reporterEvent->message . PHP_EOL . PHP_EOL . $failureTrace, get_class($reporterEvent->exception), $file, $line, $reporterEvent->message);
 }