Fix autocomplete coverage for Graz.

This commit is contained in:
Andreas Schildbach 2014-02-10 10:37:58 +01:00
parent 9e0f79d063
commit a6d8ce3d7f
2 changed files with 28 additions and 12 deletions

View file

@ -17,12 +17,6 @@
package de.schildbach.pte;
import java.io.IOException;
import java.util.List;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.LocationType;
/**
* @author Andreas Schildbach
*/
@ -34,6 +28,8 @@ public class StvProvider extends AbstractEfaProvider
public StvProvider()
{
super(API_BASE);
setIncludeRegionId(false);
}
public NetworkId id()
@ -50,12 +46,6 @@ public class StvProvider extends AbstractEfaProvider
return false;
}
@Override
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
{
return xmlStopfinderRequest(new Location(LocationType.STATION, 0, null, constraint.toString()));
}
@Override
protected String parseLine(final String mot, final String symbol, final String name, final String longName, final String trainType,
final String trainNum, final String trainName)

View file

@ -17,7 +17,9 @@
package de.schildbach.pte.live;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.Date;
@ -85,6 +87,30 @@ public class StvProviderLiveTest extends AbstractProviderLiveTest
print(autocompletes);
}
@Test
public void autocompleteCoverage() throws Exception
{
final List<Location> grazAutocompletes = provider.autocompleteStations("Graz Brauhaus");
print(grazAutocompletes);
assertThat(grazAutocompletes, hasItem(new Location(LocationType.STATION, 63203044)));
final List<Location> leobenAutocompletes = provider.autocompleteStations("Leoben Blockhäuser");
print(leobenAutocompletes);
assertThat(leobenAutocompletes, hasItem(new Location(LocationType.STATION, 63206224)));
final List<Location> bruckAutocompletes = provider.autocompleteStations("Bruck Hauptplatz");
print(bruckAutocompletes);
assertThat(bruckAutocompletes, hasItem(new Location(LocationType.STATION, 63202063)));
final List<Location> kindbergAutocompletes = provider.autocompleteStations("Kindberg Friedhof");
print(kindbergAutocompletes);
assertThat(kindbergAutocompletes, hasItem(new Location(LocationType.STATION, 63208877)));
final List<Location> mariborAutocompletes = provider.autocompleteStations("Maribor Dravograjska Sokolska");
print(mariborAutocompletes);
assertThat(mariborAutocompletes, hasItem(new Location(LocationType.STATION, 63300136)));
}
@Test
public void shortTrip() throws Exception
{