1 17 package org.alfresco.util; 18 19 import java.util.Date ; 20 21 import org.apache.commons.logging.Log; 22 import org.apache.commons.logging.LogFactory; 23 24 29 public class ConversionTest extends BaseTest 30 { 31 private static Log logger = LogFactory.getLog(ConversionTest.class); 32 33 public void testDateConversion() throws Exception 34 { 35 Date now = new Date (); 36 String dateBefore = now.toString(); 37 logger.info("date before = " + dateBefore); 38 39 String formattedDate = Conversion.dateToXmlDate(now); 40 logger.info("formattedDate = " + formattedDate); 41 42 Date dateAfterXml = Conversion.dateFromXmlDate(formattedDate); 43 String dateAfter = dateAfterXml.toString(); 44 logger.info("date after = " + dateAfter); 45 46 assertEquals("The date before and after conversion should be the same", dateBefore, dateAfter); 47 } 48 } 49 | Popular Tags |