@Test
public void testGetColumnType() throws SQLException {

  metadata = new IoTDBResultMetadata(null, null, false);
  boolean flag = false;
  try {
    metadata.getColumnType(1);
  } catch (Exception e) {
    flag = true;
  }
  assertTrue(flag);
  List<String> columnInfoList = new ArrayList<>();
  metadata = new IoTDBResultMetadata(columnInfoList, null, false);
  flag = false;
  try {
    metadata.getColumnType(1);
  } catch (Exception e) {
    flag = true;
  }
  assertTrue(flag);
  String[] columns = {"timestamp", "root.a.b.boolean", "root.a.b.int32", "root.a.b.int64",
      "root.a.b.float",
      "root.a.b.double", "root.a.b.text"};
  String[] typesString = {"BOOLEAN", "INT32", "INT64", "FLOAT", "DOUBLE", "TEXT"};
  int[] types = {Types.BOOLEAN, Types.INTEGER, Types.BIGINT, Types.FLOAT, Types.DOUBLE,
      Types.VARCHAR};
  metadata = new IoTDBResultMetadata(Arrays.asList(columns), Arrays.asList(typesString), false);
  flag = false;
  try {
    metadata.getColumnType(columns.length + 1);
  } catch (Exception e) {
    flag = true;
  }
  assertTrue(flag);
  flag = false;
  try {
    metadata.getColumnType(0);
  } catch (Exception e) {
    flag = true;
  }
  assertTrue(flag);
  assertEquals(metadata.getColumnType(1), Types.TIMESTAMP);
  for (int i = 1; i <= types.length; i++) {
    assertEquals(metadata.getColumnType(i + 1), types[i - 1]);
  }
}