GenerateNarrativesTask implements Runnable { public void generateAgencyNarratives(NarrativeProviderImpl provider) { for (Agency agency : _gtfsDao.getAllAgencies()) { AgencyNarrative.Builder narrative = AgencyNarrative.builder(); narrative.setLang(deduplicate(agency.getLang())); narrative.setName(deduplicate(agency.getName())); narrative.setPhone(deduplicate(agency.getPhone())); narrative.setEmail(deduplicate(agency.getEmail())); narrative.setTimezone(deduplicate(agency.getTimezone())); narrative.setUrl(deduplicate(agency.getUrl())); narrative.setEmail(agency.getEmail()); narrative.setFareUrl(agency.getFareUrl()); String disclaimer = _modifications.getModificationForTypeAndId( AgencyNarrative.class, agency.getId(), "disclaimer"); if (disclaimer != null) narrative.setDisclaimer(disclaimer); Boolean privateService = _modifications.getModificationForTypeAndId( AgencyNarrative.class, agency.getId(), "privatService"); if (privateService != null) narrative.setPrivateService(privateService); provider.setNarrativeForAgency(agency.getId(), narrative.create()); } }  @Autowired void setBundle(FederatedTransitDataBundle bundle); @Autowired void setGtfsDao(GtfsRelationalDao gtfsDao); @Autowired void setTransitGraphDao(TransitGraphDao transitGraphDao); @Autowired void setBlockIndexService(BlockIndexService blockIndexService); @Autowired void setModifications(Modifications modifications); @Autowired void setShapePointHelper(ShapePointHelper shapePointHelper); @Autowired void setUniqueService(UniqueService uniqueService); @Autowired void setRefreshService(RefreshService refreshService); void setStopDirectionStandardDeviationThreshold(
      double stopDirectionStandardDeviationThreshold); @Override void run(); void generateAgencyNarratives(NarrativeProviderImpl provider); void generateRouteNarratives(NarrativeProviderImpl provider); void generateShapePointNarratives(NarrativeProviderImpl provider); void generateStopNarratives(NarrativeProviderImpl provider); void generateTripNarratives(NarrativeProviderImpl provider);  }
@Test public void testGenerateAgencyNarratives() { Agency agency = new Agency(); agency.setId("1"); agency.setLang("en"); agency.setName("Agency"); agency.setPhone("555-1234"); agency.setTimezone("America/New_York"); agency.setUrl("http: Mockito.when(_gtfsDao.getAllAgencies()).thenReturn(Arrays.asList(agency)); Modification mod = new Modification(); mod.setType(AgencyNarrative.class); mod.setId("1"); mod.setProperty("disclaimer"); mod.setValue("Use at your own risk."); _modifications.setModifications(Arrays.asList(mod)); _task.generateAgencyNarratives(_provider); AgencyNarrative narrative = _provider.getNarrativeForAgencyId("1"); assertEquals(mod.getValue(), narrative.getDisclaimer()); assertEquals(agency.getLang(), narrative.getLang()); assertEquals(agency.getName(), narrative.getName()); assertEquals(agency.getPhone(), narrative.getPhone()); assertEquals(agency.getTimezone(), narrative.getTimezone()); assertEquals(agency.getUrl(), narrative.getUrl()); }