List<Transfer> getTransfersToStop(String toStopId, String toRouteId) {
        final List<Transfer> allInboundTransfers = transfersToStop.getOrDefault(toStopId, Collections.emptyList());
        final Map<String, List<Transfer>> byFromStop = allInboundTransfers.stream()
                .filter(t -> t.transfer_type == 0 || t.transfer_type == 2)
                .filter(t -> t.to_route_id == null || toRouteId.equals(t.to_route_id))
                .collect(Collectors.groupingBy(t -> t.from_stop_id));
        final List<Transfer> result = new ArrayList<>();
        byFromStop.forEach((fromStop, transfers) -> {
            if (hasNoRouteSpecificArrivalTransferRules(fromStop)) {
                Transfer myRule = new Transfer();
                myRule.from_stop_id = fromStop;
                myRule.to_stop_id = toStopId;

                if(transfers.size() == 1)
                    myRule.min_transfer_time = transfers.get(0).min_transfer_time;

                result.add(myRule);
            } else {
                routesByStop.getOrDefault(fromStop, Collections.emptySet()).forEach(fromRoute -> {
                    final Transfer mostSpecificRule = findMostSpecificRule(transfers, fromRoute, toRouteId);
                    final Transfer myRule = new Transfer();
                    myRule.to_route_id = toRouteId;
                    myRule.from_route_id = fromRoute;
                    myRule.to_stop_id = mostSpecificRule.to_stop_id;
                    myRule.from_stop_id = mostSpecificRule.from_stop_id;
                    myRule.transfer_type = mostSpecificRule.transfer_type;
                    myRule.min_transfer_time = mostSpecificRule.min_transfer_time;
                    myRule.from_trip_id = mostSpecificRule.from_trip_id;
                    myRule.to_trip_id = mostSpecificRule.to_trip_id;
                    result.add(myRule);
                });
            }
        });
        if (result.stream().noneMatch(t -> t.from_stop_id.equals(toStopId))) {
            final Transfer withinStationTransfer = new Transfer();
            withinStationTransfer.from_stop_id = toStopId;
            withinStationTransfer.to_stop_id = toStopId;
            result.add(withinStationTransfer);
        }
        return result;
    }
@Test
    public void testInternalTransfersByToRouteIfRouteSpecific() {
        List<Transfer> transfersToStop = sampleFeed.getTransfersToStop("BEATTY_AIRPORT", "AB");
        assertEquals(5, transfersToStop.size());
        assertEquals("AB", transfersToStop.get(0).from_route_id);
        assertEquals("FUNNY_BLOCK_AB", transfersToStop.get(1).from_route_id);
        assertEquals("STBA", transfersToStop.get(2).from_route_id);
        assertEquals("AAMV", transfersToStop.get(3).from_route_id);
        assertEquals("ABBFC", transfersToStop.get(4).from_route_id);
    }