Fix autocomplete coverage for North Rhine-Westphalia.

This commit is contained in:
Andreas Schildbach 2014-01-28 13:33:37 +01:00
parent 64f6b31d51
commit a83e7d4fc2
2 changed files with 27 additions and 10 deletions

View file

@ -17,13 +17,9 @@
package de.schildbach.pte; package de.schildbach.pte;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.LocationType;
import de.schildbach.pte.dto.Style; import de.schildbach.pte.dto.Style;
/** /**
@ -39,6 +35,7 @@ public class VrrProvider extends AbstractEfaProvider
super(API_BASE); super(API_BASE);
setUseRouteIndexAsTripId(false); setUseRouteIndexAsTripId(false);
setIncludeRegionId(false);
setNeedsSpEncId(true); setNeedsSpEncId(true);
setStyles(STYLES); setStyles(STYLES);
} }
@ -57,12 +54,6 @@ public class VrrProvider extends AbstractEfaProvider
return false; return false;
} }
@Override
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
{
return xmlStopfinderRequest(new Location(LocationType.ANY, 0, null, constraint.toString()));
}
@Override @Override
protected String parseLine(final String mot, final String symbol, final String name, final String longName, final String trainType, protected String parseLine(final String mot, final String symbol, final String name, final String longName, final String trainType,
final String trainNum, final String trainName) final String trainNum, final String trainName)

View file

@ -17,7 +17,9 @@
package de.schildbach.pte.live; package de.schildbach.pte.live;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.util.Date; import java.util.Date;
@ -109,6 +111,30 @@ public class VrrProviderLiveTest extends AbstractProviderLiveTest
print(autocompletes); print(autocompletes);
} }
@Test
public void autocompleteCoverage() throws Exception
{
final List<Location> cologneAutocompletes = provider.autocompleteStations("Köln Ebertplatz");
print(cologneAutocompletes);
assertThat(cologneAutocompletes, hasItem(new Location(LocationType.STATION, 22000035)));
final List<Location> dortmundAutocompletes = provider.autocompleteStations("Dortmund Zugstraße");
print(dortmundAutocompletes);
assertThat(dortmundAutocompletes, hasItem(new Location(LocationType.STATION, 20000524)));
final List<Location> duesseldorfAutocompletes = provider.autocompleteStations("Düsseldorf Sternstraße");
print(duesseldorfAutocompletes);
assertThat(duesseldorfAutocompletes, hasItem(new Location(LocationType.STATION, 20018017)));
final List<Location> muensterAutocompletes = provider.autocompleteStations("Münster Vennheideweg");
print(muensterAutocompletes);
assertThat(muensterAutocompletes, hasItem(new Location(LocationType.STATION, 24047291)));
final List<Location> aachenAutocompletes = provider.autocompleteStations("Aachen Elisenbrunnen");
print(aachenAutocompletes);
assertThat(aachenAutocompletes, hasItem(new Location(LocationType.STATION, 21001029)));
}
@Test @Test
public void autocompleteCity() throws Exception public void autocompleteCity() throws Exception
{ {