title: How to initialise cache for JUnit
body: <p>I am writing some JUnits for a class I wrote. This class is responsible for ensuring a local cache gets built (a simple concurrent map cache). The call to build the cache is in the constructor;</p>
  
  <pre><code>public DBFactoryController(){
      buildCache();
      notifcation.startPushManager();
  }
  </code></pre>
  
  <p>What happens in my test class is I create an instance variable of DBFactoryController</p>
  
  <pre><code>private DBFactoryController controller = new DBFactoryController();
  </code></pre>
  
  <p>However from what I have read, a new instance of the test class is generated for every test case, this means my cache gets rebuilt for every test which is slowing my tests down.</p>
  
  <p>Is there a way i can structure this so that my cache would only be built once?</p>
  
  <p>Thanks</p>