Repository navigation
test: pin that user messages containing "expected" survive in full - #47
Open
Contributerr27 wants to merge 1 commit into
Open
Contributerr27 wants to merge 1 commit into
Contributerr27 wants to merge 1 commit into
Conversation
Regression coverage for testng-team#16. The reported symptom (a message like "Text is not expected. It should be this" displayed only up to "expected") came from the pre-AssertJ message construction. With the current AssertJ-backed asserts the user text reaches the caller intact, and these tests pin that for the hard asserts, fail(), and the SoftAssert aggregation path, including a message that mimics the "expected: <x> but was: <y>" comparison pattern that test runners pattern-match. Closes testng-team#16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16
What
Adds
MessagePreservationTest(10 tests) pinning that a user-supplied description survives intact in the thrownAssertionErrorfor every hard assert shape (assertTrue/assertFalse/assertEquals/assertNotEquals/assertNull/assertNotNull), forfail(...), and for theSoftAssertaggregation path. Two of the ten cover the worst cases from #16: the issue's exact message (Text is not expected. It should be this) and a message that mimics theexpected: <x> but was: <y>comparison pattern.Why
#16 reported a description shown only up to the word "expected". That symptom came from the pre-AssertJ message construction. The current asserts delegate to AssertJ (
assertTrue->assertThat(condition).as(message).isTrue()), and the user text now reaches the exception in full. Verified against AssertJ 3.27.7:What a runner or IDE displays is its own pattern-matching, but the exception message itself (what Surefire reports and what IntelliJ receives) carries everything, so the behavior the issue asks for is in place. These tests pin it so it can't silently regress.
Testing
mvn test-> 214 tests run, 0 failures, 0 errors (10 new).