### Question:
HeaderBuilder extends TextOutput { @Override public void startBatch() { }  @Override void startField(int index); @Override boolean endField(); @Override boolean endEmptyField(); @Override void append(byte data); @Override void finishRecord(); @Override long getRecordCount(); @Override void startBatch(); @Override void finishBatch(); @Override boolean rowHasData(); String[] getHeaders(); static final int MAX_HEADER_LEN; static final String COLUMN_PREFIX; static final String ANONYMOUS_COLUMN_PREFIX; final List<String> headers; final ByteBuffer currentField; }### Answer:
@Test public void testWhiteSpace() { HeaderBuilder hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"a"); validateHeader(hb, new String[] {"a"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb," a "); validateHeader(hb, new String[] {"a"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb," a "); validateHeader(hb, new String[] {"a"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"a,b,c"); validateHeader(hb, new String[] {"a","b","c"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb," a , b , c "); validateHeader(hb, new String[] {"a","b","c"}); }
@Test public void testSyntax() { HeaderBuilder hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"a_123"); validateHeader(hb, new String[] {"a_123"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"a_123_"); validateHeader(hb, new String[] {"a_123_"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"az09_"); validateHeader(hb, new String[] {"az09_"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"+"); validateHeader(hb, new String[] {"column_1"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"+,-"); validateHeader(hb, new String[] {"column_1", "column_2"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"+9a"); validateHeader(hb, new String[] {"col_9a"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"9a"); validateHeader(hb, new String[] {"col_9a"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"a+b"); validateHeader(hb, new String[] {"a_b"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"a_b"); validateHeader(hb, new String[] {"a_b"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"EXPR$0"); validateHeader(hb, new String[] {"EXPR_0"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"(_-^-_)"); validateHeader(hb, new String[] {"col_______"}); }
@Test public void testUnicode() { HeaderBuilder hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"Αθήνα"); validateHeader(hb, new String[] {"Αθήνα"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"Москва"); validateHeader(hb, new String[] {"Москва"}); hb = new HeaderBuilder(); hb.startBatch(); parse(hb,"Paris,Αθήνα,Москва"); validateHeader(hb, new String[] {"Paris","Αθήνα","Москва"}); }