예제 #1
0
  public static void main6(String[] args) {
    SpecialPropertyObject s = new SpecialPropertyObject();
    System.out.println(s);
    s.init();
    String json = Json.toJson(s);
    System.out.println(json);

    SpecialPropertyObject s2 = Json.toObject(json, SpecialPropertyObject.class);
    System.out.println(s2);
  }
예제 #2
0
  @Test
  public void testSpecialPropertyObject() {
    SpecialPropertyObject s = new SpecialPropertyObject();
    System.out.println(s);
    s.init();
    String json = Json.toJson(s);
    System.out.println(json);

    SpecialPropertyObject s2 = Json.toObject(json, SpecialPropertyObject.class);
    System.out.println(s2);

    Assert.assertThat(s2.getiOS(), is(s.getiOS()));
    Assert.assertThat(s2.getiPad(), is(s.getiPad()));
    Assert.assertThat(s2.getiPhone(), is(s.getiPhone()));
    Assert.assertThat(s2.isiText(), is(s.isiText()));

    Assert.assertThat(s2.aOS, is(s.aOS));
    Assert.assertThat(s2.aPad, is(s.aPad));
    Assert.assertThat(s2.aPhone, is(s.aPhone));
    Assert.assertThat(s2.aText, is(s.aText));
  }