SiriLikeRealtimeSource { public NodesAndTimestamp parseVehicles(URL url) throws Exception { List<Node> vehicles = new ArrayList<Node>(); Document doc = builder.parse(url.toString()); String recordedAtStr = (String)recordedAtExpression.evaluate(doc, XPathConstants.STRING); long timestamp = parseDate(recordedAtStr).getTime(); _log.debug("timestamp=" + new Date(timestamp) + " for date " + recordedAtStr); NodeList nl = (NodeList) this.mvjExpression.evaluate(doc, XPathConstants.NODESET); if (nl ==null || nl.getLength() == 0) { _log.debug("no nodes found"); return new NodesAndTimestamp(vehicles, timestamp); } for (int i = 0; i < nl.getLength(); i++) { vehicles.add(nl.item(i)); } return new NodesAndTimestamp(vehicles, timestamp); }  void setApiKey(String key); String getApiKey(); void setBaseUrl(String url); String getUrl(); void setAgency(String agencyId); void setRefreshInterval(int refreshInterval); @Autowired void setTransitGraphDao(TransitGraphDaoImpl transitGraphDao); @Autowired void setBlockGeospatialService(BlockGeospatialService blockGeospatialService); @Autowired void setVehicleLocationListener(
      VehicleLocationListener vehicleLocationListener); @Autowired void setScheduledExecutorService(
      ScheduledExecutorService scheduledExecutorService); @PostConstruct void setup(); @PreDestroy void stop(); void setRoutes(List<String> routes); List<String> getRoutes(); void refresh(); NodesAndTimestamp parseVehicles(URL url); VehicleLocationRecord parse(Node node, long timestamp); Date parseShortDate(String s); Date parseDate(String s); Date parseServiceDate(String serviceDateStr); public List<String> _routeList; }
@Test public void testParseEmpty() throws Exception { URL url = getClass().getResource("SiriLike_Empty.xml").toURI().toURL(); NodesAndTimestamp vehicles = source.parseVehicles(url); assertNotNull(vehicles); assertEquals(0, vehicles.getNodes().size()); }