@Test
@Ignore
public void testAlterColumn() throws Exception {

  String tableName = getFreeTableName();
  createMyTable(tableName);
  DBAccessorImpl dbAccessor = injector.getInstance(DBAccessorImpl.class);
  ResultSet rs;
  DBColumnInfo fromColumn;
  DBColumnInfo toColumn;
  Statement statement = dbAccessor.getConnection().createStatement();
  final String dataString = "Data for inserting column.";
  // 1 - VARACHAR --> VARCHAR
  toColumn = new DBColumnInfo("name", String.class, 500, null, true);
  statement.execute(
      String.format("INSERT INTO %s(id, name) VALUES (1, '%s')", tableName,
          dataString));
  dbAccessor.alterColumn(tableName, toColumn);
  rs = statement.executeQuery(
      String.format("SELECT name FROM %s", tableName));
  while (rs.next()) {
    ResultSetMetaData rsm = rs.getMetaData();
    assertEquals(rs.getString(toColumn.getName()), dataString);
    assertEquals(rsm.getColumnTypeName(1), "VARCHAR");
    assertEquals(rsm.getColumnDisplaySize(1), 500);
  }
  rs.close();
  // 2 - VARACHAR --> CLOB
  toColumn = new DBColumnInfo("name", java.sql.Clob.class, 999, null, true);
  dbAccessor.alterColumn(tableName, toColumn);
  rs = statement.executeQuery(
      String.format("SELECT name FROM %s", tableName));
  while (rs.next()) {
    ResultSetMetaData rsm = rs.getMetaData();
    Clob clob = rs.getClob(toColumn.getName());
    assertEquals(dataString, clob.getSubString(1, (int) clob.length()));
    assertEquals("CLOB", rsm.getColumnTypeName(1));
    //size not supported for CLOB in H2
  }
  rs.close();
  // 3 - BLOB --> CLOB
  toColumn = new DBColumnInfo("name_blob_to_clob", java.sql.Clob.class, 567, null,
      true);
  fromColumn = new DBColumnInfo("name_blob_to_clob", byte[].class, 20000,
      null, true);
  dbAccessor.addColumn(tableName, fromColumn);
  String sql = String.format(
      "insert into %s(id, name_blob_to_clob) values (2, ?)", tableName);
  PreparedStatement preparedStatement = dbAccessor.getConnection().prepareStatement(
      sql);
  preparedStatement.setBinaryStream(1,
      new ByteArrayInputStream(dataString.getBytes()),
      dataString.getBytes().length);
  preparedStatement.executeUpdate();
  preparedStatement.close();
  dbAccessor.alterColumn(tableName, toColumn);
  rs = statement.executeQuery(
      String.format("SELECT name_blob_to_clob FROM %s WHERE id=2",
          tableName));
  while (rs.next()) {
    ResultSetMetaData rsm = rs.getMetaData();
    Clob clob = rs.getClob(toColumn.getName());
    assertEquals(clob.getSubString(1, (int) clob.length()), dataString);
    assertEquals(rsm.getColumnTypeName(1), "CLOB");
    assertEquals(rsm.getColumnDisplaySize(1), 567);
  }
  rs.close();
  // 4 - CLOB --> CLOB
  toColumn = new DBColumnInfo("name_blob_to_clob", char[].class, 1500, null,
      true);
  dbAccessor.alterColumn(tableName, toColumn);
  rs = statement.executeQuery(
      String.format("SELECT name_blob_to_clob FROM %s WHERE id=2",
          tableName));
  while (rs.next()) {
    ResultSetMetaData rsm = rs.getMetaData();
    Clob clob = rs.getClob(toColumn.getName());
    assertEquals(clob.getSubString(1, (int) clob.length()), dataString);
    assertEquals(rsm.getColumnTypeName(1), "CLOB");
    assertEquals(rsm.getColumnDisplaySize(1), 1500);
  }
  rs.close();
  dbAccessor.dropTable(tableName);
}