Search in sources :

Example 1 with IntervalListType

use of net.geoprism.registry.IntervalListType in project geoprism-registry by terraframe.

the class ListTypeTest method testIntervalListTypeSerialization.

@Test
@Request
public void testIntervalListTypeSerialization() {
    JsonObject interval = new JsonObject();
    interval.addProperty(IntervalListType.START_DATE, GeoRegistryUtil.formatDate(USATestData.DEFAULT_OVER_TIME_DATE, false));
    interval.addProperty(IntervalListType.END_DATE, GeoRegistryUtil.formatDate(USATestData.DEFAULT_END_TIME_DATE, false));
    JsonArray intervalJson = new JsonArray();
    intervalJson.add(interval);
    IntervalListType list = new IntervalListType();
    list.setUniversal(USATestData.STATE.getUniversal());
    list.getDisplayLabel().setValue("Test List");
    list.setCode("TEST_CODE");
    list.setOrganization(USATestData.ORG_NPS.getServerObject());
    list.getDescription().setValue("My Overal Description");
    list.setIntervalJson(intervalJson.toString());
    JsonObject json = list.toJSON();
    IntervalListType test = (IntervalListType) ListType.fromJSON(json);
    Assert.assertEquals(list.getUniversalOid(), test.getUniversalOid());
    Assert.assertEquals(list.getDisplayLabel().getValue(), test.getDisplayLabel().getValue());
    Assert.assertEquals(list.getDescription().getValue(), test.getDescription().getValue());
    Assert.assertEquals(list.getOrganization(), test.getOrganization());
    Assert.assertEquals(list.getCode(), test.getCode());
    Assert.assertEquals(list.getHierarchiesAsJson().toString(), test.getHierarchiesAsJson().toString());
    Assert.assertEquals(list.getIntervalJson(), test.getIntervalJson());
}
Also used : JsonArray(com.google.gson.JsonArray) IntervalListType(net.geoprism.registry.IntervalListType) JsonObject(com.google.gson.JsonObject) ClassificationTypeTest(net.geoprism.registry.classification.ClassificationTypeTest) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 Request (com.runwaysdk.session.Request)1 IntervalListType (net.geoprism.registry.IntervalListType)1 ClassificationTypeTest (net.geoprism.registry.classification.ClassificationTypeTest)1 Test (org.junit.Test)1