Skip to content
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

Prefer AssertJ does not convert exceptions returned from Junit assertThrows #93

Open
fawind opened this issue Feb 19, 2020 · 0 comments

Comments

@fawind
Copy link
Contributor

fawind commented Feb 19, 2020

What happened?

If the returned Throwable of Junit's assertThrows is used for further checks, the build breaks when the "Prefer AssertJ" conversion is applied. This is because AssertJ's assertThatThrownBy does not return a Throwable.

Example from a PR:

- Throwable throwed = assertThrows(() -> foo());
- assertThat(throwed.getMessage()).contains("My error msg");

+ Throwable throwed = assertThatThrownBy(() -> foo());  // This breaks
+ assertThat(throwed.getMessage()).contains("My error msg");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant