Ejemplo n.º 1
0
  private void regression(int index, boolean array) throws IOException {
    Json.Value sample =
        Json.read(
            new BufferedReader(
                new InputStreamReader(
                    JsonTest.class.getResourceAsStream(
                        format("/com/twolattes/json/testdata/sample%s.json", index)))));
    Json.Value samplePretty =
        Json.read(
            new BufferedReader(
                new InputStreamReader(
                    JsonTest.class.getResourceAsStream(
                        format("/com/twolattes/json/testdata/sample%s_pretty.json", index)))));

    System.out.println(sample);
    System.out.println(samplePretty);
    assertEquals(sample, samplePretty);

    Object sampleOrgJson;
    if (array) {
      sampleOrgJson = new JSONArray(sample.toString());
    } else {
      sampleOrgJson = new JSONObject(sample.toString());
    }

    assertJsonEquals(sample, sampleOrgJson);
    assertJsonEquals(samplePretty, sampleOrgJson);
  }
Ejemplo n.º 2
0
 @Override
 protected Json.Number nullSafeMarshall(BigInteger entity) {
   return Json.number(BigDecimal.valueOf(entity.longValue()));
 }