title: Mockito How to mock void method with output argument?
body: <p>I have a void method "functionVoid" that informs a parameter.</p>
  
  <pre><code>public class MyMotherClass {
   @Inject
   MyClass2 myClass2
  
   public String motherFunction(){
    ....
    String test = "";
    myClass2.functionVoid(test);
  
    if (test.equals("")) {
        IllegalArgumentException ile = new IllegalArgumentException(
        "Argument is not valid");
        logger.throwing(ile);
        throw ile;
    }
    ....
   }
  }
  
  public class MyClass2 {
  
  public void functionVoid(String output_value)
  { ....
   output_value = "test";
  
   ....
   }
  }
  </code></pre>
  
  <p>How do I mock this method in the JUnit method my method "motherFunction"?
  In my example, the "test" variable is still empty.</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class MyMotherClassTest {
  
   @Mock
   private MyClass2 myClass2 ;
  
   @InjectMock
   private final MyMotherClass myMotherClass = new MyMotherClass ();
  
   @Test
   public void test(){
  
    myMotherClass.motherFunction();     
  
   }
  }
  </code></pre>