public MessageType union(MessageType toMerge) {
    return union(toMerge, true);
  }
@Test
  public void testMergeSchemaWithColumnOrder() {
    MessageType m1 = Types.buildMessage()
        .addFields(
            Types.requiredList()
                .element(Types.optional(BINARY)
                    .columnOrder(ColumnOrder.undefined())
                    .named("a"))
                .named("g"),
            Types.optional(INT96).named("b"))
        .named("root");
    MessageType m2 = Types.buildMessage()
        .addFields(
            Types.requiredList()
                .element(Types.optional(BINARY)
                    .columnOrder(ColumnOrder.undefined())
                    .named("a"))
                .named("g"),
            Types.optional(BINARY).named("c"))
        .named("root");
    MessageType m3 = Types.buildMessage()
        .addFields(Types.requiredList()
            .element(Types.optional(BINARY).named("a"))
            .named("g"))
        .named("root");

    assertEquals(
        Types.buildMessage()
            .addFields(
                Types.requiredList()
                    .element(Types.optional(BINARY).named("a"))
                    .named("g"),
                Types.optional(INT96).named("b"),
                Types.optional(BINARY).named("c"))
            .named("root"),
        m1.union(m2));
    try {
      m1.union(m3);
      fail("An IncompatibleSchemaModificationException should have been thrown");
    } catch (Exception e) {
      assertTrue(
          "The thrown exception should have been IncompatibleSchemaModificationException but was "
              + e.getClass(),
          e instanceof IncompatibleSchemaModificationException);
      assertEquals(
          "can not merge type optional binary a with column order TYPE_DEFINED_ORDER into optional binary a with column order UNDEFINED",
          e.getMessage());
    }
  }