Package jodd.json.mock

Examples of jodd.json.mock.Spiderman


    assertStringValue("Dilbert", json);
  }

  @Test
  public void testSerializePublicFields() {
    Spiderman spiderman = new Spiderman();

    JsonSerializer serializer = new JsonSerializer();
    String json = serializer.serialize(spiderman);

    assertAttribute("spideySense", json);
View Full Code Here


    assertStringValue("Creates web", json);
  }

  @Test
  public void testExcludingPublicFields() {
    Spiderman spiderman = new Spiderman();

    String json = new JsonSerializer().exclude("superpower").serialize(spiderman);

    assertAttributeMissing("superpower", json);
    assertAttribute("spideySense", json);
View Full Code Here

  @Test
  public void testDeserializationIntoPublicFields() {
    JoddJson.classMetadataName = "class";

    Spiderman spiderman = new Spiderman();
    spiderman.spideySense = false;
    spiderman.superpower = "Creates Many Webs and Super Tough";

    String json = new JsonSerializer().serialize(spiderman);
    Spiderman jsonSpiderman = new JsonParser().parse(json);

    assertEquals(spiderman.spideySense, jsonSpiderman.spideySense);
    assertEquals(spiderman.superpower, jsonSpiderman.superpower);
  }
View Full Code Here

TOP

Related Classes of jodd.json.mock.Spiderman

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.