BlockEntriesFactory { public void processBlocks(TransitGraphImpl graph) { Map<AgencyAndId, List<TripEntryImpl>> tripsByBlockId = getTripsByBlockId(graph); processBlockTrips(graph, tripsByBlockId); }  @Autowired void setGtfsDao(GtfsRelationalDao gtfsDao); @Autowired void setBlockConfigurationEntriesFactory(
      BlockConfigurationEntriesFactory blockConfigurationEntriesFactory); void processBlocks(TransitGraphImpl graph);  }
@Test public void testFixedScheduleBlocks() { LocalizedServiceId lsid = lsid("serviceId"); StopEntryImpl stop = stop("stop"); Trip tripA = new Trip(); tripA.setId(aid("tripA")); tripA.setRoute(_route); tripA.setBlockId("blockA"); TripEntryImpl tripEntryA = trip("tripA").setRoute(_routeEntry).setServiceId( lsid); _graph.putTripEntry(tripEntryA); addStopTime(tripEntryA, stopTime().setStop(stop)); Trip tripB = new Trip(); tripB.setId(aid("tripB")); tripB.setRoute(_route); tripB.setBlockId("blockA"); TripEntryImpl tripEntryB = trip("tripB").setRoute(_routeEntry).setServiceId( lsid); _graph.putTripEntry(tripEntryB); addStopTime(tripEntryB, stopTime().setStop(stop)); Trip tripC = new Trip(); tripC.setId(aid("tripC")); tripC.setRoute(_route); tripC.setBlockId("blockB"); TripEntryImpl tripEntryC = trip("tripC").setRoute(_routeEntry).setServiceId( lsid); _graph.putTripEntry(tripEntryC); addStopTime(tripEntryC, stopTime().setStop(stop)); Mockito.when(_dao.getTripsForRoute(_route)).thenReturn( Arrays.asList(tripA, tripB, tripC)); _graph.initialize(); _factory.processBlocks(_graph); List<BlockEntryImpl> blocks = _graph.getBlocks(); assertEquals(2, blocks.size()); BlockEntryImpl block = find(blocks, "blockB"); assertEquals(aid("blockB"), block.getId()); assertSame(block, tripEntryC.getBlock()); Mockito.verify(_blockConfigFactory).processBlockConfigurations(block, Arrays.asList(tripEntryC)); block = find(blocks, "blockA"); assertEquals(aid("blockA"), block.getId()); assertSame(block, tripEntryA.getBlock()); assertSame(block, tripEntryB.getBlock()); Mockito.verify(_blockConfigFactory).processBlockConfigurations(block, Arrays.asList(tripEntryA, tripEntryB)); Mockito.verifyNoMoreInteractions(_blockConfigFactory); }