summaryrefslogtreecommitdiffstats
path: root/server/tests
diff options
context:
space:
mode:
authorEdoardo Vacchi <uncommonnonsense@gmail.com>2013-09-13 10:25:29 +0200
committerVaadin Code Review <review@vaadin.com>2013-09-13 13:00:11 +0000
commit3cafce30057055d1731313c8d2833cb4c513ccd3 (patch)
treeecfd91135a532fa38fa7e3fafc7b2dfc0f03201a /server/tests
parent9b052579ebb6df508fe4195e6562fced7fdf5698 (diff)
downloadvaadin-framework-3cafce30057055d1731313c8d2833cb4c513ccd3.tar.gz
vaadin-framework-3cafce30057055d1731313c8d2833cb4c513ccd3.zip
NullPointerException in DateToSqlDateConverter (#12284)
DateToSqlDateConverter throws a NullPointerException when the provided value is null, thus violating the interface contract. If the provided value is null, then the methods should return null. Missing test case included Change-Id: If08225c2a6ae7c3103e47d3817a5d45469c7bf4f
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/src/com/vaadin/tests/data/converter/TestDateToSqlDateConverter.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestDateToSqlDateConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestDateToSqlDateConverter.java
new file mode 100644
index 0000000000..685404ded6
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/data/converter/TestDateToSqlDateConverter.java
@@ -0,0 +1,25 @@
+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));
+ }
+}