Skip to content

Commit

Permalink
We can no longer test this pr. file basis
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaspar Pedersen committed Mar 20, 2013
1 parent e0f78ea commit a637591
Showing 1 changed file with 0 additions and 15 deletions.
Expand Up @@ -120,21 +120,6 @@ public void makesNoExtraRowsWhenImportingSameDataTwice() throws Exception {
assertEquals(1, jdbcTemplate.queryForInt("SELECT COUNT(*) FROM VitaminGrunddata"));
}

@Test
public void closesExistingRowAndmakesNewRowWhenImportingSameDrugWithChangedData() throws Exception {
importFile(Long.class, "data/historik/nat01-1.txt", VitaminRecordSpecs.GRUNDDATA_RECORD_SPEC);
assertEquals(1, jdbcTemplate.queryForInt("SELECT COUNT(*) FROM VitaminGrunddata"));
long oldestPid = jdbcTemplate.queryForLong("SELECT PID FROM VitaminGrunddata");

importFile(Long.class, "data/historik/nat01-2.txt", VitaminRecordSpecs.GRUNDDATA_RECORD_SPEC);
assertEquals(2, jdbcTemplate.queryForInt("SELECT COUNT(*) FROM VitaminGrunddata"));
long newestPid = jdbcTemplate.queryForLong("SELECT PID FROM VitaminGrunddata WHERE ValidTo IS NULL");

assertEquals(getTimestampFromPersister(), jdbcTemplate.queryForObject("SELECT ValidTo from VitaminGrunddata where PID = ?", Timestamp.class, oldestPid));
assertEquals(getTimestampFromPersister(), jdbcTemplate.queryForObject("SELECT ValidFrom from VitaminGrunddata where PID = ?", Timestamp.class, newestPid));
assertEquals(1, jdbcTemplate.queryForInt("SELECT Count(*) from VitaminGrunddata where PID = ? AND ValidTo IS NULL", newestPid)); // assert that the new record has no ValidTo
}

private Timestamp getTimestampFromPersister() {
DateTime persisterTimeWithMillisTruncated = persister.getTransactionTime().toDateTime().withMillisOfSecond(0);
return new Timestamp(persisterTimeWithMillisTruncated.getMillis());
Expand Down

0 comments on commit a637591

Please sign in to comment.