private void validateText ( String receivedMessagePayload , String controlMessagePayload ) { if ( ! StringUtils . hasText ( controlMessagePayload ) ) { log . debug ( "Skip message payload validation as no control message was defined" ) ; return ; } else { Assert . isTrue ( StringUtils . hasText ( receivedMessagePayload ) , "Validation failed - " + "expected message contents, but received empty message!" ) ; } if ( ! receivedMessagePayload . equals ( controlMessagePayload ) ) { if ( StringUtils . trimAllWhitespace ( receivedMessagePayload ) . equals ( StringUtils . trimAllWhitespace ( controlMessagePayload ) ) ) { throw new ValidationException ( "Text values not equal (only whitespaces!), expected '" + controlMessagePayload + "' " + "but was '" + receivedMessagePayload + "'" ) ; } else { throw new ValidationException ( "Text values not equal, expected '" + controlMessagePayload + "' " + "but was '" + receivedMessagePayload + "'" ) ; } } }
Compares two string with each other in order to validate plain text .