title: Verify method in constructor was called
body: <p>I have a constructor that calls a method, like this:</p>
  
  <pre><code>public Foo(boolean runExtraStuff) {
      if (runExtraStuff){
          doExtraStuff();
      }
  }
  </code></pre>
  
  <p>The <code>doExtraStuff()</code> method is running some additional commands that are not easily mocked themselves (things like database checks to initialize some variables). Perhaps it would be better for the constructor to not do this, but this is the code I have to work with at the moment.</p>
  
  <p>I would like to create a unit test to make sure that <code>doExtraStuff()</code> is called when the boolean <code>runExtraStuff</code> is true and does not run when the boolean is false. I am using JMockit.</p>
  
  <p>However, I'm not sure how to make this happen. Normally I would use a <code>Verifications</code> on a mocked object, but since I am testing the constructor, I can't use a mocked object in this way. So how can I verify that a method within a constructor was called?</p>