From 34487194d9526f6bf3b7e04cfb34bb96ffaed9a4 Mon Sep 17 00:00:00 2001 From: full-duplex Date: Sat, 22 Sep 2018 11:42:16 +0200 Subject: [PATCH] Negentwee: Fix 'type' parameter name. --- enabler/src/de/schildbach/pte/NegentweeProvider.java | 4 ++-- .../de/schildbach/pte/live/NegentweeProviderLiveTest.java | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/enabler/src/de/schildbach/pte/NegentweeProvider.java b/enabler/src/de/schildbach/pte/NegentweeProvider.java index 105b9175..fd3e1e42 100644 --- a/enabler/src/de/schildbach/pte/NegentweeProvider.java +++ b/enabler/src/de/schildbach/pte/NegentweeProvider.java @@ -212,7 +212,7 @@ public class NegentweeProvider extends AbstractNetworkProvider { // Add types if specified String locationTypes = locationTypesToQueryParameterString(types); if (locationTypes.length() > 0) - queryParameters.add(new QueryParameter("types", locationTypes)); + queryParameters.add(new QueryParameter("type", locationTypes)); HttpUrl url = buildApiUrl("locations", queryParameters); final CharSequence page = httpClient.get(url); @@ -724,7 +724,7 @@ public class NegentweeProvider extends AbstractNetworkProvider { // Add types if specified String locationTypes = locationTypesToQueryParameterString(types); if (locationTypes.length() > 0) - queryParameters.add(new QueryParameter("types", locationTypes)); + queryParameters.add(new QueryParameter("type", locationTypes)); HttpUrl url = buildApiUrl("locations", queryParameters); diff --git a/enabler/test/de/schildbach/pte/live/NegentweeProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/NegentweeProviderLiveTest.java index e1a9465e..c8926c2f 100644 --- a/enabler/test/de/schildbach/pte/live/NegentweeProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/NegentweeProviderLiveTest.java @@ -18,6 +18,7 @@ package de.schildbach.pte.live; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.util.Date; @@ -49,6 +50,13 @@ public class NegentweeProviderLiveTest extends AbstractProviderLiveTest { new Location(LocationType.STATION, "station-amsterdam-centraal")); print(result); assertEquals(NearbyLocationsResult.Status.OK, result.status); + + // Assert that queryNearbyStations only returns STATION locations + assertNotNull(result.locations); + assertTrue(result.locations.size() > 0); + for (Location location : result.locations) { + assertEquals(location.type, LocationType.STATION); + } } @Test