Fix umlauts in suggested locations for Rhineland-Palatinate, Rhine-Neckar & Baden-Württemberg.

This commit is contained in:
Andreas Schildbach 2015-02-16 06:55:48 +01:00
parent f48c0ef60e
commit 39008afc0b
2 changed files with 21 additions and 2 deletions

View file

@ -19,6 +19,8 @@ package de.schildbach.pte;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.google.common.base.Charsets;
import de.schildbach.pte.dto.Line; import de.schildbach.pte.dto.Line;
import de.schildbach.pte.dto.Product; import de.schildbach.pte.dto.Product;
@ -27,13 +29,16 @@ import de.schildbach.pte.dto.Product;
*/ */
public class VrnProvider extends AbstractEfaProvider public class VrnProvider extends AbstractEfaProvider
{ {
private static final String API_BASE = "http://fahrplanauskunft.vrn.de/vrn_mobile/"; private static final String API_BASE = "http://fahrplanauskunft.vrn.de/vrn/";
// http://fahrplanauskunft.vrn.de/vrn_mobile/
// http://efa9.vrn.de/vrt/ // http://efa9.vrn.de/vrt/
public VrnProvider() public VrnProvider()
{ {
super(NetworkId.VRN, API_BASE); super(NetworkId.VRN, API_BASE);
setRequestUrlEncoding(Charsets.UTF_8);
} }
@Override @Override

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;
@ -85,7 +87,8 @@ public class VrnProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void suggestLocationsWithUmlaut() throws Exception public void suggestLocationsWithUmlaut() throws Exception
{ {
final SuggestLocationsResult result = suggestLocations("grün"); final SuggestLocationsResult result = suggestLocations("Käfertal");
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "6005547")));
print(result); print(result);
} }
@ -166,4 +169,15 @@ public class VrnProviderLiveTest extends AbstractProviderLiveTest
final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false); final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false);
print(earlierResult); print(earlierResult);
} }
@Test
public void tripWithUmlaut() throws Exception
{
final QueryTripsResult result = queryTrips(new Location(LocationType.ANY, null, null, "Käfertal"), null, new Location(LocationType.STATION,
"6002417", "Mannheim", "Hauptbahnhof"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result);
assertEquals(QueryTripsResult.Status.OK, result.status);
assertTrue(result.trips.size() > 0);
assertEquals(result.trips.get(0).from, new Location(LocationType.STATION, "6005547"));
}
} }