|
1 | 1 | /* |
2 | | - * Copyright 2002-2014 the original author or authors. |
| 2 | + * Copyright 2002-2015 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -38,11 +38,13 @@ public class StatementCreatorUtilsTests { |
38 | 38 |
|
39 | 39 | private PreparedStatement preparedStatement; |
40 | 40 |
|
| 41 | + |
41 | 42 | @Before |
42 | 43 | public void setUp() { |
43 | 44 | preparedStatement = mock(PreparedStatement.class); |
44 | 45 | } |
45 | 46 |
|
| 47 | + |
46 | 48 | @Test |
47 | 49 | public void testSetParameterValueWithNullAndType() throws SQLException { |
48 | 50 | StatementCreatorUtils.setParameterValue(preparedStatement, 1, Types.VARCHAR, null, null); |
@@ -264,9 +266,15 @@ public void testSetParameterValueWithCalendarAndUnknownType() throws SQLExceptio |
264 | 266 |
|
265 | 267 | @Test // SPR-8571 |
266 | 268 | public void testSetParameterValueWithStringAndVendorSpecificType() throws SQLException { |
| 269 | + Connection con = mock(Connection.class); |
| 270 | + DatabaseMetaData dbmd = mock(DatabaseMetaData.class); |
| 271 | + given(preparedStatement.getConnection()).willReturn(con); |
| 272 | + given(dbmd.getDatabaseProductName()).willReturn("Oracle"); |
| 273 | + given(con.getMetaData()).willReturn(dbmd); |
267 | 274 | StatementCreatorUtils.setParameterValue(preparedStatement, 1, Types.OTHER, null, "test"); |
268 | 275 | verify(preparedStatement).setString(1, "test"); |
269 | 276 | } |
| 277 | + |
270 | 278 | @Test // SPR-8571 |
271 | 279 | public void testSetParameterValueWithNullAndVendorSpecificType() throws SQLException { |
272 | 280 | StatementCreatorUtils.setParameterValue(preparedStatement, 1, Types.OTHER, null, null); |
|
0 commit comments