Beispiel #1
0
 public Date getLastModificationTime() {
   String dateStr = get(PageData.PropertyLAST_MODIFIED);
   if (dateStr == null) return Clock.currentDate();
   else
     try {
       return getTimeFormat().parse(dateStr);
     } catch (ParseException e) {
       throw new IllegalStateException("Unable to parse date '" + dateStr + "'", e);
     }
 }
 @Test
 public void testLastModificationTime() throws Exception {
   DateFormat format = WikiPageProperty.getTimeFormat();
   WikiPageProperties props = new WikiPageProperties();
   assertEquals(
       format.format(Clock.currentDate()), format.format(props.getLastModificationTime()));
   Date date = format.parse("20040101000001");
   props.setLastModificationTime(date);
   assertEquals("20040101000001", props.get(PageData.PropertyLAST_MODIFIED));
   assertEquals(date, props.getLastModificationTime());
 }