public static SortOrder buildSortOrder(Table table) {
    return buildSortOrder(table.schema(), table.spec(), table.sortOrder());
  }
@Test
  public void testEmptySpecsV1() {
    PartitionSpec spec = PartitionSpec.unpartitioned();
    SortOrder order = SortOrder.builderFor(SCHEMA).withOrderId(1).asc("id", NULLS_LAST).build();
    TestTables.TestTable table = TestTables.create(tableDir, "test", SCHEMA, spec, order, 1);

    // pass PartitionSpec.unpartitioned() on purpose as it has an empty schema
    SortOrder actualOrder = SortOrderUtil.buildSortOrder(table.schema(), spec, table.sortOrder());

    assertThat(actualOrder.orderId()).as("Order ID must be fresh").isOne();
    assertThat(actualOrder.fields()).as("Order must have 1 field").hasSize(1);
    assertThat(actualOrder.fields().get(0).sourceId()).as("Field id must be fresh").isOne();
    assertThat(actualOrder.fields().get(0).direction()).as("Direction must match").isEqualTo(ASC);
    assertThat(actualOrder.fields().get(0).nullOrder())
        .as("Null order must match")
        .isEqualTo(NULLS_LAST);
  }