BoltNeo4jResultSetMetaData extends Neo4jResultSetMetaData { public static ResultSetMetaData newInstance(boolean debug, List<Type> types, List<String> keys) { ResultSetMetaData rsmd = new BoltNeo4jResultSetMetaData(types, keys); return (ResultSetMetaData) Proxy .newProxyInstance(BoltNeo4jResultSetMetaData.class.getClassLoader(), new Class[] { ResultSetMetaData.class }, new Neo4jInvocationHandler(rsmd, debug)); } private  BoltNeo4jResultSetMetaData(List<Type> types, List<String> keys); static ResultSetMetaData newInstance(boolean debug, List<Type> types, List<String> keys); @Override int getColumnCount(); @Override String getColumnClassName(int column); @Override int getColumnType(int column); @Override String getColumnTypeName(int column);  }
@Test public void getColumnNameShouldReturnCorrectColumnName() throws SQLException { StatementResult resultCursor = ResultSetData.buildResultCursor(ResultSetData.KEYS_RECORD_LIST_MORE_ELEMENTS, ResultSetData.RECORD_LIST_MORE_ELEMENTS); ResultSetMetaData resultSet = BoltNeo4jResultSetMetaData.newInstance(false, Collections.EMPTY_LIST, resultCursor.keys()); assertEquals("columnA", resultSet.getColumnName(1)); }
@Test public void getColumnNameShouldThrowExceptionWhenEmptyCursor() throws SQLException { expectedEx.expect(SQLException.class); StatementResult resultCursor = ResultSetData.buildResultCursor(ResultSetData.KEYS_RECORD_LIST_EMPTY, ResultSetData.RECORD_LIST_EMPTY); ResultSetMetaData resultSetMetaData = BoltNeo4jResultSetMetaData.newInstance(false, Collections.EMPTY_LIST, resultCursor.keys()); resultSetMetaData.getColumnName(1); }
@Test public void getColumnNameShouldThrowExceptionWhenColumnOutOfRange() throws SQLException { expectedEx.expect(SQLException.class); StatementResult resultCursor = ResultSetData.buildResultCursor(ResultSetData.KEYS_RECORD_LIST_EMPTY, ResultSetData.RECORD_LIST_EMPTY); ResultSetMetaData resultSet = BoltNeo4jResultSetMetaData.newInstance(false, Collections.EMPTY_LIST, resultCursor.keys()); resultSet.getColumnName(99); }
@Test public void getColumnNameShouldThrowExceptionIfCursorNull() throws SQLException { expectedEx.expect(SQLException.class); ResultSetMetaData resultSet = BoltNeo4jResultSetMetaData.newInstance(false, Collections.EMPTY_LIST, Collections.EMPTY_LIST); resultSet.getColumnName(1); }
@Test public void getColumnLabelShouldReturnCorrectColumnName() throws SQLException { StatementResult resultCursor = ResultSetData.buildResultCursor(ResultSetData.KEYS_RECORD_LIST_MORE_ELEMENTS, ResultSetData.RECORD_LIST_MORE_ELEMENTS); ResultSetMetaData resultSet = BoltNeo4jResultSetMetaData.newInstance(false, Collections.EMPTY_LIST, resultCursor.keys()); assertEquals("columnA", resultSet.getColumnLabel(1)); }
@Test public void getColumnLabelShouldThrowExceptionWhenEmptyCursor() throws SQLException { expectedEx.expect(SQLException.class); StatementResult resultCursor = ResultSetData.buildResultCursor(ResultSetData.KEYS_RECORD_LIST_EMPTY, ResultSetData.RECORD_LIST_EMPTY); ResultSetMetaData resultSet = BoltNeo4jResultSetMetaData.newInstance(false, Collections.EMPTY_LIST, resultCursor.keys()); resultSet.getColumnLabel(1); }
@Test public void getColumnLabelShouldThrowExceptionWhenColumnOutOfRange() throws SQLException { expectedEx.expect(SQLException.class); StatementResult resultCursor = ResultSetData.buildResultCursor(ResultSetData.KEYS_RECORD_LIST_EMPTY, ResultSetData.RECORD_LIST_EMPTY); ResultSetMetaData resultSet = BoltNeo4jResultSetMetaData.newInstance(false, Collections.EMPTY_LIST, resultCursor.keys()); resultSet.getColumnLabel(99); }
@Test public void getColumnLabelShouldThrowExceptionIfCursorNull() throws SQLException { expectedEx.expect(SQLException.class); ResultSetMetaData resultSet = BoltNeo4jResultSetMetaData.newInstance(false, Collections.EMPTY_LIST, Collections.EMPTY_LIST); resultSet.getColumnLabel(1); }
@Test public void getSchemaNameShouldReturnDefaultValue() throws SQLException { ResultSetMetaData resultSet = BoltNeo4jResultSetMetaData.newInstance(false, Collections.EMPTY_LIST, Collections.EMPTY_LIST); assertEquals("", resultSet.getSchemaName(1)); }
@Test public void getCatalogNameShouldReturnEmptyString() throws SQLException { ResultSetMetaData resultSet = BoltNeo4jResultSetMetaData.newInstance(false, Collections.EMPTY_LIST, Collections.EMPTY_LIST); assertEquals("", resultSet.getCatalogName(1)); }