### Question:
GetTableDataSupport { public ResultSet selectIncremental(String tableName, String[] selectFields, String dateField, int overlapTime, Date lastLoadDate, int backoffTime, UnitSizes unit) throws SQLException { ResultSet rs = null; logger.info("selectIncremental tableName {} dateField {} overlapTime {} lastLoadDate {} backoffTime {} unit {}", tableName, dateField, overlapTime, lastLoadDate, backoffTime, unit.toString()); final Date now = new Date(DateTimeUtils.currentTimeMillis()); DateRange range = new DateRange(lastLoadDate, now, overlapTime, backoffTime, unit); logger.info("Load range with min {} max {}", range.getMinDate(), range.getMaxDate()); StringBuilder sb = new StringBuilder(); String select = selectStatement(selectFields, "tbl"); sb.append("select ").append(select).append(" from ").append(tableName).append(" tbl WHERE tbl.").append(dateField).append(" > ? and tbl.").append(dateField).append(" < ?"); if (range.getMinDate().before(range.getMaxDate())) { PreparedStatement ps = conn.prepareStatement(sb.toString()); ps.setQueryTimeout(timeout); ps.setTimestamp(1, new java.sql.Timestamp(range.getMinDate().getTime())); ps.setTimestamp(2, new java.sql.Timestamp(range.getMaxDate().getTime())); logger.info("Executing incremental GetTableData query {}", ps); rs = ps.executeQuery(); } return rs; } GetTableDataSupport(Connection conn, int timeout); ResultSet selectFullLoad(String tableName, String[] selectFields); ResultSet selectIncremental(String tableName, String[] selectFields, String dateField, int overlapTime, Date lastLoadDate, int backoffTime, UnitSizes unit);  }### Answer:
@Test public void testSelectIncremental() throws Exception { Statement st = Mockito.mock(Statement.class); ResultSet rs = Mockito.mock(ResultSet.class); DatabaseMetaData databaseMetaData = Mockito.mock(DatabaseMetaData.class); Mockito.when(conn.createStatement()).thenReturn(st); Mockito.when(st.executeQuery("select col1, col2 from testTable")).thenReturn(rs); Mockito.when(conn.prepareStatement(Mockito.anyString())).thenReturn(Mockito.mock(PreparedStatement.class)); Mockito.when(conn.getMetaData()).thenReturn(databaseMetaData); Mockito.when(databaseMetaData.getIdentifierQuoteString()).thenReturn(""); int overlapTime = 0; Date lastLoadDate = new Date(1458872629591L); int backoffTime = 0; tableDataSupport.selectIncremental("testTable", new String[]{"col1", "col2"}, "col2", overlapTime, lastLoadDate, backoffTime, GetTableDataSupport.UnitSizes.NONE); }