title: testng suite second test fail -> nullpointerexception
body: <p>I have some dao tests i want to execute using testng suite
  I am initializing all daos in <code>@BeforeSuite</code> but only the first test can use the daos , others tests generate nullpointer when calling to a dao</p>
  
  <p>Any help would be appreciated
  Thank you very much</p>
  
  <p>Base test :</p>
  
  <pre><code> public class BaseTest {
  
      protected DocumentDaoImpl documentDao;
      protected UserDaoImpl userDao;
  
  
    @BeforeSuite
    public void beforeSuite() {
          EntityManagerUtil.setPersistenceUnitName("db_test"); //initialize entityManagerFactory once for all tests as well as daos
          documentDao = DAOFactory.getDocumentDAO();
          userDao = DAOFactory.getUserDao();
    }
  
    @AfterSuite
    public void afterSuite() {
      EntityManagerUtil.closeEntityManagerFactory();
    }
  }
  </code></pre>
  
  <p>Test 1 :</p>
  
  <pre><code>public class DocumentDaoImplTest extends BaseTest{
  
      @Test(dataProviderClass = DocumentDataProvider.class, dataProvider = DocumentDataProvider.ONE_DOCUMENT_PROVIDER)
      public void findByMatricule(Document document) {
          documentDao.create(document);
          Document result = documentDao.findByMatricule(document.getMatricule());
          Assert.assertNotNull(result);
          Assert.assertEquals(result.getMatricule(), document.getMatricule());
      }
  }
  </code></pre>
  
  <p>Test 2 :</p>
  
  <pre><code>public class UserDaoImplTest extends BaseTest{
  
      @Test(dataProviderClass = UserDataProvider.class, dataProvider = UserDataProvider.ONE_USER_PROVIDER)
      public void findByDocumentId(User user) {
          // nullpointer userDao
          userDao.create(user);
          User result = userDao.findByDocumentId(user.getDocumentId());
          Assert.assertNotNull(result);
          Assert.assertEquals(result.getDocumentId(), user.getDocumentId());
      }
  
  }
  </code></pre>
  
  <p>testng.xml</p>
  
  <p></p>
  
  <p></p>
  
  <pre><code>&lt;test name="DAOTest"&gt;
      &lt;packages&gt;
          &lt;package name="com.dev.test.dao"/&gt;
      &lt;/packages&gt; 
  &lt;/test&gt;
  </code></pre>
  
  <p></p>
  
  <p>Stacktrace :</p>
  
  <pre><code>java.lang.NullPointerException
      at com.dev.test.dao.UserDaoImplTest.findByDocumentId(UserDaoImplTest.java:14)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
      at org.testng.TestRunner.privateRun(TestRunner.java:782)
      at org.testng.TestRunner.run(TestRunner.java:632)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
      at org.testng.SuiteRunner.run(SuiteRunner.java:268)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
      at org.testng.TestNG.run(TestNG.java:1064)
      at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
  </code></pre>
  
  <p>What i am doing wrong ?
  The tests works if run independently , only fails when i run all at once </p>
  
  <p>Thank you very much</p>