Package com.alibaba.json.bvt

Source Code of com.alibaba.json.bvt.SerializeWriterTest

package com.alibaba.json.bvt;

import junit.framework.Assert;
import junit.framework.TestCase;

import com.alibaba.fastjson.serializer.SerializeWriter;

public class SerializeWriterTest extends TestCase {

  public void test_0() throws Exception {
    SerializeWriter writer = new SerializeWriter();
    writer.append('A');
    writer.writeInt(156);
    Assert.assertEquals("A156", writer.toString());
    writer.writeLong(345);
    Assert.assertEquals("A156345", writer.toString());

  }

  public void test_1() throws Exception {
    SerializeWriter writer = new SerializeWriter();
    writer.writeInt(-1);
    Assert.assertEquals("-1", writer.toString());
  }

  public void test_2() throws Exception {
    SerializeWriter writer = new SerializeWriter();
    writer.writeIntArray(new int[] { -1 });
    Assert.assertEquals("[-1]", writer.toString());
  }

  public void test_4() throws Exception {
    SerializeWriter writer = new SerializeWriter();
    writer.writeIntAndChar(-1, ',');
    Assert.assertEquals("-1,", writer.toString());
  }

  public void test_5() throws Exception {
    SerializeWriter writer = new SerializeWriter();
    writer.writeLong(-1L);
    Assert.assertEquals("-1", writer.toString());
  }

  public void test_6() throws Exception {
    SerializeWriter writer = new SerializeWriter();
    writer.writeLongAndChar(-1L, ',');
    Assert.assertEquals("-1,", writer.toString());
  }
}
TOP

Related Classes of com.alibaba.json.bvt.SerializeWriterTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.