package org.simpleframework.xml.transform.sql;

import java.sql.Time;
import java.util.Date;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.ValidationTestCase;
import org.simpleframework.xml.load.Persister;

public class TimeTransformTest extends ValidationTestCase {
   
   @Root
   public class TimeExample {
      
      @Attribute     
      private Date attribute;
      
      @Element
      private Date element;
      
      @Element
      private Time time;
      
      public TimeExample() {
         super();
      }
      
      public TimeExample(long time) {
         this.attribute = new Time(time);
         this.element = new Time(time);
         this.time = new Time(time);
      }   
   }
   
   public void testTime() throws Exception {
      long now = System.currentTimeMillis();
      Time date = new Time(now);
      TimeTransform format = new TimeTransform();
      String value = format.write(date);
      Time copy = format.read(value);
      
      assertEquals(date, copy);  
      assertEquals(copy.getTime(), now);
   }
   
   public void testPersistence() throws Exception {
      long now = System.currentTimeMillis();
      Persister persister = new Persister();
      TimeExample example = new TimeExample(now);
      
      validate(example, persister);      
   }
}
@@ -62,24 +62,83 @@
 .sql.Time;%0D%0A
+import java.util.ArrayList;%0D%0Aimport java.util.Collection;%0D%0A
 import java.
@@ -149,16 +149,16 @@
 .Date;%0D%0A
-
 %0D%0Aimport
@@ -231,24 +231,115 @@
 l.Element;%0D%0A
+import org.simpleframework.xml.ElementArray;%0D%0Aimport org.simpleframework.xml.ElementList;%0D%0A
 import org.s
@@ -738,32 +738,156 @@
  time;%0D%0A      %0D%0A
+      @ElementList%0D%0A      private Collection%3CTime%3E list;%0D%0A      %0D%0A      @ElementArray%0D%0A      private Time%5B%5D array;%0D%0A      %0D%0A
       public Tim
@@ -1051,32 +1051,32 @@
 ew Time(time);%0D%0A
-
          this.ti
@@ -1093,24 +1093,229 @@
 ime(time);%0D%0A
+         this.list = new ArrayList%3CTime%3E();%0D%0A         this.list.add(new Time(time));%0D%0A         this.list.add(new Time(time));%0D%0A         this.array = new Time%5B1%5D;%0D%0A         this.array%5B0%5D = new Time(time);%0D%0A
       %7D   %0D%0A

Update time test for collection and array tests