import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
Assert.assertTrue(ht.find("from File").size() >= 2,
"Files were not created in the database.");
- Date modifTime = new Date();
+ Date modifTime = Calendar.getInstance().getTime();
// TEST CALL: Replace a file in the study step
aStudy = _studyService.selectStudy(studyId);
ht.flush();
ht.clear();
+ // Remove milliseconds because they are lost after saving in the database
+ modifTime.setTime((modifTime.getTime() / 1000) * 1000);
Document doc = ht.get(Document.class, id1);
String txt = readFile(doc.getFile().asFile());
Assert.assertTrue(doc.getFile().getName().contains("_document1"));
Assert.assertEquals(doc.getFile().getFormat(), format1);
Assert.assertTrue(txt.contains("replaced1.ddd"));
+ Assert.assertEquals(doc.getLastModificationDate(), modifTime);
doc = ht.get(Document.class, id2);
txt = readFile(doc.getFile().asFile());
Assert.assertTrue(doc.getFile().getName().contains("_sdocument1"));
- Assert.assertEquals(doc.getFile().getFormat(), format1);
+ Assert.assertEquals(doc.getFile().getFormat(), format2);
Assert.assertTrue(txt.contains("replaced2.ddd"));
+ Assert.assertEquals(doc.getLastModificationDate(), modifTime);
rollbackNestedTransaction();
LOG.debug(">>>>> END testReplace()");