title: How to mock a void method that changes state of instance property
body: <p>In this class Foo, I have a method to initialize a filter which uses a Set data structure. NOTE: Assume dependency injection of <code>namesToFilter</code> is not allowed in Foo class</p>
  
  <pre><code>public class Foo {
  
     Set&lt;String&gt; namesToFilter;
  
     public Foo() {
         namesToFilter = new HashSet&lt;&gt;();
         initialize();
     }  
  
     void initialize() {
       namesToFilter.add("XYZ");
       namesToFilter.add("ABC");
     }
  
  }
  </code></pre>
  
  <p>How to mock <code>initialize</code> method in mockito so that I can test other cases like
  namesToFilter.add("PQR") ?</p>