title: How to capture variable parameters with Mockito?
body: <p>There is a method which has variable parameters:</p>
  
  <pre><code>class A {
      public void setNames(String... names) {}
  }
  </code></pre>
  
  <p>Now I want to mock it with <code>mockito</code>, and capture the names passed to it. But I can't find a way to capture any number of names passed, I can only get them like this:</p>
  
  <pre><code>ArgumentCaptor&lt;String&gt; captor1 = ArgumentCaptor.fromClass(String.class);
  ArgumentCaptor&lt;String&gt; captor2 = ArgumentCaptor.fromClass(String.class);
  
  A mock = Mockito.mock(A.class);
  mock.setNames("Jeff", "Mike");
  Mockito.verity(mock).setNames(captor1.capture(), captor2.capture());
  String name1 = captor1.getValue(); // Jeff
  String name2 = captor2.getValue(); // Mike
  </code></pre>
  
  <p>If I pass three names, it won't work, and I have to define a <code>captor3</code> to capture the 3rd name.</p>
  
  <p>How to fix it?</p>