// update
storyMapper.addOrUpdate(storyToUpdate);
// check story
ITable databaseData = getConnection().createQueryTable("ExpectedData", SELECT_STORY_TO_UPDATE);
assertEquals("number of row", 1, databaseData.getRowCount());
assertEquals("id", new Integer(storyToUpdate.getPersistanceId()), (Integer) databaseData.getValue(0, "id"));
assertEquals("pro_id", new Integer(storyToUpdate.getProject().getPersistanceId()), (Integer) databaseData.getValue(0, "pro_id"));
assertEquals("description", storyToUpdate.getDescription(), (String) databaseData.getValue(0, "description"));
assertEquals("daysestimated", new Double(storyToUpdate.getDaysEstimated()), new Double(databaseData.getValue(0, "daysestimated").toString()));
assertEquals("bus_id", new Integer(storyToUpdate.getBusinessValue().getId()), (Integer) databaseData.getValue(0, "bus_id"));
assertEquals("ris_id", new Integer(storyToUpdate.getRiskLevel().getId()), (Integer) databaseData.getValue(0, "ris_id"));
assertEquals("shortdescription", storyToUpdate.getShortDescription(), (String) databaseData.getValue(0, "shortdescription"));
assertEquals("version", new Long(storyPersistanceVersion), (Long) databaseData.getValue(0, "version"));
// chek tasks
// task1
databaseData = getConnection().createQueryTable("ExpectedData", SELECT_TASK1_TO_UPDATE);
assertEquals("number of row", 1, databaseData.getRowCount());
assertEquals("id", new Integer(task1ToUpdate.getPersistanceId()), (Integer) databaseData.getValue(0, "id"));
assertEquals("pmu_id", task1ToUpdate.getOwner(), databaseData.getValue(0, "pmu_id"));
assertEquals("daysestimated", new Double(task1ToUpdate.getDaysEstimated()), new Double( databaseData.getValue(0, "daysestimated").toString()));
assertEquals("shortdescription", task1ToUpdate.getShortDescription(), (String) databaseData.getValue(0, "shortdescription"));
assertEquals("version", new Long(task1PersistanceVersion), (Long) databaseData.getValue(0, "version"));
// task2
databaseData = getConnection().createQueryTable("ExpectedData", SELECT_TASK2_TO_UPDATE);
assertEquals("number of row", 1, databaseData.getRowCount());
assertEquals("id", new Integer(task2ToUpdate.getPersistanceId()), (Integer) databaseData.getValue(0, "id"));
assertEquals("pmu_id", task2ToUpdate.getOwner(), databaseData.getValue(0, "pmu_id"));
assertEquals("daysestimated", new Double(task2ToUpdate.getDaysEstimated()), new Double (databaseData.getValue(0, "daysestimated").toString()));
assertEquals("shortdescription", task2ToUpdate.getShortDescription(), (String) databaseData.getValue(0, "shortdescription"));
assertEquals("version", new Long(task2PersistanceVersion), (Long) databaseData.getValue(0, "version"));
// charge 1
databaseData = getConnection().createQueryTable("ExpectedData", SELECT_CHARGE1_TO_UPDATE);
assertEquals("number of row", 1, databaseData.getRowCount());
assertEquals("id", new Integer(charge1ToUpdate.getPersistanceId()), (Integer) databaseData.getValue(0, "id"));
assertEquals("tas_id", new Integer(task1ToUpdate.getPersistanceId()), (Integer) databaseData.getValue(0, "tas_id"));
assertEquals("pmu_id", new Integer(charge1ToUpdate.getUser().getPersistanceId()), (Integer) databaseData.getValue(0, "pmu_id"));
assertEquals("day", charge1ToUpdate.getDay(), (Date) databaseData.getValue(0, "day"));
assertEquals("timeused", new Double(charge1ToUpdate.getTimeUsedToday()), new Double (databaseData.getValue(0, "timeused").toString()));
assertEquals("daysneededtofinish", new Double(charge1ToUpdate.getDaysNeededToFinish()), new Double (databaseData.getValue(0, "daysneededtofinish").toString()));
assertEquals("version", new Long(charge1PersistanceVersion), (Long) databaseData.getValue(0, "version"));
// charge 2
databaseData = getConnection().createQueryTable("ExpectedData", SELECT_CHARGE2_TO_UPDATE);
assertEquals("number of row", 1, databaseData.getRowCount());
assertEquals("id", new Integer(charge2ToUpdate.getPersistanceId()), (Integer) databaseData.getValue(0, "id"));
assertEquals("tas_id", new Integer(task1ToUpdate.getPersistanceId()), (Integer) databaseData.getValue(0, "tas_id"));
assertEquals("pmu_id", new Integer(charge2ToUpdate.getUser().getPersistanceId()), (Integer) databaseData.getValue(0, "pmu_id"));
assertEquals("day", charge2ToUpdate.getDay(), (Date) databaseData.getValue(0, "day"));
assertEquals("timeused", new Double(charge2ToUpdate.getTimeUsedToday()), new Double (databaseData.getValue(0, "timeused").toString()));
assertEquals("daysneededtofinish", new Double(charge2ToUpdate.getDaysNeededToFinish()), new Double (databaseData.getValue(0, "daysneededtofinish").toString()));
assertEquals("version", new Long(charge2PersistanceVersion), (Long) databaseData.getValue(0, "version"));
}