Search in sources :

Example 6 with PropertyMethod

use of org.onebusaway.collections.beans.PropertyMethod in project onebusaway-gtfs-modules by OneBusAway.

the class PropertyMethodResolverImplTest method testRouteTripsVirtualMethod.

@Test
public void testRouteTripsVirtualMethod() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    Route route = new Route();
    route.setId(new AgencyAndId("1", "r0"));
    _dao.saveEntity(route);
    Trip trip = new Trip();
    trip.setId(new AgencyAndId("1", "t0"));
    trip.setRoute(route);
    _dao.saveEntity(trip);
    PropertyMethod method = _resolver.getPropertyMethod(Route.class, "trips");
    assertEquals(Arrays.asList(trip), method.invoke(route));
}
Also used : Trip(org.onebusaway.gtfs.model.Trip) PropertyMethod(org.onebusaway.collections.beans.PropertyMethod) AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) Route(org.onebusaway.gtfs.model.Route) Test(org.junit.Test)

Aggregations

PropertyMethod (org.onebusaway.collections.beans.PropertyMethod)6 Test (org.junit.Test)5 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)5 Route (org.onebusaway.gtfs.model.Route)3 Trip (org.onebusaway.gtfs.model.Trip)3 DefaultEntitySchemaFactory (org.onebusaway.csv_entities.schema.DefaultEntitySchemaFactory)1 EntitySchema (org.onebusaway.csv_entities.schema.EntitySchema)1 SingleFieldMapping (org.onebusaway.csv_entities.schema.SingleFieldMapping)1 Agency (org.onebusaway.gtfs.model.Agency)1 ServiceCalendar (org.onebusaway.gtfs.model.ServiceCalendar)1 Stop (org.onebusaway.gtfs.model.Stop)1 StopTime (org.onebusaway.gtfs.model.StopTime)1