Skip to content

Improve readability of assertion messages #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

MariuszCwikla
Copy link

@MariuszCwikla MariuszCwikla commented Apr 23, 2022

If there is an request processing error, e.g. syntax error:

User u = gql.document("{user(login: \"john\"){{ login status} }")
	.execute()
	.path("user")
	.entity(User.class)
	.get();
assertEquals("john", u.getLogin());

then assertion error message does not have good enough information which makes development bit harder ($Error@5bb0122])

[ERROR]   GraphQlTests.testGetUser:26 Response has 1 unexpected error(s) of 1 total. If expected, please filter them out: [org.springframework.graphql.support.DefaultExecutionGraphQlResponse$Error@5bb0122]
Request: document='{user(login: "john"){{ login status} }'

I am proposing a simple change to improve the readability. Here is the result:

[ERROR] Failures:
[ERROR]   GraphQlTests.testGetUser:34 Response has 1 unexpected error(s) of 1 total. If expected, please filter them out: [InvalidSyntaxError{ message=Invalid Syntax : offending token '{' at line 1 column 22 ,offendingToken={ ,locations=[SourceLocation{line=1, column=22}] ,sourcePreview={user(login: "john"){{ login status} }
}]
Request: document='{user(login: "john"){{ login status} }'

@pivotal-cla
Copy link

@MariuszCwikla Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 23, 2022
@pivotal-cla
Copy link

@MariuszCwikla Thank you for signing the Contributor License Agreement!

@rstoyanchev rstoyanchev self-assigned this Apr 25, 2022
@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 25, 2022
@rstoyanchev rstoyanchev added this to the 1.0.0 milestone Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants