// update
storyMapper.addOrUpdate(storyToAdd);
// check story
ITable databaseData = getConnection().createQueryTable("ExpectedData", SELECT_STORY_TO_ADD);
assertEquals("number of row", 1, databaseData.getRowCount());
assertEquals("id", new Integer(storyToAdd.getPersistanceId()), (Integer) databaseData.getValue(0, "id"));
assertEquals("pro_id", new Integer(storyToAdd.getProject().getPersistanceId()), (Integer) databaseData.getValue(0, "pro_id"));
assertEquals("description", storyToAdd.getDescription(), (String) databaseData.getValue(0, "description"));
assertEquals("daysestimated", new Double(storyToAdd.getDaysEstimated()), new Double(databaseData.getValue(0, "daysestimated").toString()));
assertEquals("bus_id", new Integer(storyToAdd.getBusinessValue().getId()), (Integer) databaseData.getValue(0, "bus_id"));
assertEquals("ris_id", new Integer(storyToAdd.getRiskLevel().getId()), (Integer) databaseData.getValue(0, "ris_id"));
assertEquals("shortdescription", storyToAdd.getShortDescription(), (String) databaseData.getValue(0, "shortdescription"));
assertEquals("version", new Long(0), (Long) databaseData.getValue(0, "version"));
// chek tasks
// task1
databaseData = getConnection().createQueryTable("ExpectedData", SELECT_TASK1_TO_ADD);
assertEquals("number of row", 1, databaseData.getRowCount());
assertEquals("pmu_id", task1ToAdd.getOwner(), databaseData.getValue(0, "pmu_id"));
assertEquals("daysestimated", new Double(task1ToAdd.getDaysEstimated()), new Double(databaseData.getValue(0, "daysestimated").toString()));
assertEquals("shortdescription", task1ToAdd.getShortDescription(), (String) databaseData.getValue(0, "shortdescription"));
assertEquals("version", new Long(0), (Long) databaseData.getValue(0, "version"));
// task2
databaseData = getConnection().createQueryTable("ExpectedData", SELECT_TASK2_TO_ADD);
assertEquals("number of row", 1, databaseData.getRowCount());
assertEquals("pmu_id", task2ToAdd.getOwner(), databaseData.getValue(0, "pmu_id"));
assertEquals("daysestimated", new Double(task2ToAdd.getDaysEstimated()), new Double(databaseData.getValue(0, "daysestimated").toString()));
assertEquals("shortdescription", task2ToAdd.getShortDescription(), (String) databaseData.getValue(0, "shortdescription"));
assertEquals("version", new Long(0), (Long) databaseData.getValue(0, "version"));
// check charge
// charge 1
databaseData = getConnection().createQueryTable("ExpectedData", SELECT_CHARGE1_TO_ADD);
assertEquals("number of row", 1, databaseData.getRowCount());
assertEquals("id", new Integer(charge1ToAdd.getPersistanceId()), (Integer) databaseData.getValue(0, "id"));
// TODO comment tester cela ?
// assertEquals("tas_id", new Integer(task1ToAdd.getPersistanceId()), (Integer) databaseData.getValue(0, "tas_id"));
assertEquals("pmu_id", new Integer(charge1ToAdd.getUser().getPersistanceId()), (Integer) databaseData.getValue(0, "pmu_id"));
assertEquals("day", charge1ToAdd.getDay(), (Date) databaseData.getValue(0, "day"));
assertEquals("timeused", new Double(charge1ToAdd.getTimeUsedToday()), new Double (databaseData.getValue(0, "timeused").toString()));
assertEquals("daysneededtofinish", new Double(charge1ToAdd.getDaysNeededToFinish()), new Double (databaseData.getValue(0, "daysneededtofinish").toString()));
assertEquals("version", new Long(0), (Long) databaseData.getValue(0, "version"));
// charge 2
databaseData = getConnection().createQueryTable("ExpectedData", SELECT_CHARGE2_TO_ADD);
assertEquals("number of row", 1, databaseData.getRowCount());
assertEquals("id", new Integer(charge2ToAdd.getPersistanceId()), (Integer) databaseData.getValue(0, "id"));
// TODO comment tester cela ?
//assertEquals("tas_id", new Integer(task1ToAdd.getPersistanceId()), (Integer) databaseData.getValue(0, "tas_id"));
assertEquals("pmu_id", new Integer(charge2ToAdd.getUser().getPersistanceId()), (Integer) databaseData.getValue(0, "pmu_id"));
assertEquals("day", charge2ToAdd.getDay(), (Date) databaseData.getValue(0, "day"));
assertEquals("timeused", new Double(charge2ToAdd.getTimeUsedToday()), new Double (databaseData.getValue(0, "timeused").toString()));
assertEquals("daysneededtofinish", new Double(charge2ToAdd.getDaysNeededToFinish()), new Double (databaseData.getValue(0, "daysneededtofinish").toString()));
assertEquals("version", new Long(0), (Long) databaseData.getValue(0, "version"));
}