You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by th...@apache.org on 2017/07/07 02:06:16 UTC

[41/50] commons-dbutils git commit: DBUTILS-124 Add tests for new column and property handlers.

DBUTILS-124 Add tests for new column and property handlers.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/dbutils/trunk@1674746 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-dbutils/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-dbutils/commit/7bb41746
Tree: http://git-wip-us.apache.org/repos/asf/commons-dbutils/tree/7bb41746
Diff: http://git-wip-us.apache.org/repos/asf/commons-dbutils/diff/7bb41746

Branch: refs/heads/master
Commit: 7bb417462f63c9a91c757fba5c5f00f937032879
Parents: 6f6e4bc
Author: Carl Franklin Hall <th...@apache.org>
Authored: Mon Apr 20 06:32:39 2015 +0000
Committer: Carl Franklin Hall <th...@apache.org>
Committed: Mon Apr 20 06:32:39 2015 +0000

----------------------------------------------------------------------
 src/changes/changes.xml                         | 61 +++++++++---------
 .../apache/commons/dbutils/BeanProcessor.java   |  8 ++-
 .../columns/BooleanColumnHandlerTest.java       | 37 +++++++++++
 .../handlers/columns/ByteColumnHandlerTest.java | 37 +++++++++++
 .../handlers/columns/ColumnHandlerTestBase.java | 36 +++++++++++
 .../columns/DoubleColumnHandlerTest.java        | 37 +++++++++++
 .../columns/FloatColumnHandlerTest.java         | 37 +++++++++++
 .../columns/IntegerColumnHandlerTest.java       | 43 +++++++++++++
 .../handlers/columns/LongColumnHandlerTest.java | 37 +++++++++++
 .../columns/SQLXMLColumnHandlerTest.java        | 43 +++++++++++++
 .../columns/ShortColumnHandlerTest.java         | 37 +++++++++++
 .../columns/StringColumnHandlerTest.java        | 37 +++++++++++
 .../columns/TimestampColumnHandlerTest.java     | 40 ++++++++++++
 .../properties/DatePropertyHandlerTest.java     | 65 ++++++++++++++++++++
 .../StringEnumPropertyHandlerTest.java          | 44 +++++++++++++
 .../dbutils/handlers/properties/TestEnum.java   | 21 +++++++
 16 files changed, 588 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 906d000..5139fc7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -20,13 +20,13 @@
 This file is used by the maven-changes-plugin to generate the release notes.
 Useful ways of finding items to add to this file are:
 
-1.  Add items when you fix a bug or add a feature (this makes the 
+1.  Add items when you fix a bug or add a feature (this makes the
 release process easy :-).
 
 2.  Do a bugzilla search for tickets closed since the previous release.
 
 3.  Use the report generated by the maven-changelog-plugin to see all
-CVS commits.  Set the project.properties' maven.changelog.range 
+CVS commits.  Set the project.properties' maven.changelog.range
 property to the number of days since the last release.
 
 To regenerate the RELEASE-NOTES.txt:
@@ -68,6 +68,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action dev="thecarlhall" type="add" issue="DBUTILS-50" due-to="Dan Fabulich">
         Support CallableStatement "out" parameters
       </action>
+      <action dev="thecarlhall" type="add" issue="DBUTILS-124">
+        Implement column and property handlers using Java's service interfaces.
+      </action>
     </release>
 
     <release version="1.6" date="2014-07-20" description="Bugfixes and addition of insert methods">
@@ -126,7 +129,7 @@ The <action> type attribute can be add,update,fix,remove.
         Enhance BasicRowProcessor to have row mapping easier to configure
       </action>
       <action due-to="wspeirs" type="update">
-        Updated pom.xml: Java 1.6 now required, clirr and compiler plugin removed 
+        Updated pom.xml: Java 1.6 now required, clirr and compiler plugin removed
       </action>
       <action due-to="Tiago Cavaleiro" dev="wspeirs" type="fix" issue="DBUTILS-84">
         BeanProcessor method processColumn should take SQLXML in consideration
@@ -208,7 +211,7 @@ The <action> type attribute can be add,update,fix,remove.
       </action>
       <action dev="dfabulich" type="fix" issue="DBUTILS-40">
         NullPointerException occured at rethrow method
-      </action>     
+      </action>
       <action dev="dfabulich" type="update" issue="DBUTILS-42">
         Object with Long or Decimal got initial zero value while database field is null
       </action>
@@ -222,7 +225,7 @@ The <action> type attribute can be add,update,fix,remove.
 
     <release version="1.1" date="2006-12-01" description="Last couple of years of fixes">
       <action dev="bayard" type="fix" issue="DBUTILS-32">
-        Tests fail to build under 1.6, and warning while compiling source  
+        Tests fail to build under 1.6, and warning while compiling source
       </action>
       <action dev="bayard" type="fix" issue="DBUTILS-1">
         BeanListHandler and BeanHandler fail to support java.sql.Date()
@@ -234,7 +237,7 @@ The <action> type attribute can be add,update,fix,remove.
         Setting bean properties fails silently
       </action>
       <action dev="dgraham" type="fix" issue="DBUTILS-9">
-        MockResultSet needs to handle equals and hashCode 
+        MockResultSet needs to handle equals and hashCode
       </action>
       <action dev="bayard" type="fix" issue="DBUTILS-7">
         MockResultSet: Throw UnsupportedOperationException for not implemented methods
@@ -243,16 +246,16 @@ The <action> type attribute can be add,update,fix,remove.
         Implement Pluggable Adaptors to Make BeanHandler Smarter
       </action>
       <action dev="dgraham" type="update" issue="DBUTILS-15">
-        Patch for extending BasicRowProcessor 
+        Patch for extending BasicRowProcessor
       </action>
       <action dev="dgraham" type="add" issue="DBUTILS-12">
-        Protected QueryRunner.close() methods 
+        Protected QueryRunner.close() methods
       </action>
       <action dev="dgraham" type="update" issue="DBUTILS-23">
-        Updated docs for example.html page (select AS) 
+        Updated docs for example.html page (select AS)
       </action>
       <action dev="dgraham" type="add" issue="DBUTILS-4">
-        Added protected ResultSetIterator.rethrow() method to wrap SQLExceptions in 
+        Added protected ResultSetIterator.rethrow() method to wrap SQLExceptions in
         RuntimeExceptions.
       </action>
       <action dev="dgraham" type="update" issue="DBUTILS-5">
@@ -267,7 +270,7 @@ The <action> type attribute can be add,update,fix,remove.
       </action>
       <action dev="dgraham" type="update" issue="DBUTILS-22">
         Made QueryLoader.loadQueries() protected so subclasses can use query
-        repositories other than properties files.    
+        repositories other than properties files.
       </action>
       <action dev="dgraham" type="update">
         QueryRunner now calls getDataSource() internally any time it needs access
@@ -277,15 +280,15 @@ The <action> type attribute can be add,update,fix,remove.
         Added DbUtils.rollbackAndClose() and DbUtils.rollbackAndCloseQuietly().
       </action>
       <action dev="dgraham" type="update" issue="DBUTILS-26">
-        Call ResultSet.getTimestamp() in BeanProcessor.processColumn() if 
-        the bean property is a java.sql.Timestamp.  Oracle's getObject() 
+        Call ResultSet.getTimestamp() in BeanProcessor.processColumn() if
+        the bean property is a java.sql.Timestamp.  Oracle's getObject()
         implementation returns its own incompatible Timestamp class.
       </action>
       <action dev="dgraham" type="update" issue="DBUTILS-18">
-        Changed QueryRunner.fillStatement() null handling 
-        to use Types.VARCHAR instead of Types.OTHER.  This works for the 
+        Changed QueryRunner.fillStatement() null handling
+        to use Types.VARCHAR instead of Types.OTHER.  This works for the
         following tested drivers: Firebird 1.5/firebirdsql 1.5RC3,
-        Oracle 9/ Thin driver, MySQL 4.0/Msql Connecttor 3.0 and mm.mysql 
+        Oracle 9/ Thin driver, MySQL 4.0/Msql Connecttor 3.0 and mm.mysql
         2.0.4 MaxDB 7.5, HSQLDB 1.7.1, and MS Access/ODBC Bridge.
       </action>
       <action dev="dgraham" type="add" issue="DBUTILS-21">
@@ -294,7 +297,7 @@ The <action> type attribute can be add,update,fix,remove.
         the DataSource before they're used.
       </action>
       <action dev="dgraham" type="add">
-        Refactored bean handling from BasicRowProcessor into new 
+        Refactored bean handling from BasicRowProcessor into new
         BeanProcessor class.  This also fixes the common problem with
         Oracle NUMERIC fields not being set into bean properties.
       </action>
@@ -302,35 +305,35 @@ The <action> type attribute can be add,update,fix,remove.
         Added QueryRunner.batch() methods for batch updates.
       </action>
       <action dev="dgraham" type="add" issue="DBUTILS-11">
-        Added new ResultSetHandler implementation, ColumnListHandler, that 
+        Added new ResultSetHandler implementation, ColumnListHandler, that
         converts one ResultSet column into a List of Objects.
       </action>
     </release>
-    
+
     <release version="1.0" date="2003-11-10" description="First release of DbUtils">
       <action type="add">
         This is the first release of the Commons DbUtils package.  DbUtils
         is a small set of classes designed to make working with JDBC easier.
-      </action>    
+      </action>
       <action type="add">
         QueryRunner class with ResultSetHandler interface allow you to easily query or
         update a database and handle the ResultSet.  Several useful implementations
-        of the ResultSetHandler interface are located in the 
+        of the ResultSetHandler interface are located in the
         org.apache.commons.dbutils.handlers.* package.
-      </action>    
+      </action>
       <action type="add">
-        ResultSet wrappers that decorate ResultSets with specialized 
-        behavior.  See the classes in the org.apache.commons.dbutils.wrappers.* 
+        ResultSet wrappers that decorate ResultSets with specialized
+        behavior.  See the classes in the org.apache.commons.dbutils.wrappers.*
         package for details.
       </action>
       <action type="add">
-        Dynamic JDBC API interface implementations via the standard 
-        java.lang.reflect.Proxy class.  This allows you to implement JDBC 
-        interfaces such as ResultSet at runtime to avoid API version 
-        incompatibilities.  See org.apache.commons.dbutils.ProxyFactory 
+        Dynamic JDBC API interface implementations via the standard
+        java.lang.reflect.Proxy class.  This allows you to implement JDBC
+        interfaces such as ResultSet at runtime to avoid API version
+        incompatibilities.  See org.apache.commons.dbutils.ProxyFactory
         for details.
       </action>
     </release>
-    
+
   </body>
 </document>

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/BeanProcessor.java b/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
index 7580655..ce1098a 100644
--- a/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
+++ b/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
@@ -341,9 +341,7 @@ public class BeanProcessor {
      */
     private boolean isCompatibleType(Object value, Class<?> type) {
         // Do object check first, then primitives
-        if (value == null
-                || type.isInstance(value)
-                || (type.isPrimitive() && matchesPrimitive(type, value.getClass()))) {
+        if (value == null || type.isInstance(value) || matchesPrimitive(type, value.getClass())) {
             return true;
 
         }
@@ -359,6 +357,10 @@ public class BeanProcessor {
      * @return Whether <code>valueType</code> can be coerced (e.g. autoboxed) into <code>targetType</code>.
      */
     private boolean matchesPrimitive(Class<?> targetType, Class<?> valueType) {
+        if (!targetType.isPrimitive()) {
+            return false;
+        }
+
         try {
             // see if there is a "TYPE" field.  This is present for primitive wrappers.
             Field typeField = valueType.getField("TYPE");

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/columns/BooleanColumnHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/BooleanColumnHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/BooleanColumnHandlerTest.java
new file mode 100644
index 0000000..d9e49fd
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/BooleanColumnHandlerTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.columns;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class BooleanColumnHandlerTest extends ColumnHandlerTestBase {
+    public BooleanColumnHandlerTest() {
+        super(new BooleanColumnHandler(), Boolean.class);
+    }
+
+    @Test
+    public void testApplyType() throws Exception {
+        when(rs.getBoolean(1)).thenReturn(Boolean.TRUE);
+        assertEquals(Boolean.class, handler.apply(rs, 1).getClass());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/columns/ByteColumnHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/ByteColumnHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/ByteColumnHandlerTest.java
new file mode 100644
index 0000000..23d38bc
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/ByteColumnHandlerTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.columns;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ByteColumnHandlerTest extends ColumnHandlerTestBase {
+    public ByteColumnHandlerTest() {
+        super(new ByteColumnHandler(), Byte.class);
+    }
+
+    @Test
+    public void testApplyType() throws Exception {
+        when(rs.getByte(1)).thenReturn(Byte.MIN_VALUE);
+        assertEquals(Byte.class, handler.apply(rs, 1).getClass());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/columns/ColumnHandlerTestBase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/ColumnHandlerTestBase.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/ColumnHandlerTestBase.java
new file mode 100644
index 0000000..e3d638b
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/ColumnHandlerTestBase.java
@@ -0,0 +1,36 @@
+package org.apache.commons.dbutils.handlers.columns;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.ResultSet;
+
+import org.apache.commons.dbutils.ColumnHandler;
+import org.junit.Test;
+import org.mockito.Mock;
+
+public abstract class ColumnHandlerTestBase {
+
+    @Mock
+    protected ResultSet rs;
+    protected final ColumnHandler handler;
+    protected final Class<?> matchingType;
+
+    public ColumnHandlerTestBase(ColumnHandler handler, Class<?> matchingType) {
+        this.handler = handler;
+        this.matchingType = matchingType;
+    }
+
+    @Test
+    public void testMatch() {
+        assertTrue(handler.match(matchingType));
+    }
+
+    @Test
+    public void testMatchNegative() {
+        assertFalse(handler.match(Integer.class));
+    }
+
+    @Test
+    public abstract void testApplyType() throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/columns/DoubleColumnHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/DoubleColumnHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/DoubleColumnHandlerTest.java
new file mode 100644
index 0000000..b6dbf38
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/DoubleColumnHandlerTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.columns;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class DoubleColumnHandlerTest extends ColumnHandlerTestBase {
+    public DoubleColumnHandlerTest() {
+        super(new DoubleColumnHandler(), Double.class);
+    }
+
+    @Test
+    public void testApplyType() throws Exception {
+        when(rs.getDouble(1)).thenReturn(Double.MIN_VALUE);
+        assertEquals(Double.class, handler.apply(rs, 1).getClass());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/columns/FloatColumnHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/FloatColumnHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/FloatColumnHandlerTest.java
new file mode 100644
index 0000000..b1dfc33
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/FloatColumnHandlerTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.columns;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class FloatColumnHandlerTest extends ColumnHandlerTestBase {
+    public FloatColumnHandlerTest() {
+        super(new FloatColumnHandler(), Float.class);
+    }
+
+    @Test
+    public void testApplyType() throws Exception {
+        when(rs.getFloat(1)).thenReturn(Float.MIN_VALUE);
+        assertEquals(Float.class, handler.apply(rs, 1).getClass());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/columns/IntegerColumnHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/IntegerColumnHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/IntegerColumnHandlerTest.java
new file mode 100644
index 0000000..c75893a
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/IntegerColumnHandlerTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.columns;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class IntegerColumnHandlerTest extends ColumnHandlerTestBase {
+    public IntegerColumnHandlerTest() {
+        super(new IntegerColumnHandler(), Integer.class);
+    }
+
+    @Test
+    public void testMatchNegative() {
+        assertFalse(handler.match(Float.class));
+    }
+
+    @Test
+    public void testApplyType() throws Exception {
+        when(rs.getInt(1)).thenReturn(Integer.MIN_VALUE);
+        assertEquals(Integer.class, handler.apply(rs, 1).getClass());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/columns/LongColumnHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/LongColumnHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/LongColumnHandlerTest.java
new file mode 100644
index 0000000..0c96bdc
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/LongColumnHandlerTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.columns;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class LongColumnHandlerTest extends ColumnHandlerTestBase {
+    public LongColumnHandlerTest() {
+        super(new LongColumnHandler(), Long.class);
+    }
+
+    @Test
+    public void testApplyType() throws Exception {
+        when(rs.getLong(1)).thenReturn(Long.MIN_VALUE);
+        assertEquals(Long.class, handler.apply(rs, 1).getClass());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/columns/SQLXMLColumnHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/SQLXMLColumnHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/SQLXMLColumnHandlerTest.java
new file mode 100644
index 0000000..629f863
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/SQLXMLColumnHandlerTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.columns;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
+import java.sql.SQLXML;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SQLXMLColumnHandlerTest extends ColumnHandlerTestBase {
+    @Mock
+    private SQLXML sqlxml;
+
+    public SQLXMLColumnHandlerTest() {
+        super(new SQLXMLColumnHandler(), SQLXML.class);
+    }
+
+    @Test
+    public void testApplyType() throws Exception {
+        when(rs.getSQLXML(1)).thenReturn(sqlxml);
+        assertTrue(SQLXML.class.isAssignableFrom(handler.apply(rs, 1).getClass()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/columns/ShortColumnHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/ShortColumnHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/ShortColumnHandlerTest.java
new file mode 100644
index 0000000..71d8020
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/ShortColumnHandlerTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.columns;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ShortColumnHandlerTest extends ColumnHandlerTestBase {
+    public ShortColumnHandlerTest() {
+        super(new ShortColumnHandler(), Short.class);
+    }
+
+    @Test
+    public void testApplyType() throws Exception {
+        when(rs.getShort(1)).thenReturn(Short.MIN_VALUE);
+        assertEquals(Short.class, handler.apply(rs, 1).getClass());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/columns/StringColumnHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/StringColumnHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/StringColumnHandlerTest.java
new file mode 100644
index 0000000..36aea31
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/StringColumnHandlerTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.columns;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class StringColumnHandlerTest extends ColumnHandlerTestBase {
+    public StringColumnHandlerTest() {
+        super(new StringColumnHandler(), String.class);
+    }
+
+    @Test
+    public void testApplyType() throws Exception {
+        when(rs.getString(1)).thenReturn("tester");
+        assertEquals(String.class, handler.apply(rs, 1).getClass());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/columns/TimestampColumnHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/TimestampColumnHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/TimestampColumnHandlerTest.java
new file mode 100644
index 0000000..b8d19e0
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/TimestampColumnHandlerTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.columns;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class TimestampColumnHandlerTest extends ColumnHandlerTestBase {
+    public TimestampColumnHandlerTest() {
+        super(new TimestampColumnHandler(), Timestamp.class);
+    }
+
+    @Test
+    public void testApplyType() throws Exception {
+        when(rs.getTimestamp(1)).thenReturn(new Timestamp(new Date().getTime()));
+        assertEquals(Timestamp.class, handler.apply(rs, 1).getClass());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/properties/DatePropertyHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/properties/DatePropertyHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/properties/DatePropertyHandlerTest.java
new file mode 100644
index 0000000..d3550ce
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/properties/DatePropertyHandlerTest.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Time;
+import java.sql.Timestamp;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class DatePropertyHandlerTest {
+    private DatePropertyHandler handler;
+
+    @Before
+    public void setUp() {
+        this.handler = new DatePropertyHandler();
+    }
+
+    @Test
+    public void testMatch() {
+        assertTrue(handler.match(java.sql.Date.class, new java.util.Date()));
+        assertTrue(handler.match(java.sql.Time.class, new java.util.Date()));
+        assertTrue(handler.match(java.sql.Timestamp.class, new java.util.Date()));
+    }
+
+    @Test
+    public void testMatchNegative() {
+        assertFalse(handler.match(Float.class, null));
+        assertFalse(handler.match(Float.class, new java.util.Date()));
+    }
+
+    @Test
+    public void testApplyTypeOfDate() throws Exception {
+        assertEquals(java.sql.Date.class, handler.apply(java.sql.Date.class, new java.util.Date()).getClass());
+    }
+
+    @Test
+    public void testApplyTypeOfTime() throws Exception {
+        assertEquals(Time.class, handler.apply(java.sql.Time.class, new java.util.Date()).getClass());
+    }
+
+    @Test
+    public void testApplyTypeOfTimestamp() throws Exception {
+        Timestamp ts = new Timestamp(new java.util.Date().getTime());
+        assertEquals(Timestamp.class, handler.apply(java.sql.Timestamp.class, ts).getClass());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/properties/StringEnumPropertyHandlerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/properties/StringEnumPropertyHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/properties/StringEnumPropertyHandlerTest.java
new file mode 100644
index 0000000..8077343
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/properties/StringEnumPropertyHandlerTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.properties;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class StringEnumPropertyHandlerTest {
+    private StringEnumPropertyHandler handler;
+
+    @Before
+    public void setUp() {
+        this.handler = new StringEnumPropertyHandler();
+    }
+
+    @Test
+    public void testMatch() {
+        assertTrue(handler.match(TestEnum.class, "test"));
+    }
+
+    @Test
+    public void testMatchNegative() {
+        assertFalse(handler.match(TestEnum.class, Double.valueOf(1)));
+
+        assertFalse(handler.match(Integer.class, ""));
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/7bb41746/src/test/java/org/apache/commons/dbutils/handlers/properties/TestEnum.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/properties/TestEnum.java b/src/test/java/org/apache/commons/dbutils/handlers/properties/TestEnum.java
new file mode 100644
index 0000000..bf42dfc
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/handlers/properties/TestEnum.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.handlers.properties;
+
+public enum TestEnum {
+    TESTER
+}