title: What is a good strategy to assert updated data in Database with DBUnit?
body: <p>Here are some (overly) simplified code example to describe my unit testing method.</p>
  
  <h2>CompanyDataSet.xml</h2>
  
  <pre><code>&lt;dataset&gt;
      &lt;company company_key="100" company_name="OldName" /&gt;
  &lt;/dataset&gt;
  </code></pre>
  
  <h2>CompanyDaoTest.java</h2>
  
  <pre><code>@Test
  public void testUpdateCompany() {
    CompanyDao companyDao = new CompanyDao();
    IDatabaseConnection dbConn = createConnection();
  
    IDataSet dataSet = createDataSet("CompanyDataSet.xml");
    DatabaseOperation.CLEAN_INSERT.execute(dbConn, dataSet);
  
    companyDao.updateCompany(100, "NewName");
  
    // What is a good way to assert updated company data ?
  }
  </code></pre>
  
  <hr>
  
  <p>I came up with two ways to assert company data.</p>
  
  <p><strong>Create another dataset xml as expected dataset.</strong></p>
  
  <p>another XML</p>
  
  <pre><code>&lt;dataset&gt;
      &lt;company company_key="100" company_name="NewName" /&gt;
  &lt;/dataset&gt;
  </code></pre>
  
  <p>Assert part in Java</p>
  
  <pre><code>IDataSet actual = dbConn.createDataSet(new String[]{"company"});
  IDataSet expected = createDataSet("CompanyDataSet_expected.xml");
  
  Assertion.assertEquals(expected, actual);
  </code></pre>
  
  <p><strong>Just load the company object through DAO, and compare the properties.</strong></p>
  
  <p>you should get the idea.</p>
  
  <hr>
  
  <h2>My Problem</h2>
  
  <p>The first way is pretty easy to write, but I have to create another XML file for each different update method. It dose not sounds like a good idea to create so many data set XML files.</p>
  
  <p>The second way is straightforward, however, when there are different update methods, the test class will filled with methods that assert different properties with different value. And Lots tests will broke if there are something wrong with load method.</p>
  
  <p>Is there a good way to assert the data ? is it possible to avoid the problem I just described (or it dosen't really matter) ?</p>
  
  <h2>UPDATE</h2>
  
  <p>Since there is no one answer the question, I decide to accept my answer.</p>