private void failWithMessage ( String errorMessage ) { AssertionError assertionError = Failures . instance ( ) . failureIfErrorMessageIsOverridden ( info ) ; if ( assertionError == null ) { // error message was not overridden, build it. String description = MessageFormatter . instance ( ) . format ( info . description ( ) , info . representation ( ) , "" ) ; assertionError = new AssertionError ( description + errorMessage ) ; } Failures . instance ( ) . removeAssertJRelatedElementsFromStackTraceIfNeeded ( assertionError ) ; throw assertionError ; }
Copy from AssertJ to prevent errors with percents in error message