public String toJSON() {
    return JSON.toJSON(this);
  }
@Test
  public void testWriteUnionInfo() throws Exception {
    StructType st = new StructType(new LinkedList<ThriftField>(), null);
    assertEquals(
        ("{\n"
                + "  \"id\" : \"STRUCT\",\n"
                + "  \"children\" : [ ],\n"
                + "  \"structOrUnionType\" : \"STRUCT\",\n"
                + "  \"logicalTypeAnnotation\" : null\n"
                + "}")
            .replace("\n", System.lineSeparator()),
        st.toJSON());

    st = new StructType(new LinkedList<ThriftField>(), StructOrUnionType.UNION);
    assertEquals(
        ("{\n"
                + "  \"id\" : \"STRUCT\",\n"
                + "  \"children\" : [ ],\n"
                + "  \"structOrUnionType\" : \"UNION\",\n"
                + "  \"logicalTypeAnnotation\" : null\n"
                + "}")
            .replace("\n", System.lineSeparator()),
        st.toJSON());

    st = new StructType(new LinkedList<ThriftField>(), StructOrUnionType.STRUCT);
    assertEquals(
        ("{\n"
                + "  \"id\" : \"STRUCT\",\n"
                + "  \"children\" : [ ],\n"
                + "  \"structOrUnionType\" : \"STRUCT\",\n"
                + "  \"logicalTypeAnnotation\" : null\n"
                + "}")
            .replace("\n", System.lineSeparator()),
        st.toJSON());
  }