public function testTrailingSpacesAreRemovedFromMessage()
    {
        $exception = new \RuntimeException("\n\nError\nwith newlines\n");
        $test = $this->createTestMock('ErrorTest');
        $this->listener->addError($test, $exception, 5);
        $message = $this->readOut();
        $expectedOutputStart = <<<EOS
##teamcity[testFailed message='RuntimeException: |n|nError|nwith newlines' details=
EOS;
        $this->assertStringStartsWith($expectedOutputStart, $message);
    }
    public function testTrailingSpacesAreRemovedFromMessage()
    {
        $exception = new \RuntimeException("\n\nError\nwith newlines\n");
        $test = $this->createTestMock('ErrorTest');
        $this->listener->addError($test, $exception, 5);
        $expectedOutputStart = <<<EOS
##teamcity[testFailed message='RuntimeException: |n|nError|nwith newlines' details='
EOS;
        $expectedOutputEnd = <<<EOE
' name='ErrorTest' timestamp='2015-05-28T16:14:12.17+0700' flowId='24107']

EOE;
        $this->assertOutputStartsAndEndsWith($expectedOutputStart, $expectedOutputEnd);
    }