title: Appropriate use of Mockito.reset()?
body: <p>From <code>Mockito.reset()</code> documentation:</p>
  
  <blockquote>
    <p>Smart Mockito users hardly use this feature because they know it could be a sign of poor tests. Normally, you don't need to reset your mocks, just create new mocks for each test method.
    Instead of reset() please consider writing simple, small and focused test methods over lengthy, over-specified tests.</p>
  </blockquote>
  
  <p>I have servicemethod which is called from the frontend, with a DTO containing 3 Booleans as the only argument - let's call them <code>a</code>, <code>b</code> and <code>c</code>:</p>
  
  <pre><code>public void executeService(AbcDTO dto) { (...) }
  </code></pre>
  
  <p>Depending on the values of the Booleans, the service then calls <code>aManager.a()</code>, <code>bManager.b()</code> and <code>cManager.c()</code>. Indeed, I could do this in 3 separate servicemethods, but I'd rather not.</p>
  
  <p>I wanted to unittest every possible combination of the booleanvalues <code>a</code>, <code>b</code> and <code>c</code>, so I wrote something like:</p>
  
  <pre><code>@Test
  public void testABC() {
      // Mock aManager, bManager, cManager
      for(boolean a : asSet(true, false)) {
          for(boolean b : asSet(true, false)) {
              for(boolean c : asSet(true, false)) {
                  AbcDTO dto = new AbcDTO(a, b, c);
  
                  service.executeService(dto);
  
                  verify(aManager, times(a ? 1 : 0)).a();
                  verify(bManager, times(b ? 1 : 0)).b();
                  verify(cManager, times(c ? 1 : 0)).c();
                  reset(aManager, bManager, cManager);
              }
          }
      }
  }
  </code></pre>
  
  <p>I think this is a test which clearly indicates the purpose of <code>executeService</code> for future readers, but it only runs green with <code>Mockito.reset()</code>. After reading the documentation, I'm not sure if this is the way to go.</p>
  
  <p>I believe I have two options:</p>
  
  <ul>
  <li>Use <code>Mockito.reset()</code></li>
  <li>Write separate unittests for each combination (so 8 tests with lots of copy-pasting)</li>
  </ul>
  
  <p><strong>Question:</strong><br>
  Is this a correct, acceptable use of <code>Mockito.reset()</code>, or should I go with the separate tests?</p>