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
Documentation: @Mock
on method parameters
#1960
Comments
We mention that information in https://javadoc.io/doc/org.mockito/mockito-junit-jupiter/latest/org/mockito/junit/jupiter/MockitoExtension.html as we don't support initiating Mocks on parameters with JUnit4. Therefore, we should add a parameter something like: * @Test
* void testSomething(@Mock ArticleDatabase canOnlyBeInstantiatedWithJUnit5) { Other than that, please open a PR 😄 |
Oh I didn't realise that, thanks! I'll amend my article with that knowledge too. Am I OK to add a PR for both the v2 and v3 documentation, given it works on both versions? |
We no longer publish v2 updates, so v3 only. |
Although we've called it out in the [JUnit extension], we should also make sure it's clear in the core documentation to make it more visible. We can fully-quality the `@Test` annotation to make clear that it has to be with JUnit 5. Closes mockito#1960. [JUnit extension]: https://javadoc.io/doc/org.mockito/mockito-junit-jupiter/latest/org/mockito/junit/jupiter/MockitoExtension.html
Although we've called it out in the [JUnit extension], we should also make sure it's clear in the core documentation to make it more visible. We can fully-quality the `@Test` annotation to make clear that it has to be with JUnit 5. Closes #1960. [JUnit extension]: https://javadoc.io/doc/org.mockito/mockito-junit-jupiter/latest/org/mockito/junit/jupiter/MockitoExtension.html
While writing an article about using
@Mock
as a method parameter, I noticed that the JavaDoc for Mockito doesn't mention the ability to use@Mock
as a parameter to a test method.How would be best to add that as a PR, given it's dependent on the test runner?
I was thinking something like:
The text was updated successfully, but these errors were encountered: