public void testSharedNameSimple() throws Exception {
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  SmileGenerator gen=smileGenerator(out,false);
  gen.writeStartArray();
  gen.writeStartObject();
  gen.writeNumberField("abc",1);
  gen.writeEndObject();
  gen.writeStartObject();
  gen.writeNumberField("abc",2);
  gen.writeEndObject();
  gen.writeEndArray();
  gen.close();
  byte[] result=out.toByteArray();
  assertEquals(13,result.length);
}

public void testSharedNameSimple ( ) throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; SmileGenerator gen = smileGenerator ( out , false ) ; gen . writeStartArray ( ) ; gen . writeStartObject ( ) ; gen . writeNumberField ( "abc" , 1 ) ; gen . writeEndObject ( ) ; gen . writeStartObject ( ) ; gen . writeNumberField ( "abc" , 2 ) ; gen . writeEndObject ( ) ; gen . writeEndArray ( ) ; gen . close ( ) ; byte [ ] result = out . toByteArray ( ) ; assertEquals ( 13 , result . length ) ; }
simple test to verify that second reference will not output new string , but rather references one output earlier .
