use of org.geotoolkit.gml.xml.v311.TimePeriodType in project geotoolkit by Geomatys.
the class TimePeriodTypeTest method getTime3Test.
@Test
public void getTime3Test() throws Exception {
final String id = "id-1";
String snull = null;
TimeInstantType tb = new TimeInstantType(new TimePositionType("2008-11-01T02:00:00"));
TimeInstantType te = new TimeInstantType(new TimePositionType("2008-11-01T02:01:00"));
TimePeriodType tp = new TimePeriodType(id, snull);
tp.setBegin(new TimeInstantPropertyType(tb));
tp.setEnd(new TimeInstantPropertyType(te));
assertEquals(60000, tp.getTime());
tb = new TimeInstantType(new TimePositionType("2008-11-01T01:00:00"));
te = new TimeInstantType(new TimePositionType("2008-11-01T02:00:00"));
tp = new TimePeriodType(id, snull);
tp.setBegin(new TimeInstantPropertyType(tb));
tp.setEnd(new TimeInstantPropertyType(te));
assertEquals(3600000, tp.getTime());
tp = new TimePeriodType(id, snull);
tp.setBegin(new TimeInstantPropertyType(tb));
assertEquals(-1, tp.getTime());
tp = new TimePeriodType(id, snull);
tp.setEnd(new TimeInstantPropertyType(te));
assertEquals(-1, tp.getTime());
tp = new TimePeriodType(id, snull);
assertEquals(-1, tp.getTime());
}
Aggregations