@Test
@SuppressFBWarnings("PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS")
public void testMoreGenericRecordCreation() throws InstantiationException, IllegalAccessException {

  Schema reuse = SchemaBuilder.builder().record("Reuse").fields().requiredString("field").endRecord();
  Schema record = SchemaBuilder.builder().record("TestRecord").fields()
          .requiredInt("number")
          .name("record").type(reuse).noDefault()
          .endRecord();
  Schema record2 = SchemaBuilder.builder().record("TestRecord2").fields()
          .requiredBoolean("isThere")
          .name("record").type(reuse).noDefault()
          .endRecord();
  try (GenericRecordBuilder builder = new GenericRecordBuilder(record, record2)) {
    Class<? extends SpecificRecordBase> clasz = builder.getRecordClass(record);
    Class<? extends SpecificRecordBase> clasz2 = builder.getRecordClass(record);
    Assert.assertSame(clasz, clasz2);
    SpecificRecordBase myRecord = clasz.newInstance();
    myRecord.put("number", 35);
    Assert.assertEquals(35, (int) myRecord.get("number"));
    Class<? extends SpecificRecordBase> aClass = builder.getRecordClass(record2);
    GenericRecord r2 = aClass.newInstance();
    LOG.debug("Record = {}", r2);
  }
}