title: What test frameworks to use for mocking a private java class?
body: <p>I've been working on an application and need to write junit tests for the layer above the Data Access object - I need to mock the data access object and stub values to return for each method. I have tried using mockito but it doesn't seem to work, I think because it has a private constructor. </p>
  
  <p>I have:</p>
  
  <pre><code>Mockito.mock(dataAccessObject.class);
  Mockito.when(mockDAO.methodToStub()).thenReturn(returnValue) 
  </code></pre>
  
  <p>but it doesnt return the specified returnValue when called.</p>
  
  <p>This is the dataAccessObject I'm tring to mock:</p>
  
  <pre><code>public class DataAccessBean extends NewDataAccessBean
      implements ISQLDataAccessBean {
  
  // Instance of ISQLDataAccessBean 
  private static ISQLDataAccessBean instance = null;
  
  static ISQLDataAccessBean getInstance() throws TrapDABException {
      if (instance == null) {
          instance = new DataAccessBean ();
      }
      return instance;
  }
  
  private DataAccessBean () throws DAOException {
      super("JNDI_LOOKUP","ALIAS");
  }
  </code></pre>
  
  <p>The Methods I am trying to stub values for are all public but when they are called using the mocked object, they return null..</p>
  
  <p>Does anyone know a better test framework to use for this? I have also looked at powermockito plugin but have not been able to get that working either.</p>