DeferredValueSupport { public AgencyAndId resolveAgencyAndId(BeanWrapper bean, String propertyName, String newId) { GtfsReaderContext context = _reader.getGtfsReaderContext(); String agencyId = null; try { agencyId = context.getDefaultAgencyId(); } catch (NoDefaultAgencyIdException ndaie) { agencyId = null; } AgencyAndId existingId = (AgencyAndId) bean.getPropertyValue(propertyName); if (existingId != null) { agencyId = existingId.getAgencyId(); } return new AgencyAndId(agencyId, newId); } DeferredValueSupport(GtfsReader reader, EntitySchemaCache schemaCache); GtfsReader getReader(); AgencyAndId resolveAgencyAndId(BeanWrapper bean, String propertyName,
      String newId); Converter resolveConverter(Class<?> targetEntityType,
      String targetPropertyName, Class<?> targetValueType);  }
@Test public void testResolveAgencyAndId_DefaultAgencyId() { Stop stop = new Stop(); BeanWrapper bean = BeanWrapperFactory.wrap(stop); AgencyAndId id = _support.resolveAgencyAndId(bean, "id", "1"); assertEquals(new AgencyAndId("a0", "1"), id); }
@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); }