Package com.bj58.spat.gaea.server.core.convert

Examples of com.bj58.spat.gaea.server.core.convert.JsonConvert


  }

  public void testConvertToShort() throws Exception {
    String jsonStr = JsonHelper.toJsonExt(new Short((short) 1234));

    Short actual = new JsonConvert().convertToShort(jsonStr);
    Short expected = new Short((short) 1234);
    junit.framework.Assert.assertEquals(expected, actual);
  }
View Full Code Here


  public void testConvertToString() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    String actual = new JsonConvert().convertToString(jsonObj
        .get("fString"));
    junit.framework.Assert.assertEquals(te.getFString(), actual);
  }
View Full Code Here

  public void testConvertToboolean() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    boolean actual = new JsonConvert().convertToboolean(jsonObj
        .get("fboolean"));
    junit.framework.Assert.assertEquals(te.isFboolean(), actual);
  }
View Full Code Here

  public void testConvertTobyte() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    byte actual = new JsonConvert().convertTobyte(jsonObj.get("fbyte"));
    junit.framework.Assert.assertEquals(te.getFbyte(), actual);
  }
View Full Code Here

  public void testConvertTochar() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    char actual = new JsonConvert().convertTochar(jsonObj.get("fchar"));
    junit.framework.Assert.assertEquals(te.getFchar(), actual);
  }
View Full Code Here

  public void testConvertTodouble() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    double actual = new JsonConvert().convertTodouble(jsonObj
        .get("fdouble"));
    junit.framework.Assert.assertEquals(te.getFdouble(), actual);
  }
View Full Code Here

  public void testConvertTofloat() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    float actual = new JsonConvert().convertTofloat(jsonObj.get("ffloat"));
    junit.framework.Assert.assertEquals(te.getFfloat(), actual);
  }
View Full Code Here

  public void testConvertToint() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    int actual = new JsonConvert().convertToint(jsonObj.get("fint"));
    junit.framework.Assert.assertEquals(te.getFint(), actual);
  }
View Full Code Here

  public void testConvertTolong() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    long actual = new JsonConvert().convertTolong(jsonObj.get("flong"));
    junit.framework.Assert.assertEquals(te.getFlong(), actual);
  }
View Full Code Here

  public void testConvertToshort() throws Exception {
    TestEntity te = TestEntity.createInstrance();
    String jsonStr = JsonHelper.toJsonExt(te);
    JSONObject jsonObj = new JSONObject(jsonStr);

    short actual = new JsonConvert().convertToshort(jsonObj.get("fshort"));
    junit.framework.Assert.assertEquals(te.getFshort(), actual);
  }
View Full Code Here

TOP

Related Classes of com.bj58.spat.gaea.server.core.convert.JsonConvert

Copyright © 2018 www.massapicom. 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.