Package jodd.json.mock

Examples of jodd.json.mock.Location


public class AnnotationTest {

  @Test
  public void testAnnName() {
    Location location = new Location();

    location.setLatitude(65);
    location.setLongitude(12);

    String json = new JsonSerializer().serialize(location);

    assertEquals("{\"lat\":65,\"lng\":12}", json);

    Location jsonLocation = new JsonParser().parse(json, Location.class);

    assertEquals(location.getLatitude(), jsonLocation.getLatitude());
    assertEquals(location.getLongitude(), jsonLocation.getLongitude());
  }
View Full Code Here


    assertEquals(location.getLongitude(), jsonLocation.getLongitude());
  }

  @Test
  public void testAnnNameWithClass() {
    Location location = new Location();

    location.setLatitude(65);
    location.setLongitude(12);

    String json = new JsonSerializer().setClassMetadataName("class").serialize(location);

    assertEquals("{\"class\":\"jodd.json.mock.Location\",\"lat\":65,\"lng\":12}", json);

    Location jsonLocation = new JsonParser().setClassMetadataName("class").parse(json, Location.class);

    assertEquals(location.getLatitude(), jsonLocation.getLatitude());
    assertEquals(location.getLongitude(), jsonLocation.getLongitude());
  }
View Full Code Here

TOP

Related Classes of jodd.json.mock.Location

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.