@Test
public void testIdlGenerator() throws IOException, ParseException {

  StringWriter idlStrWriter = new StringWriter();
  Schema rs = SchemaBuilder.builder().record("TestRecord2")
          .namespace("test")
          .doc("record doc")
          .aliases("recordAlias")
          .prop("propKey", "propVal")
          .fields()
          .requiredBoolean("isThere")
          .nullableString("strField", null)
          .name("customField")
          .orderAscending()
          .aliases("blaAlias")
          .prop("fprop", "fval")
          .prop("fprp2", "fval2")
          .type(Schema.createArray(Schema.createEnum("someEnum", "enum doc", "test", Arrays.asList("A", "B"))))
          .withDefault(Collections.EMPTY_LIST)
          .name("fixedField")
          .doc("fixedField doc")
          .type(Schema.createFixed("Myfixed", "fixed doc", "test2", 16))
          .noDefault()
          .endRecord();
  SchemaUtils.writeIdlProtocol("TestProtocol", "test", idlStrWriter, rs);
  LOG.debug("writer = {}", idlStrWriter);
  String idlStr = idlStrWriter.toString();
  Assert.assertFalse(idlStr.isEmpty());
  Idl idl = new Idl(new StringReader(idlStr));
  idl.setSource("");
  Protocol protocol = idl.CompilationUnit();
  LOG.debug("Protocol = {}", protocol);
  Schema rs2 = protocol.getType("test.TestRecord2");
  Assert.assertEquals(rs, rs2);
}