### Question:
HadoopTables implements Tables, Configurable { @Override public Table create(Schema schema, PartitionSpec spec, SortOrder order, Map<String, String> properties, String location) { Preconditions.checkNotNull(schema, "A table schema is required"); TableOperations ops = newTableOps(location); if (ops.current() != null) { throw new AlreadyExistsException("Table already exists at location: %s", location); } Map<String, String> tableProps = properties == null ? ImmutableMap.of() : properties; PartitionSpec partitionSpec = spec == null ? PartitionSpec.unpartitioned() : spec; SortOrder sortOrder = order == null ? SortOrder.unsorted() : order; TableMetadata metadata = TableMetadata.newTableMetadata(schema, partitionSpec, sortOrder, location, tableProps); ops.commit(null, metadata); return new BaseTable(ops, location); } HadoopTables();  HadoopTables(Configuration conf); @Override Table load(String location); @Override Table create(Schema schema, PartitionSpec spec, SortOrder order,
                      Map<String, String> properties, String location); boolean dropTable(String location); boolean dropTable(String location, boolean purge); @Override void setConf(Configuration conf); @Override Configuration getConf();  }### Answer:
@Test public void testDefaultSortOrder() { PartitionSpec spec = PartitionSpec.builderFor(SCHEMA) .bucket("data", 16) .build(); Table table = TABLES.create(SCHEMA, spec, tableDir.toURI().toString()); SortOrder sortOrder = table.sortOrder(); Assert.assertEquals("Order ID must match", 0, sortOrder.orderId()); Assert.assertTrue("Order must unsorted", sortOrder.isUnsorted()); }
@Test public void testCustomSortOrder() { PartitionSpec spec = PartitionSpec.builderFor(SCHEMA) .bucket("data", 16) .build(); SortOrder order = SortOrder.builderFor(SCHEMA) .asc("id", NULLS_FIRST) .build(); Table table = TABLES.create(SCHEMA, spec, order, Maps.newHashMap(), tableDir.toURI().toString()); SortOrder sortOrder = table.sortOrder(); Assert.assertEquals("Order ID must match", 1, sortOrder.orderId()); Assert.assertEquals("Order must have 1 field", 1, sortOrder.fields().size()); Assert.assertEquals("Direction must match ", ASC, sortOrder.fields().get(0).direction()); Assert.assertEquals("Null order must match ", NULLS_FIRST, sortOrder.fields().get(0).nullOrder()); Transform<?, ?> transform = Transforms.identity(Types.IntegerType.get()); Assert.assertEquals("Transform must match", transform, sortOrder.fields().get(0).transform()); }