@Test
public void testSetValueToPreparedStatement() throws Exception {

    PreparedStatement statement = mock(PreparedStatement.class);
    // Date / Time
    final long now = System.currentTimeMillis();
    DBUtils.setValueToPreparedStatement(1,statement, new java.util.Date(now));
    verify(statement).setLong(1, now);
    DBUtils.setValueToPreparedStatement(2,statement, new java.sql.Date(now));
    verify(statement).setLong(2, now);
    DBUtils.setValueToPreparedStatement(3,statement, new Time(now));
    verify(statement).setLong(3, now);
    DBUtils.setValueToPreparedStatement(4,statement, new Timestamp(now));
    verify(statement).setLong(4, now);
    // String and CharSequence
    final String str = "This is a string";
    final StringBuilder stringBuilder = new StringBuilder("This is a CharSequence");
    DBUtils.setValueToPreparedStatement(5,statement, str);
    verify(statement).setString(5, "This is a string");
    DBUtils.setValueToPreparedStatement(6,statement, stringBuilder);
    verify(statement).setString(6, "This is a CharSequence");
    // Others...use setObject
    DBUtils.setValueToPreparedStatement(7,statement, Boolean.FALSE);
    verify(statement).setObject(7, Boolean.FALSE);
    DBUtils.setValueToPreparedStatement(7,statement, Long.MAX_VALUE);
    verify(statement).setObject(7, Long.MAX_VALUE);
    DBUtils.setValueToPreparedStatement(8,statement, "bytes".getBytes());
    verify(statement).setObject(8, "bytes".getBytes());
}