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

JUnit ExpectedException is deprecated #7467

Open
ejona86 opened this issue Sep 28, 2020 · 0 comments
Open

JUnit ExpectedException is deprecated #7467

ejona86 opened this issue Sep 28, 2020 · 0 comments

Comments

@ejona86
Copy link
Member

ejona86 commented Sep 28, 2020

In JUnit 4.13 ExpectedException is deprecated. The replacement, assertThrows, is Java 8-centric and would be annoying to use in the short-term. Using try+fail would increase boilerplate and would be worse than just using ExpectedException.

We can @SuppressWarnings for now, but we should swap to assertThrows (or Truth's variant) in the future once we can use Java 8 in our tests.

@ejona86 ejona86 added this to the Unscheduled milestone Sep 28, 2020
ejona86 added a commit to ejona86/grpc-java that referenced this issue Jan 13, 2023
ExpectedException is deprecated, so I fixed the new warnings. However,
we are still using ExpectedException many places and had previously
supressed the warning. See
grpc#7467 . I did not fix those
existing instances that had suppressed the warning, since it is
unrelated to the upgrade and we have been free to fix them at any time
since we dropped Java 7.
ejona86 added a commit that referenced this issue Jan 20, 2023
ExpectedException is deprecated, so I fixed the new warnings. However,
we are still using ExpectedException many places and had previously
supressed the warning. See
#7467 . I did not fix those
existing instances that had suppressed the warning, since it is
unrelated to the upgrade and we have been free to fix them at any time
since we dropped Java 7.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant