AvroHiveTableStrategy implements HiveTableStrategy { @Override public Table alterHiveTable(Table table, Schema schema, int version) { Table alteredTable = new Table(table); addRoadAnnotations(alteredTable); URI schemaUri = uriResolver.resolve(schema, table.getTableName(), version); alteredTable.putToParameters(AVRO_SCHEMA_URL, schemaUri.toString()); alteredTable.putToParameters(AVRO_SCHEMA_VERSION, Integer.toString(version)); return alteredTable; }  @Override Table newHiveTable(
      String databaseName,
      String tableName,
      String partitionColumnName,
      String location,
      Schema schema,
      int version); @Override Table alterHiveTable(Table table, Schema schema, int version); @Override int getSchemaVersion(Table table);  }
@Test public void alterHiveTable() throws URISyntaxException { when(uriResolver.resolve(schema1, TABLE, 1)) .thenReturn(new URI("https: when(uriResolver.resolve(schema2, TABLE, 2)) .thenReturn(new URI("https: doReturn(Instant.ofEpochSecond(1526462225L)).when(clock).instant(); Table table = underTest.newHiveTable(DATABASE, TABLE, PARTITION_COLUMN, LOCATION, schema1, 1); Table result = underTest.alterHiveTable(table, schema2, 2); assertThat(result.getDbName(), is(DATABASE)); assertThat(result.getTableName(), is(TABLE)); assertThat(result.getTableType(), is(TableType.EXTERNAL_TABLE.toString())); Map<String, String> parameters = result.getParameters(); assertThat(parameters.get("EXTERNAL"), is("TRUE")); assertThat(parameters.get("data-highway.version"), is(DataHighwayVersion.VERSION)); assertThat(parameters.get("data-highway.last-revision"), is("2018-05-16T09:17:05Z")); assertThat(parameters.get(AvroHiveTableStrategy.AVRO_SCHEMA_URL), is("https: assertThat(parameters.get(AvroHiveTableStrategy.AVRO_SCHEMA_VERSION), is("2")); List<FieldSchema> partitionKeys = result.getPartitionKeys(); assertThat(partitionKeys.size(), is(1)); assertThat(partitionKeys.get(0), is(new FieldSchema(PARTITION_COLUMN, "string", null))); StorageDescriptor storageDescriptor = result.getSd(); assertThat(storageDescriptor.getInputFormat(), is(AvroStorageDescriptorFactory.AVRO_INPUT_FORMAT)); assertThat(storageDescriptor.getOutputFormat(), is(AvroStorageDescriptorFactory.AVRO_OUTPUT_FORMAT)); assertThat(storageDescriptor.getLocation(), is(LOCATION)); assertThat(storageDescriptor.getCols().size(), is(0)); SerDeInfo serdeInfo = storageDescriptor.getSerdeInfo(); assertThat(serdeInfo.getSerializationLib(), is(AvroStorageDescriptorFactory.AVRO_SERDE)); }