- 
                Notifications
    You must be signed in to change notification settings 
- Fork 33
conjure assertions provide diagnostic info for unexpected exceptions #883
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
This is based on the idea provided by #882, implemented to use standard assertj types and provide feedback consistent with builtin assertj checks.
| Generate changelog in  | 
| isNotNull(); | ||
|  | ||
| AssertableArgs actualArgs = new AssertableArgs(actual.getParameters()); | ||
| AssertableArgs actualArgs = new AssertableArgs(actual.getArgs()); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrated away from deprecated methods
| .hasMessage("Expecting code to throw a com.palantir.conjure.java.api.errors.ServiceException," | ||
| + " but caught a java.lang.RuntimeException."); | ||
| .hasMessageContaining( | ||
| "com.palantir.conjure.java.api.errors.ServiceException", "java.lang.RuntimeException"); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generified the asserts since it's not generally helpful to test precise string matches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't care about the precise string, but maybe to test that we are serializing the underlying error messages:
    assertThatThrownBy(() -> assertThatServiceExceptionThrownBy(() -> {
                throw new RuntimeException("My helpful message");
            }))
            .hasMessageContaining(
                    "com.palantir.conjure.java.api.errors.ServiceException",
                    "java.lang.RuntimeException",
                    "My helpful message");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would support checking that the full message is serialized, as that's the point of this change, but I don't know the assertj implementation. If that's what it's basically supposed to do, then let's ship it, no need to re-test their implementation.
| Released 2.28.0 | 
This is based on the idea provided by #882, implemented to use
standard assertj types and provide feedback consistent with builtin
assertj checks.
==COMMIT_MSG==
conjure assertions provide diagnostic info for unexpected exceptions
==COMMIT_MSG==