@Test
 public void test2() {
   JsonStringToPageRequest_FastJson toP = new JsonStringToPageRequest_FastJson();
   String jsonStr =
       "{sorts:[{prop:'name',dir:'asc'}],wheres:[{prop:'name',value:'张三'},{prop:'name',value:'李四'}]}";
   PageRequest pr = toP.convert(jsonStr);
   Assert.assertEquals(0, pr.getStart());
   Assert.assertEquals(-1, pr.getPageSize());
   Assert.assertEquals(1, pr.getPageNo());
   Assert.assertEquals(2, pr.getWheres().length);
   Assert.assertEquals(1, pr.getSorts().length);
   Assert.assertEquals("name", pr.getSorts()[0].getProp());
   Assert.assertEquals("asc", pr.getSorts()[0].getDir());
 }
  @Test
  public void test1() {
    JsonStringToPageRequest_FastJson toP = new JsonStringToPageRequest_FastJson();
    String jsonStr = "{wheres:[{prop:'name',op:'=',value:'张三'}]}";
    PageRequest pr = toP.convert(jsonStr);
    Assert.assertEquals(0, pr.getStart());
    Assert.assertEquals(-1, pr.getPageSize());
    Assert.assertEquals(1, pr.getPageNo());
    Assert.assertEquals(1, pr.getWheres().length);
    Assert.assertNull(pr.getSorts());
    Assert.assertEquals("name", pr.getWheres()[0].getProp());
    Assert.assertEquals("=", pr.getWheres()[0].getOp().toString());
    Assert.assertEquals("张三", pr.getWheres()[0].getValue());

    jsonStr = "{wheres:[{prop:'name',value:'张三'}]}";
    pr = toP.convert(jsonStr);
    Assert.assertEquals(0, pr.getStart());
    Assert.assertEquals(-1, pr.getPageSize());
    Assert.assertEquals(1, pr.getPageNo());
    Assert.assertEquals(1, pr.getWheres().length);
    // Assert.assertEquals(0, pr.getSorts().length);
    Assert.assertNull(pr.getSorts());
    Assert.assertEquals("name", pr.getWheres()[0].getProp());
    Assert.assertEquals("=", pr.getWheres()[0].getOp());
    Assert.assertEquals("张三", pr.getWheres()[0].getValue());

    jsonStr = "{wheres:[{prop:'name',value:'张三'}]}";
    pr = toP.convert(jsonStr);
    Assert.assertEquals(0, pr.getStart());
    Assert.assertEquals(-1, pr.getPageSize());
    Assert.assertEquals(1, pr.getPageNo());
    Assert.assertEquals(1, pr.getWheres().length);
    Assert.assertNull(pr.getSorts());
    Assert.assertEquals("name", pr.getWheres()[0].getProp());
    Assert.assertEquals("=", pr.getWheres()[0].getOp());
    Assert.assertEquals("张三", pr.getWheres()[0].getValue());

    jsonStr = "{wheres:[{prop:'name',value:'张三'},{prop:'name',value:'李四'}]}";
    pr = toP.convert(jsonStr);
    Assert.assertEquals(0, pr.getStart());
    Assert.assertEquals(-1, pr.getPageSize());
    Assert.assertEquals(1, pr.getPageNo());
    Assert.assertEquals(2, pr.getWheres().length);
    Assert.assertNull(pr.getSorts());
    Assert.assertEquals("name", pr.getWheres()[0].getProp());
    Assert.assertEquals("=", pr.getWheres()[0].getOp());
    Assert.assertEquals("张三", pr.getWheres()[0].getValue());

    Assert.assertEquals("name", pr.getWheres()[1].getProp());
    Assert.assertEquals("=", pr.getWheres()[1].getOp());
    Assert.assertEquals("李四", pr.getWheres()[1].getValue());
  }
  @Test
  public void test() {
    JsonStringToPageRequest_FastJson toP = new JsonStringToPageRequest_FastJson();
    String jsonStr = "{}";
    PageRequest pr = toP.convert(jsonStr);
    Assert.assertEquals(0, pr.getStart());
    Assert.assertEquals(-1, pr.getPageSize());
    Assert.assertEquals(1, pr.getPageNo());
    Assert.assertNull(pr.getWheres());
    Assert.assertNull(pr.getSorts());

    jsonStr = "{start:0,limit:10}";
    pr = toP.convert(jsonStr);
    Assert.assertEquals(0, pr.getStart());
    Assert.assertEquals(10, pr.getPageSize());
    Assert.assertEquals(1, pr.getPageNo());
    Assert.assertNull(pr.getWheres());
    Assert.assertNull(pr.getSorts());
    // 这里有问题start应该等于11
    jsonStr = "{start:11,limit:10}";
    pr = toP.convert(jsonStr);
    Assert.assertEquals(11, pr.getStart());
    Assert.assertEquals(10, pr.getPageSize());
    Assert.assertEquals(2, pr.getPageNo());
    Assert.assertNull(pr.getWheres());
    Assert.assertNull(pr.getSorts());
  }