IoTDBResultMetadata implements ResultSetMetaData { @Override public int getColumnCount() { return columnInfoList == null ? 0 : columnInfoList.size(); } IoTDBResultMetadata(List<String> columnInfoList, List<String> columnTypeList, boolean ignoreTimestamp); @Override boolean isWrapperFor(Class<?> arg0); @Override T unwrap(Class<T> arg0); @Override String getCatalogName(int arg0); @Override String getColumnClassName(int arg0); @Override int getColumnCount(); @Override int getColumnDisplaySize(int arg0); @Override String getColumnLabel(int column); @Override String getColumnName(int column); @Override int getColumnType(int column); @Override String getColumnTypeName(int arg0); @Override int getPrecision(int arg0); @Override int getScale(int arg0); @Override String getSchemaName(int arg0); @Override String getTableName(int arg0); @Override boolean isAutoIncrement(int arg0); @Override boolean isCaseSensitive(int arg0); @Override boolean isCurrency(int arg0); @Override boolean isDefinitelyWritable(int arg0); @Override int isNullable(int arg0); @Override boolean isReadOnly(int arg0); @Override boolean isSearchable(int arg0); @Override boolean isSigned(int arg0); @Override boolean isWritable(int arg0);  }
@Test public void testGetColumnCount() { metadata = new IoTDBResultMetadata(null, null, false); boolean flag = false; try { metadata.getColumnCount(); } catch (Exception e) { flag = true; } assertFalse(flag); flag = false; try { metadata = new IoTDBResultMetadata(Collections.emptyList(), null, false); metadata.getColumnCount(); } catch (Exception e) { flag = true; } assertFalse(flag); List<String> columnInfoList = new ArrayList<>(); columnInfoList.add("root.a.b.c"); metadata = new IoTDBResultMetadata(columnInfoList, null, false); assertEquals(metadata.getColumnCount(), 1); }