public static void conditionFailedWithException( @Nullable ErrorCollector errorCollector, @Nullable ValueRecorder recorder, @Nullable String text, int line, int column, @Nullable Object message, Throwable throwable) { if (throwable instanceof SpockAssertionError) { final SpockAssertionError spockAssertionError = (SpockAssertionError) throwable; errorCollector.collectOrThrow( spockAssertionError); // this is our exception - it already has good message return; } if (throwable instanceof SpockException) { final SpockException spockException = (SpockException) throwable; errorCollector.collectOrThrow( spockException); // this is our exception - it already has good message return; } final ConditionNotSatisfiedError conditionNotSatisfiedError = new ConditionNotSatisfiedError( new Condition( getValues(recorder), text, TextPosition.create(line, column), messageToString(message), recorder == null ? null : recorder.getCurrentRecordingVarNum(), recorder == null ? null : throwable), throwable); errorCollector.collectOrThrow(conditionNotSatisfiedError); }