@Test
public void basicBuilderTest() throws Exception {

    Ebts ebts = new Ebts();
    GenericRecord type1 = new GenericRecord(1);
    type1.setField(3, new Field("0400"));
    type1.setField(8, new Field("WVMEDS001"));
    GenericRecord type2 = new GenericRecord(2);
    type2.setField(2, new Field("04"));
    type2.setField(19, new Field("Smith,John"));
    type2.getField(19).getOccurrences().add(new Occurrence("Smith,Johnny"));
    type2.setField(18, new Field("Smith,Jo"));
    type2.setField(41, new Field("B"));
    type2.setField(40, new Field("A"));
    List<String> strings = new ArrayList<String>();
    strings.add("Test1");
    strings.add("Test2");
    strings.add("Test3");
    List<Occurrence> occs = EbtsUtils.convertStringList(strings);
    occs.add(new Occurrence("HI"));
    occs.remove(new Occurrence("HI"));
    type2.setField(50,new Field(occs));
    GenericRecord type10 = new GenericRecord(10);
    type10.setField(6, new Field("600"));
    Random rand = new Random();
    byte[] imageData = new byte[10];
    rand.nextBytes(imageData);
    type10.setImageData(imageData);
    ebts.addRecord(type1);
    ebts.addRecord(type10);
    ebts.addRecord(type2);
    EbtsBuilder builder = new EbtsBuilder(2);
    byte[] data = builder.build(ebts);
    log.info("EBTS Length: {}",data.length);
    ByteBuffer bb = ByteBuffer.wrap(data);
    assertTrue(ByteBufferUtils.find(bb, "A".getBytes()[0]) < ByteBufferUtils.find(bb, "B".getBytes()[0]));
    assertEquals(200,data.length);
    new EbtsParser().parse(data);
}