GtfsRealtimeEntitySource { public Id getStopId(String stopId) { for (String agencyId : _agencyIds) { AgencyAndId id = new AgencyAndId(agencyId, stopId); StopEntry stop = _transitGraphDao.getStopEntryForId(id); if (stop != null) return ServiceAlertLibrary.id(id); } try { AgencyAndId id = AgencyAndId.convertFromString(stopId); StopEntry stop = _transitGraphDao.getStopEntryForId(id); if (stop != null) return ServiceAlertLibrary.id(id); } catch (IllegalArgumentException ex) { } if (_consolidatedStopsService != null) { if (stopId.indexOf('_') > 0) { AgencyAndId consolidatedId = _consolidatedStopsService.getConsolidatedStopIdForHiddenStopId(AgencyAndId.convertFromString(stopId)); if (consolidatedId != null) { return ServiceAlertLibrary.id(consolidatedId); } } else { for (String agencyId : _agencyIds) { AgencyAndId consolidatedId = _consolidatedStopsService.getConsolidatedStopIdForHiddenStopId(new AgencyAndId(agencyId, stopId)); if (consolidatedId != null) { return ServiceAlertLibrary.id(consolidatedId); } } } } _log.warn("alert stop not found with id \"{}\"", stopId); AgencyAndId id = new AgencyAndId(_agencyIds.get(0), stopId); return ServiceAlertLibrary.id(id); }  void setTransitGraphDao(TransitGraphDao transitGraphDao); void setConsolidatedStopService(ConsolidatedStopsService service); void setAgencyIds(List<String> agencyIds); Id getRouteId(String routeId); Id getTripId(String tripId); TripEntry getTrip(String tripId); Id getStopId(String stopId);  }
@Test public void testGetStopId() { StopEntryImpl stop = new StopEntryImpl(new AgencyAndId("2", "S10"), 0, 0); Mockito.when(_dao.getStopEntryForId(stop.getId())).thenReturn(stop); Id stopId = _source.getStopId("S10"); assertEquals("2", stopId.getAgencyId()); assertEquals("S10", stopId.getId()); stopId = _source.getStopId("S11"); assertEquals("1", stopId.getAgencyId()); assertEquals("S11", stopId.getId()); }