List<BlockInstance> instances = _service.getActiveBlocksInTimeRange(blocks,
layoverIndices, frequencyIndices, time, time);
assertEquals(1, instances.size());
BlockInstance instance = instances.get(0);
assertEquals(bcA_A_B, instance.getBlock());
assertEquals(serviceDateA.getTime(), instance.getServiceDate());
/****
*
****/
time = timeFromString("2010-09-07 010:15");
instances = _service.getActiveBlocksInTimeRange(blocks, layoverIndices,
frequencyIndices, time, time);
assertEquals(1, instances.size());
instance = instances.get(0);
assertEquals(bcB_A_B, instance.getBlock());
assertEquals(serviceDateA.getTime(), instance.getServiceDate());
/****
*
****/
/*
* time = timeFromString("2010-09-07 011:15");
*
* instances = _service.getActiveBlocksInTimeRange(blocks, frequencyIndices,
* time, time);
*
* assertEquals(1, instances.size());
*
* instance = instances.get(0); assertEquals(bcB_A_B, instance.getBlock());
* assertEquals(serviceDateA.getTime(), instance.getServiceDate());
*/
/****
*
****/
time = timeFromString("2010-09-07 012:15");
instances = _service.getActiveBlocksInTimeRange(blocks, layoverIndices,
frequencyIndices, time, time);
assertEquals(1, instances.size());
instance = instances.get(0);
assertEquals(bcB_A_B, instance.getBlock());
assertEquals(serviceDateA.getTime(), instance.getServiceDate());
/****
*
****/
time = timeFromString("2010-09-08 09:15");
instances = _service.getActiveBlocksInTimeRange(blocks, layoverIndices,
frequencyIndices, time, time);
assertEquals(1, instances.size());
instance = instances.get(0);
assertEquals(bcA_AB, instance.getBlock());
assertEquals(serviceDateB.getTime(), instance.getServiceDate());
/****
*
****/
time = timeFromString("2010-09-08 10:15");
instances = _service.getActiveBlocksInTimeRange(blocks, layoverIndices,
frequencyIndices, time, time);
Collections.sort(instances, new BlockInstanceComparator());
assertEquals(2, instances.size());
instance = instances.get(0);
assertEquals(bcA_AB, instance.getBlock());
assertEquals(serviceDateB.getTime(), instance.getServiceDate());
instance = instances.get(1);
assertEquals(bcB_AB, instance.getBlock());
assertEquals(serviceDateB.getTime(), instance.getServiceDate());
/****
*
****/
time = timeFromString("2010-09-08 11:15");
instances = _service.getActiveBlocksInTimeRange(blocks, layoverIndices,
frequencyIndices, time, time);
assertEquals(1, instances.size());
instance = instances.get(0);
assertEquals(bcB_AB, instance.getBlock());
assertEquals(serviceDateB.getTime(), instance.getServiceDate());
/****
*
****/
time = timeFromString("2010-09-08 12:15");
instances = _service.getActiveBlocksInTimeRange(blocks, layoverIndices,
frequencyIndices, time, time);
assertEquals(1, instances.size());
instance = instances.get(0);
assertEquals(bcB_AB, instance.getBlock());
assertEquals(serviceDateB.getTime(), instance.getServiceDate());
/****
*
****/
time = timeFromString("2010-09-09 09:15");
instances = _service.getActiveBlocksInTimeRange(blocks, layoverIndices,
frequencyIndices, time, time);
assertEquals(0, instances.size());
/****
*
****/
time = timeFromString("2010-09-09 10:15");
instances = _service.getActiveBlocksInTimeRange(blocks, layoverIndices,
frequencyIndices, time, time);
assertEquals(1, instances.size());
instance = instances.get(0);
assertEquals(bcA_B_A, instance.getBlock());
assertEquals(serviceDateC.getTime(), instance.getServiceDate());
/****
*
****/
time = timeFromString("2010-09-09 11:15");
instances = _service.getActiveBlocksInTimeRange(blocks, layoverIndices,
frequencyIndices, time, time);
assertEquals(1, instances.size());
instance = instances.get(0);
assertEquals(bcB_B_A, instance.getBlock());
assertEquals(serviceDateC.getTime(), instance.getServiceDate());
}