+ targetType.getName() + ")");
}
+ if (value == null) {
+ return null;
+ }
+
return new java.sql.Date(value.getTime());
}
+ getPresentationType().getName() + " (targetType was "
+ targetType.getName() + ")");
}
+
+ if (value == null) {
+ return null;
+ }
+
return new Date(value.getTime());
}
--- /dev/null
+package com.vaadin.tests.data.converter;
+
+import java.util.Date;
+import java.util.Locale;
+
+import junit.framework.TestCase;
+
+import com.vaadin.data.util.converter.DateToSqlDateConverter;
+
+public class TestDateToSqlDateConverter extends TestCase {
+
+ DateToSqlDateConverter converter = new DateToSqlDateConverter();
+
+ public void testNullConversion() {
+ assertEquals(null,
+ converter.convertToModel(null, java.sql.Date.class, null));
+ }
+
+ public void testValueConversion() {
+ Date testDate = new Date(100, 0, 1);
+ long time = testDate.getTime();
+ assertEquals(testDate, converter.convertToModel(new java.sql.Date(time),
+ java.sql.Date.class, Locale.ENGLISH));
+ }
+}