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

Mockito#mockStatic(Class<?>) skips DoNotMockEnforcer #3219

Closed
1 task done
andrebrait opened this issue Jan 2, 2024 · 0 comments · Fixed by #3220
Closed
1 task done

Mockito#mockStatic(Class<?>) skips DoNotMockEnforcer #3219

andrebrait opened this issue Jan 2, 2024 · 0 comments · Fixed by #3220

Comments

@andrebrait
Copy link
Contributor

This is pretty straightforward and being followed up by a PR, but essentially, any calls to mockStatic skip the DoNotMockEnforcer entirely.

@DoNotMock
class TypeAnnotatedWithDoNotMock {}

// This does not throw an exception. Checking the stack, I see that DoNotMockEnforcer is never called.
Mockito.mockStatic(TypeAnnotatedWithDoNotMock.class);
andrebrait added a commit to andrebrait/mockito that referenced this issue Jan 2, 2024
Fixes mockito#3219
Fix mockStatic bypassing DoNotMockEnforcer
Add (optional) method on DoNotMockEnforcer for static mocks
andrebrait added a commit to andrebrait/mockito that referenced this issue Jan 19, 2024
Fixes mockito#3219
Fix mockStatic bypassing DoNotMockEnforcer
Add (optional) method on DoNotMockEnforcer for static mocks
andrebrait added a commit to andrebrait/mockito that referenced this issue Jan 19, 2024
Fixes mockito#3219
Fix mockStatic bypassing DoNotMockEnforcer
Add (optional) method on DoNotMockEnforcer for static mocks
andrebrait added a commit to andrebrait/mockito that referenced this issue Jan 22, 2024
Fixes mockito#3219
Fix mockStatic bypassing DoNotMockEnforcer
Add (optional) method on DoNotMockEnforcer for static mocks
andrebrait added a commit to andrebrait/mockito that referenced this issue Jan 22, 2024
Fixes mockito#3219
Fix mockStatic bypassing DoNotMockEnforcer
Add (optional) method on DoNotMockEnforcer for static mocks
andrebrait added a commit to andrebrait/mockito that referenced this issue Jan 22, 2024
Fixes mockito#3219
Fix mockStatic bypassing DoNotMockEnforcer
Add (optional) method on DoNotMockEnforcer for static mocks
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 a pull request may close this issue.

1 participant