sort(results);
assertEquals(1, results.size());
StopTimeInstance sti = results.get(0);
assertEquals(dayA.getTime(), sti.getServiceDate());
assertEquals(date("2009-09-01 10:00").getTime(), sti.getArrivalTime());
assertEquals(date("2009-09-01 10:30").getTime(), sti.getDepartureTime());
/****
*
****/
from = date("2009-09-02 10:10");
to = date("2009-09-02 10:40");
results = _service.getStopTimeInstancesInTimeRange(_stopId, from, to);
sort(results);
assertEquals(1, results.size());
sti = results.get(0);
assertEquals(dayB.getTime(), sti.getServiceDate());
assertEquals(date("2009-09-02 10:00").getTime(), sti.getArrivalTime());
assertEquals(date("2009-09-02 10:30").getTime(), sti.getDepartureTime());
/****
*
****/
from = date("2009-09-01 10:10");
to = date("2009-09-02 10:40");
results = _service.getStopTimeInstancesInTimeRange(_stopId, from, to);
sort(results);
assertEquals(3, results.size());
sti = results.get(0);
assertEquals(dayA.getTime(), sti.getServiceDate());
assertEquals(date("2009-09-01 10:00").getTime(), sti.getArrivalTime());
assertEquals(date("2009-09-01 10:30").getTime(), sti.getDepartureTime());
sti = results.get(1);
assertEquals(dayA.getTime(), sti.getServiceDate());
assertEquals(date("2009-09-02 01:00").getTime(), sti.getArrivalTime());
assertEquals(date("2009-09-02 01:30").getTime(), sti.getDepartureTime());
sti = results.get(2);
assertEquals(dayB.getTime(), sti.getServiceDate());
assertEquals(date("2009-09-02 10:00").getTime(), sti.getArrivalTime());
assertEquals(date("2009-09-02 10:30").getTime(), sti.getDepartureTime());
/****
*
****/
from = date("2009-09-01 12:00");
to = date("2009-09-02 12:00");
results = _service.getStopTimeInstancesInTimeRange(_stopId, from, to);
sort(results);
assertEquals(2, results.size());
sti = results.get(0);
assertEquals(dayA.getTime(), sti.getServiceDate());
assertEquals(date("2009-09-02 01:00").getTime(), sti.getArrivalTime());
assertEquals(date("2009-09-02 01:30").getTime(), sti.getDepartureTime());
sti = results.get(1);
assertEquals(dayB.getTime(), sti.getServiceDate());
assertEquals(date("2009-09-02 10:00").getTime(), sti.getArrivalTime());
assertEquals(date("2009-09-02 10:30").getTime(), sti.getDepartureTime());
/****
*
****/
from = date("2009-09-02 12:00");
to = date("2009-09-03 12:00");
results = _service.getStopTimeInstancesInTimeRange(_stopId, from, to);
sort(results);
assertEquals(1, results.size());
sti = results.get(0);
assertEquals(dayB.getTime(), sti.getServiceDate());
assertEquals(date("2009-09-03 01:00").getTime(), sti.getArrivalTime());
assertEquals(date("2009-09-03 01:30").getTime(), sti.getDepartureTime());
}