@Test
public void testGetColumnName() throws SQLException {

  metadata = new IoTDBResultMetadata(null, null, false);
  boolean flag = false;
  try {
    metadata.getColumnName(1);
  } catch (Exception e) {
    flag = true;
  }
  assertTrue(flag);
  List<String> columnInfoList = new ArrayList<>();
  metadata = new IoTDBResultMetadata(columnInfoList, null, false);
  flag = false;
  try {
    metadata.getColumnName(1);
  } catch (Exception e) {
    flag = true;
  }
  assertTrue(flag);
  String[] colums = {"root.a.b.c1", "root.a.b.c2", "root.a.b.c3"};
  metadata = new IoTDBResultMetadata(Arrays.asList(colums), null, false);
  flag = false;
  try {
    metadata.getColumnName(colums.length + 1);
  } catch (Exception e) {
    flag = true;
  }
  assertTrue(flag);
  flag = false;
  try {
    metadata.getColumnName(0);
  } catch (Exception e) {
    flag = true;
  }
  assertTrue(flag);
  for (int i = 1; i <= colums.length; i++) {
    assertEquals(metadata.getColumnLabel(i), colums[i - 1]);
  }
}