Skip to content

[UnusedVariable] Add MockitoBean in exempting variable annotations#4800

Open
alexandrenavarro wants to merge 1 commit intogoogle:masterfrom
alexandrenavarro:fix-unused-variable-by-exempting-mockito-bean
Open

[UnusedVariable] Add MockitoBean in exempting variable annotations#4800
alexandrenavarro wants to merge 1 commit intogoogle:masterfrom
alexandrenavarro:fix-unused-variable-by-exempting-mockito-bean

Conversation

@alexandrenavarro
Copy link
Copy Markdown

[UnusedVariable] Add MockitoBean in EXEMPTING_VARIABLE_ANNOTATIONS for UnusedVariable because spring 6.2 is migrating from MockBean to MockitoBean.

See spring 6.2 documentation https://docs.spring.io/spring-boot/api/java/org/springframework/boot/test/mock/mockito/MockBean.html

Don't hesitate if you have any questions / comments.

Thank you for your amazing error prone checker, it really helps to code better and avoid to make some common bug patterns.

…r UnusedVariable because spring 6.2 is migrating from MockBean to MockitoBean
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Feb 1, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@alexandrenavarro
Copy link
Copy Markdown
Author

alexandrenavarro commented Feb 1, 2025

I just signed the CLA, I don't know how to rebuild the PR (just I tried close / reopen the PR).

Copy link
Copy Markdown
Collaborator

@cushon cushon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexandrenavarro I can't find a CLA on file, did you sign it with a different email address than the one associated with your GitHub account?

@alexandrenavarro
Copy link
Copy Markdown
Author

No, I signed it with the same mail. Tell me if I need to redo something.

Copy link
Copy Markdown
Collaborator

@cushon cushon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I had checked in the wrong place, the CLA looks good.

@estekhin
Copy link
Copy Markdown

@alexandrenavarro could you resurrect this pr please?

copybara-service Bot pushed a commit that referenced this pull request Mar 20, 2026
`MockitoBean` is the replacement for `MockBean`, which was [deprecated](https://docs.spring.io/spring-boot/3.5/api/java/org/springframework/boot/test/mock/mockito/MockBean.html) but otherwise used in the same way. Since upgrading our Spring Boot version and migrating over, we've been getting `UnusedVariable` warnings since `MockitoBean` isn't exempted.

There's a [previous PR that was approved here](#4800) but never merged and is now out of date, so creating this new one.

Thank you!

Fixes: #4804

Fixes #5614

FUTURE_COPYBARA_INTEGRATE_REVIEW=#5614 from elyse-yao:exempt-mockito-bean-annotation ac742b1
PiperOrigin-RevId: 886586716
copybara-service Bot pushed a commit that referenced this pull request Mar 20, 2026
`MockitoBean` is the replacement for `MockBean`, which was [deprecated](https://docs.spring.io/spring-boot/3.5/api/java/org/springframework/boot/test/mock/mockito/MockBean.html) but otherwise used in the same way. Since upgrading our Spring Boot version and migrating over, we've been getting `UnusedVariable` warnings since `MockitoBean` isn't exempted.

There's a [previous PR that was approved here](#4800) but never merged and is now out of date, so creating this new one.

Thank you!

Fixes: #4804

Fixes #5614

COPYBARA_INTEGRATE_REVIEW=#5614 from elyse-yao:exempt-mockito-bean-annotation ac742b1
PiperOrigin-RevId: 886918640
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

Successfully merging this pull request may close these issues.

3 participants