public void testTransportMode() { Fixture f = new Fixture(); // test default of Fixture assertEquals("train", f.tRoute.getTransportMode()); // test some different from default f.tRoute.setTransportMode("tram"); assertEquals("tram", f.tRoute.getTransportMode()); }
trip.setMode(transitSchedule.getTransitLines() .get(vehicle.transitLineId).getRoutes() .get(vehicle.transitRouteId).getTransportMode()); trip.setBoardingStop(vehicle.lastStop); trip.setOrig(journey.getWaits().getLast().getCoord());
private void writeTransitRoute(final TransitRoute route) throws UncheckedIOException { List<Tuple<String, String>> attributes = new ArrayList<Tuple<String, String>>(1); attributes.add(this.createTuple(Constants.ID, route.getId().toString())); this.writeStartTag(Constants.TRANSIT_ROUTE, attributes); if (route.getDescription() != null) { this.writeStartTag(Constants.DESCRIPTION, null); this.writeContent(route.getDescription(), false); this.writeEndTag(Constants.DESCRIPTION); } this.writeStartTag(Constants.TRANSPORT_MODE, null); this.writeContent(route.getTransportMode(), false); this.writeEndTag(Constants.TRANSPORT_MODE); this.writeRouteProfile(route.getStops()); this.writeRoute(route.getRoute()); this.writeDepartures(route.getDepartures()); this.writeEndTag(Constants.TRANSIT_ROUTE); }
private void writeTransitRoute(final TransitRoute route) throws IOException, UncheckedIOException { List<Tuple<String, String>> attributes = new ArrayList<>(1); attributes.add(createTuple(Constants.ID, route.getId().toString())); this.writeStartTag(Constants.TRANSIT_ROUTE, attributes); if (!AttributesUtils.isEmpty(route.getAttributes())) { this.writer.write(NL); this.attributesWriter.writeAttributes("\t\t\t", this.writer, route.getAttributes()); } if (route.getDescription() != null) { this.writeStartTag(Constants.DESCRIPTION, null); this.writeContent(route.getDescription(), false); this.writeEndTag(Constants.DESCRIPTION); } this.writeStartTag(Constants.TRANSPORT_MODE, null); this.writeContent(route.getTransportMode(), false); this.writeEndTag(Constants.TRANSPORT_MODE); this.writeRouteProfile(route.getStops()); this.writeRoute(route.getRoute()); this.writeDepartures(route.getDepartures()); this.writeEndTag(Constants.TRANSIT_ROUTE); }
public void testInitialization() { Id<TransitRoute> id = Id.create(9791, TransitRoute.class); Link fromLink = new FakeLink(Id.create(10, Link.class), null, null); Link toLink = new FakeLink(Id.create(5, Link.class), null, null); NetworkRoute route = RouteUtils.createLinkNetworkRouteImpl(fromLink.getId(), toLink.getId()); List<TransitRouteStop> stops = new ArrayList<TransitRouteStop>(); TransitRouteStop stop = new TransitRouteStopImpl(null, 50, 60); stops.add(stop); TransitRoute tRoute = createTransitRoute(id, route, stops, "train"); assertEquals("wrong id.", id.toString(), tRoute.getId().toString()); assertEquals("wrong route.", route, tRoute.getRoute()); assertEquals(stops.size(), tRoute.getStops().size()); assertEquals(stop, tRoute.getStops().get(0)); assertEquals("train", tRoute.getTransportMode()); }
@Test public void testCreateTransitRoute() { TransitScheduleFactory builder = createTransitScheduleBuilder(); Id<TransitRoute> id = Id.create(2, TransitRoute.class); NetworkRoute route = RouteUtils.createLinkNetworkRouteImpl(Id.create(3, Link.class), Id.create(4, Link.class)); List<TransitRouteStop> stops = new ArrayList<TransitRouteStop>(); TransitRouteStop stop1 = new TransitRouteStopImpl(null, 50, 60); stops.add(stop1); String mode = TransportMode.pt; TransitRoute tRoute = builder.createTransitRoute(id, route, stops, mode); Assert.assertEquals(id, tRoute.getId()); Assert.assertEquals(route, tRoute.getRoute()); Assert.assertEquals(1, tRoute.getStops().size()); Assert.assertEquals(stop1, tRoute.getStops().get(0)); Assert.assertEquals(mode, tRoute.getTransportMode()); }
assertEquals(routeId1, route1.getId()); assertNull(route1.getDescription()); assertEquals("bus", route1.getTransportMode()); assertEquals(0, route1.getStops().size()); assertNull(route1.getRoute());
assertNotNull(route1); assertEquals(routeId1, route1.getId()); assertEquals("bus", route1.getTransportMode()); assertEquals("train", route2.getTransportMode());