@Test void testNextAndExtract_NullValue() throws Exception { ResultSet resultSet = mock(ResultSet.class); when(resultSet.next()).thenReturn(true); when(resultSet.getObject(eq(1), eq(Long.class))).thenReturn(null); assertNull(JdbcUtils.nextAndExtract(resultSet, 1, Long.class)); }
public static <T> T nextAndExtract(ResultSet resultSet, int column, Class<T> columnType) throws SQLException, NullPointerException { if (resultSet.next()) { return extract(resultSet, column, columnType); } return null; }
JdbcUtils { public static <T> T nextAndExtract(ResultSet resultSet, int column, Class<T> columnType) throws SQLException, NullPointerException { if (resultSet.next()) { return extract(resultSet, column, columnType); } return null; } }
JdbcUtils { public static <T> T nextAndExtract(ResultSet resultSet, int column, Class<T> columnType) throws SQLException, NullPointerException { if (resultSet.next()) { return extract(resultSet, column, columnType); } return null; } private  JdbcUtils(); }
JdbcUtils { public static <T> T nextAndExtract(ResultSet resultSet, int column, Class<T> columnType) throws SQLException, NullPointerException { if (resultSet.next()) { return extract(resultSet, column, columnType); } return null; } private  JdbcUtils(); static R executeQuery(Connection connection, SqlFunction sqlFunction,
                                     SqlResultConverter<R> sqlResultConverter,
                                     Function<SQLException, RuntimeException> errorHandler); static R executeQuery(Connection connection, SqlFunction sqlFunction,
                                     SqlResultConverter<R> sqlResultConverter,
                                     Function<SQLException, RuntimeException> errorHandler,
                                     boolean closeConnection); static int executeUpdate(Connection connection,
                                    SqlFunction updateFunction,
                                    Function<SQLException, RuntimeException> errorHandler); static int[] executeUpdates(Connection connection,
                                       Consumer<SQLException> errorHandler,
                                       SqlFunction... sqlFunctions); static int[] executeBatch(Connection connection, SqlFunction sqlFunction,
                                     Consumer<SQLException> errorHandler); static SqlResultConverter<List<R>> listResults(SqlResultConverter<R> singleResultConverter); static void closeQuietly(ResultSet resultSet); static void closeQuietly(Statement statement); static void closeQuietly(Connection connection); static T nextAndExtract(ResultSet resultSet, int column, Class<T> columnType); static T extract(ResultSet resultSet, int column, Class<T> columnType); }
JdbcUtils { public static <T> T nextAndExtract(ResultSet resultSet, int column, Class<T> columnType) throws SQLException, NullPointerException { if (resultSet.next()) { return extract(resultSet, column, columnType); } return null; } private  JdbcUtils(); static R executeQuery(Connection connection, SqlFunction sqlFunction,
                                     SqlResultConverter<R> sqlResultConverter,
                                     Function<SQLException, RuntimeException> errorHandler); static R executeQuery(Connection connection, SqlFunction sqlFunction,
                                     SqlResultConverter<R> sqlResultConverter,
                                     Function<SQLException, RuntimeException> errorHandler,
                                     boolean closeConnection); static int executeUpdate(Connection connection,
                                    SqlFunction updateFunction,
                                    Function<SQLException, RuntimeException> errorHandler); static int[] executeUpdates(Connection connection,
                                       Consumer<SQLException> errorHandler,
                                       SqlFunction... sqlFunctions); static int[] executeBatch(Connection connection, SqlFunction sqlFunction,
                                     Consumer<SQLException> errorHandler); static SqlResultConverter<List<R>> listResults(SqlResultConverter<R> singleResultConverter); static void closeQuietly(ResultSet resultSet); static void closeQuietly(Statement statement); static void closeQuietly(Connection connection); static T nextAndExtract(ResultSet resultSet, int column, Class<T> columnType); static T extract(ResultSet resultSet, int column, Class<T> columnType);  }