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());
}
Aggregations