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:
* <h3 id="9">9. <a class="meaningful_link" href="#mock_annotation" name="mock_annotation">Shorthand for mocks creation - <code>@Mock</code> annotation</a></h3>
*
* <ul>
* <li>Minimizes repetitive mock creation code.</li>
* <li>Makes the test class more readable.</li>
* <li>Makes the verification error easier to read because the <b>field name</b>
* is used to identify the mock.</li>
* </ul>
*
* <pre class="code"><code class="java">
* public class ArticleManagerTest {
*
* @Mock private ArticleCalculator calculator;
* @Mock private ArticleDatabase database;
* @Mock private UserProvider userProvider;
*
* private ArticleManager manager;
*
* @Test
* void testSomething(@Mock ArticleDatabase database) {
* </code></pre>
While writing an article about using
@Mockas a method parameter, I noticed that the JavaDoc for Mockito doesn't mention the ability to use@Mockas 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: