@Test
public void testWriteObjectValue(){

    String data = "ST=32;CN=2011;PW=123456;MN=LD130133000015;CP=&&DataTime=20160824003817000;B01-Rtd=36.91;011-Rtd=231.0,011-Flag=N;060-Rtd=1.803,060-Flag=N&&";
    StringWriter writer = new StringWriter();
    SegmentGenerator generator = new SegmentGenerator(writer);
    try {
        generator.initToken();
        //ST=32;CN=2011;PW=123456;MN=LD130133000015;CP
        generator.writeKey("ST");
        generator.writeValue("32");
        generator.writeKey("CN");
        generator.writeValue("2011");
        generator.writeKey("PW");
        generator.writeValue("123456");
        generator.writeKey("MN");
        generator.writeValue("LD130133000015");
        generator.writeKey("CP");
        //&&DataTime=20160824003817000;
        generator.writeObjectValue("DataTime=20160824003817000;B01-Rtd=36.91;011-Rtd=231.0,011-Flag=N;060-Rtd=1.803,060-Flag=N");
        assertEquals(writer.toString(),data);
    } catch (IOException e) {
        e.printStackTrace();
    }
}