use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.
the class DeferredValueSupportTest method testResolveAgencyAndId_ExistingAgencyId.
@Test
public void testResolveAgencyAndId_ExistingAgencyId() {
Stop stop = new Stop();
stop.setId(new AgencyAndId("a1", "2"));
BeanWrapper bean = BeanWrapperFactory.wrap(stop);
AgencyAndId id = _support.resolveAgencyAndId(bean, "id", "1");
assertEquals(new AgencyAndId("a1", "1"), id);
}
use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.
the class ReplaceValueSetterTest method test.
@Test
public void test() {
ReplaceValueSetter setter = new ReplaceValueSetter("cats", "dogs");
Stop stop = new Stop();
stop.setName("I like cats.");
setter.setValue(BeanWrapperFactory.wrap(stop), "name");
assertEquals("I like dogs.", stop.getName());
}
use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.
the class LatLonFieldMappingFactoryTest method testTranslateFromObjectToCSV_differentLocale.
@Test
public void testTranslateFromObjectToCSV_differentLocale() {
Locale.setDefault(Locale.FRANCE);
_fieldMapping = buildFieldMapping();
Stop stop = new Stop();
stop.setLat(47.5678);
Map<String, Object> csvValues = new HashMap<String, Object>();
_fieldMapping.translateFromObjectToCSV(new CsvEntityContextImpl(), BeanWrapperFactory.wrap(stop), csvValues);
assertEquals("47.567800", csvValues.get("stop_lat"));
}
use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.
the class LatLonFieldMappingFactoryTest method testTranslateFromCSVToObject.
@Test
public void testTranslateFromCSVToObject() {
Map<String, Object> csvValues = new HashMap<String, Object>();
csvValues.put("stop_lat", "47.1234");
Stop stop = new Stop();
_fieldMapping.translateFromCSVToObject(new CsvEntityContextImpl(), csvValues, BeanWrapperFactory.wrap(stop));
assertEquals(47.1234, stop.getLat(), 0.00001);
}
use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.
the class LatLonFieldMappingFactoryTest method testTranslateFromObjectToCSV.
@Test
public void testTranslateFromObjectToCSV() {
Stop stop = new Stop();
stop.setLat(47.5678);
Map<String, Object> csvValues = new HashMap<String, Object>();
_fieldMapping.translateFromObjectToCSV(new CsvEntityContextImpl(), BeanWrapperFactory.wrap(stop), csvValues);
assertEquals("47.567800", csvValues.get("stop_lat"));
}
Aggregations