use of org.geotoolkit.gml.xml.v321.TimeInstantType in project geotoolkit by Geomatys.
the class TimePeriodTypeTest method getTime2Test.
@Test
public void getTime2Test() throws Exception {
TimePositionType tn = null;
TimePositionType tb = new TimePositionType("2008-11-01T02:00:00");
TimePositionType te = new TimePositionType("2008-11-01T02:01:00");
TimePeriodType tp = new TimePeriodType(new TimeInstantType(tb), new TimeInstantType(te));
assertEquals(60000, tp.getTime());
tb = new TimePositionType("2008-11-01T01:00:00");
te = new TimePositionType("2008-11-01T02:00:00");
tp = new TimePeriodType(new TimeInstantType(tb), new TimeInstantType(te));
assertEquals(3600000, tp.getTime());
tp = new TimePeriodType(new TimeInstantType(tb), new TimeInstantType(tn));
assertEquals(-1, tp.getTime());
tb = null;
tp = new TimePeriodType(new TimeInstantType(tb), new TimeInstantType(te));
assertEquals(-1, tp.getTime());
tb = null;
te = null;
tp = new TimePeriodType(new TimeInstantType(tb), new TimeInstantType(te));
assertEquals(-1, tp.getTime());
}
use of org.geotoolkit.gml.xml.v321.TimeInstantType 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