diff options
author | Artur Signell <artur@vaadin.com> | 2015-10-10 19:48:42 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-01-04 08:53:11 +0000 |
commit | ee9f5a6e09c87c7450fddd61cb8e3ddc03b61689 (patch) | |
tree | a35a9d6a552c0e4dbb4abda8059c875eaf2980f4 /server/tests | |
parent | 4154ef5bf6de5eb69bbb5d29f382bfb8df2ab773 (diff) | |
download | vaadin-framework-ee9f5a6e09c87c7450fddd61cb8e3ddc03b61689.tar.gz vaadin-framework-ee9f5a6e09c87c7450fddd61cb8e3ddc03b61689.zip |
Include correct type and parameter info in exception (#19064)
Change-Id: Ic08bfa69bc0c4cb42ecbb1d53ab712e75075ee10
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/src/com/vaadin/data/util/sqlcontainer/generator/StatementHelperTest.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/generator/StatementHelperTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/generator/StatementHelperTest.java index f1eb365c45..b89b7e747d 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/generator/StatementHelperTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/generator/StatementHelperTest.java @@ -19,6 +19,7 @@ import java.sql.PreparedStatement; import java.sql.SQLException; import org.easymock.EasyMock; +import org.junit.Assert; import org.junit.Test; import com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper; @@ -29,14 +30,23 @@ import com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper; */ public class StatementHelperTest { - @Test(expected = SQLException.class) + @Test public void testSetValueNullParameter() throws SQLException { StatementHelper helper = new StatementHelper(); - helper.addParameterValue(null, Object.class); + helper.addParameterValue(null, StatementHelper.class); PreparedStatement statement = EasyMock .createMock(PreparedStatement.class); // should throw SQLException, not NPE - helper.setParameterValuesToStatement(statement); + try { + helper.setParameterValuesToStatement(statement); + Assert.fail("Expected SQLExecption for unsupported type"); + } catch (SQLException e) { + // Exception should contain info about which parameter and the type + // which was unsupported + Assert.assertTrue(e.getMessage().contains("parameter 0")); + Assert.assertTrue(e.getMessage().contains( + StatementHelper.class.getName())); + } } @Test |