private void emitStatusLine ( AggregatedResultEvent result , TestStatus status , long timeMillis ) throws IOException { final StringBuilder line = new StringBuilder ( ) ; line . append ( shortTimestamp ( result . getStartTimestamp ( ) ) ) ; line . append ( Strings . padEnd ( statusNames . get ( status ) , 8 , ' ' ) ) ; line . append ( formatDurationInSeconds ( timeMillis ) ) ; if ( forkedJvmCount > 1 ) { line . append ( String . format ( Locale . ROOT , jvmIdFormat , result . getSlave ( ) . id ) ) ; } line . append ( " | " ) ; line . append ( formatDescription ( result . getDescription ( ) ) ) ; if ( ! result . isSuccessful ( ) ) { line . append ( FAILURE_MARKER ) ; } line . append ( "\n" ) ; if ( showThrowable ) { // GH-82 (cause for ignored tests). if ( status == TestStatus . IGNORED && result instanceof AggregatedTestResultEvent ) { final StringWriter sw = new StringWriter ( ) ; PrefixedWriter pos = new PrefixedWriter ( indent , sw , DEFAULT_MAX_LINE_WIDTH ) ; pos . write ( "Cause: " ) ; pos . write ( ( ( AggregatedTestResultEvent ) result ) . getCauseForIgnored ( ) ) ; pos . completeLine ( ) ; line . append ( sw . toString ( ) ) ; } final List < FailureMirror > failures = result . getFailures ( ) ; if ( ! failures . isEmpty ( ) ) { final StringWriter sw = new StringWriter ( ) ; PrefixedWriter pos = new PrefixedWriter ( indent , sw , DEFAULT_MAX_LINE_WIDTH ) ; int count = 0 ; for ( FailureMirror fm : failures ) { count ++ ; if ( fm . isAssumptionViolation ( ) ) { pos . write ( String . format ( Locale . ROOT , "Assumption #%d: %s" , count , MoreObjects . firstNonNull ( fm . getMessage ( ) , "(no message)" ) ) ) ; } else { pos . write ( String . format ( Locale . ROOT , "Throwable #%d: %s" , count , showStackTraces ? filterStackTrace ( fm . getTrace ( ) ) : fm . getThrowableString ( ) ) ) ; } } pos . completeLine ( ) ; if ( sw . getBuffer ( ) . length ( ) > 0 ) { line . append ( sw . toString ( ) ) ; } } } logShort ( line ) ; }
Emit status line for an aggregated event .