@DatabaseSetup(value = CREATE_DATASET)
@DatabaseTearDown(value = UPDATE_DATASET, type = DatabaseOperation.DELETE_ALL)
public void testSave2() throws Exception {
try {
DatabaseConnection connection = new DatabaseConnection(dataSource.getConnection());
IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(this.getClass().getResource(UPDATE_DATASET).openStream());
Consumption consumption = new Consumption();
Consumption nconsumption;
Program program = new Program();
Item item = new Item();
DSP5 dsp5 = new DSP5();
consumption.setId(1L);
consumption.setQuantity(5);
program.setId(1L);
program.setName(PROGRAM_NAME);
program.setVersion(1);
consumption.setProgram(program);
dsp5.setId(1L);
dsp5.setLicenseNumber(DSP5_LICENSE_NUMBER);
dsp5.setVersion(1);
item.setId(1L);
item.setQuantity(5);
item.setDsp5(dsp5);
item.setVersion(1);
consumption.setItem(item);
consumption.setVersion(1);
nconsumption = consumptionDAO.save(consumption);
assertNotNull(nconsumption);
assertEquals(nconsumption.getQuantity(), consumption.getQuantity());
entityManager.getTransaction().commit();
DatabaseAssertionMode.NON_STRICT.getDatabaseAssertion().assertEquals(expectedDataSet,
connection.createDataSet(expectedDataSet.getTableNames()));
connection.close();
} catch (DatabaseUnitException e) {
e.printStackTrace();
fail(e.getLocalizedMessage());
} catch (SQLException e) {