diff options
author | Artur Signell <artur@vaadin.com> | 2012-10-24 09:54:59 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-10-24 09:54:59 +0300 |
commit | 703dfa76b676900435b0f6098bcecc03f691651b (patch) | |
tree | c1ebd0a726b21363201875c00c9b9ec0a7c3d043 /server/tests | |
parent | f1546b6285837d9a8a964e6ef6998ad00683c23a (diff) | |
download | vaadin-framework-703dfa76b676900435b0f6098bcecc03f691651b.tar.gz vaadin-framework-703dfa76b676900435b0f6098bcecc03f691651b.zip |
Fixed NPE when converter is null (#10043)
Change-Id: I1d753a4da16feae0c83d755e9dcceae86f3dfbdc
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java index 73f6063fdd..83224861b6 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java @@ -2,10 +2,15 @@ package com.vaadin.tests.server.component.abstractfield; import java.util.Locale; +import junit.framework.Assert; import junit.framework.TestCase; +import org.junit.Test; + import com.vaadin.data.util.MethodProperty; +import com.vaadin.data.util.ObjectProperty; import com.vaadin.data.util.converter.Converter; +import com.vaadin.data.util.converter.Converter.ConversionException; import com.vaadin.data.util.converter.StringToIntegerConverter; import com.vaadin.server.VaadinServiceSession; import com.vaadin.tests.data.bean.Address; @@ -179,4 +184,19 @@ public class AbstractFieldValueConversions extends TestCase { } + @Test + public void testNullConverter() { + TextField tf = new TextField("foo"); + tf.setPropertyDataSource(new ObjectProperty<Integer>(12)); + tf.setConverter((Converter) null); + try { + Object v = tf.getConvertedValue(); + System.out.println(v); + Assert.fail("Trying to convert String -> Integer should fail when there is no converter"); + } catch (ConversionException e) { + // ok, should happen when there is no converter but conversion is + // needed + } + } + } |