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

Support given for enforcing DirectInvocationOnMock : issue 3396 #3731

Closed
wants to merge 1 commit into from
Closed

Support given for enforcing DirectInvocationOnMock : issue 3396 #3731

wants to merge 1 commit into from

Conversation

RobertTheBlair
Copy link
Contributor

@RobertTheBlair RobertTheBlair commented Jan 25, 2023

Support given for enforcing DirectInvocationOnMock : issue 3396

  • Mockito supports BDDMockito, using "given" to correctly define mock behavior, instead of plain Mockito "when"
  • test some use cases that parallel existing cases

This is my first PR for this Repo, so I'm approaching with all humbleness.

My team at work saw this error prone warning show up, and 95% of the occurrences were from our use of BDD style given calls. Rather than ignoring the warning outright, I'd like to fix it here.

@google-cla
Copy link

google-cla bot commented Jan 25, 2023

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.

@RobertTheBlair
Copy link
Contributor Author

RobertTheBlair commented Jan 25, 2023

The missing CLA is from me using my work email in the commit - will fix it shortly, commit using personal email address.
Would still appreciate feedback in the mean time.

@RobertTheBlair
Copy link
Contributor Author

Still looking to get this reviewed & approved - everything should be ready, except the build does not pass as I've not been approved by a maintainer to run workflows.

@RobertTheBlair
Copy link
Contributor Author

Just fixed number of associated issue #3396

@RobertTheBlair RobertTheBlair changed the title Support given for enforcing DirectInvocationOnMock : issue 3246 Support given for enforcing DirectInvocationOnMock : issue 3396 Feb 1, 2023
Copy link
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.

Thanks for the contribution!

@RobertTheBlair
Copy link
Contributor Author

RobertTheBlair commented Feb 5, 2023

Thanks for the contribution!

Happy to help. Hardest part was getting corp sign-off (-;
Is there a person among the maintainers I should tag to unblock the workflow steps?

@RobertTheBlair
Copy link
Contributor Author

CI failed for only JDK 20 on Ubuntu, in code untouched by the branch. Fresh merge & rebase done.

@RobertTheBlair
Copy link
Contributor Author

I should update the docs in /docs/bugpattern/DirectInvocationOnMock.md as well.

…cing DirectInvocationOnMock : issue 3246

* Mockito supports BDDMockito, using "given" to correctly define mock behavior, instead of plain Mockito "when"
* test some use cases that parallel existing cases
* update bugpattern docs to note BDD/given as a supported pattern.
@RobertTheBlair
Copy link
Contributor Author

I should update the docs in /docs/bugpattern/DirectInvocationOnMock.md as well.

Done

copybara-service bot pushed a commit that referenced this pull request Feb 6, 2023
Support given for enforcing DirectInvocationOnMock :  issue 3396

* Mockito supports BDDMockito, using "given" to correctly define mock behavior, instead of plain Mockito "when"
* test some use cases that parallel existing cases

---
This is my first PR for this Repo, so I'm approaching with all humbleness.

My team at work saw this error prone warning show up, and 95% of the occurrences were from our use of BDD style `given` calls.   Rather than ignoring the warning outright, I'd like to fix it here.

Fixes #3731

FUTURE_COPYBARA_INTEGRATE_REVIEW=#3731 from RobertTheBlair:DirectInvocationOnMock-support-BDDMockito 2f555e1
PiperOrigin-RevId: 507165535
copybara-service bot pushed a commit that referenced this pull request Feb 6, 2023
Support given for enforcing DirectInvocationOnMock :  issue 3396

* Mockito supports BDDMockito, using "given" to correctly define mock behavior, instead of plain Mockito "when"
* test some use cases that parallel existing cases

---
This is my first PR for this Repo, so I'm approaching with all humbleness.

My team at work saw this error prone warning show up, and 95% of the occurrences were from our use of BDD style `given` calls.   Rather than ignoring the warning outright, I'd like to fix it here.

Fixes #3731

FUTURE_COPYBARA_INTEGRATE_REVIEW=#3731 from RobertTheBlair:DirectInvocationOnMock-support-BDDMockito 2f555e1
PiperOrigin-RevId: 507165535
copybara-service bot pushed a commit that referenced this pull request Feb 6, 2023
* Mockito supports BDDMockito, using "given" to correctly define mock behavior, instead of plain Mockito "when"
* test some use cases that parallel existing cases

Fixes #3731

FUTURE_COPYBARA_INTEGRATE_REVIEW=#3731 from RobertTheBlair:DirectInvocationOnMock-support-BDDMockito 2f555e1
PiperOrigin-RevId: 507165535
@copybara-service copybara-service bot closed this in 52e6fb7 Feb 6, 2023
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.

None yet

2 participants