@Test
public void testUpdateTableSchema() throws Exception {

  try {
    HCatClient client = HCatClient.create(new Configuration(hcatConf));
    final String dbName = "testUpdateTableSchema_DBName";
    final String tableName = "testUpdateTableSchema_TableName";
    client.dropDatabase(dbName, true, HCatClient.DropDBMode.CASCADE);
    client.createDatabase(HCatCreateDBDesc.create(dbName).build());
    List<HCatFieldSchema> oldSchema = Arrays.asList(new HCatFieldSchema("foo", Type.INT, ""),
        new HCatFieldSchema("bar", Type.STRING, ""));
    client.createTable(HCatCreateTableDesc.create(dbName, tableName, oldSchema).build());
    List<HCatFieldSchema> newSchema = Arrays.asList(new HCatFieldSchema("completely", Type.DOUBLE, ""),
        new HCatFieldSchema("new", Type.FLOAT, ""),
        new HCatFieldSchema("fields", Type.STRING, ""));
    client.updateTableSchema(dbName, tableName, newSchema);
    assertArrayEquals(newSchema.toArray(), client.getTable(dbName, tableName).getCols().toArray());
    client.dropDatabase(dbName, false, HCatClient.DropDBMode.CASCADE);
  }
  catch (Exception exception) {
    LOG.error("Unexpected exception.", exception);
    assertTrue("Unexpected exception: " + exception.getMessage(), false);
  }
}