mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-15 09:00:36 +00:00
Fix and add tests for Berlin & Brandenburg.
Conflicts: enabler/test/de/schildbach/pte/live/BvgProviderLiveTest.java enabler/test/de/schildbach/pte/live/VbbProviderLiveTest.java
This commit is contained in:
parent
696498cbca
commit
c1691a7e71
2 changed files with 24 additions and 21 deletions
|
@ -17,11 +17,12 @@
|
||||||
|
|
||||||
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 java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import de.schildbach.pte.BvgProvider;
|
import de.schildbach.pte.BvgProvider;
|
||||||
|
@ -91,37 +92,38 @@ public class BvgProviderLiveTest extends AbstractProviderLiveTest
|
||||||
public void suggestLocationsUmlaut() throws Exception
|
public void suggestLocationsUmlaut() throws Exception
|
||||||
{
|
{
|
||||||
final SuggestLocationsResult result = suggestLocations("Güntzelstr.");
|
final SuggestLocationsResult result = suggestLocations("Güntzelstr.");
|
||||||
|
|
||||||
print(result);
|
print(result);
|
||||||
|
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "9043201", "Berlin", "U Güntzelstr.")));
|
||||||
Assert.assertEquals("Güntzelstr. (U)", result.getLocations().get(0).name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void suggestLocationsLocality() throws Exception
|
public void suggestLocationsLocality() throws Exception
|
||||||
{
|
{
|
||||||
final SuggestLocationsResult result = suggestLocations("seeling");
|
final SuggestLocationsResult result = suggestLocations("seeling");
|
||||||
|
|
||||||
print(result);
|
print(result);
|
||||||
|
assertEquals(new Location(LocationType.STATION, null, "Berlin", "Seelingstr."), result.getLocations().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
Assert.assertEquals(new Location(LocationType.STATION, null, "Berlin", "Seelingstr."), result.getLocations().get(0));
|
@Test
|
||||||
|
public void suggestLocationsPOI() throws Exception
|
||||||
|
{
|
||||||
|
final SuggestLocationsResult result = suggestLocations("schwules museum");
|
||||||
|
print(result);
|
||||||
|
assertThat(result.getLocations(), hasItem(new Location(LocationType.POI, "9980141")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void suggestLocationsAddress() throws Exception
|
public void suggestLocationsAddress() throws Exception
|
||||||
{
|
{
|
||||||
final SuggestLocationsResult result = suggestLocations("Berlin, Sophienstr. 24");
|
final SuggestLocationsResult result = suggestLocations("Berlin, Sophienstr. 24");
|
||||||
|
|
||||||
print(result);
|
print(result);
|
||||||
|
assertEquals("Sophienstr. 24", result.getLocations().get(0).name);
|
||||||
Assert.assertEquals("Sophienstr. 24", result.getLocations().get(0).name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void suggestLocationsIncomplete() throws Exception
|
public void suggestLocationsIncomplete() throws Exception
|
||||||
{
|
{
|
||||||
final SuggestLocationsResult result = suggestLocations("nol");
|
final SuggestLocationsResult result = suggestLocations("nol");
|
||||||
|
|
||||||
print(result);
|
print(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.assertTrue;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -49,7 +51,6 @@ public class VbbProviderLiveTest extends AbstractProviderLiveTest
|
||||||
public void nearbyStations() throws Exception
|
public void nearbyStations() throws Exception
|
||||||
{
|
{
|
||||||
final NearbyStationsResult result = queryNearbyStations(new Location(LocationType.STATION, "9007102"));
|
final NearbyStationsResult result = queryNearbyStations(new Location(LocationType.STATION, "9007102"));
|
||||||
|
|
||||||
print(result);
|
print(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,16 +64,15 @@ public class VbbProviderLiveTest extends AbstractProviderLiveTest
|
||||||
@Test
|
@Test
|
||||||
public void nearbyStationsByCoordinate() throws Exception
|
public void nearbyStationsByCoordinate() throws Exception
|
||||||
{
|
{
|
||||||
final NearbyStationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 52548505, 1338864));
|
final NearbyStationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 52548505, 13388640));
|
||||||
|
|
||||||
print(result);
|
print(result);
|
||||||
|
assertTrue(result.stations.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void queryDepartures() throws Exception
|
public void queryDepartures() throws Exception
|
||||||
{
|
{
|
||||||
final QueryDeparturesResult result = queryDepartures("9007102", false);
|
final QueryDeparturesResult result = queryDepartures("9007102", false);
|
||||||
|
|
||||||
print(result);
|
print(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +90,7 @@ public class VbbProviderLiveTest extends AbstractProviderLiveTest
|
||||||
public void suggestLocations() throws Exception
|
public void suggestLocations() throws Exception
|
||||||
{
|
{
|
||||||
final SuggestLocationsResult result = suggestLocations("Haubachstr.");
|
final SuggestLocationsResult result = suggestLocations("Haubachstr.");
|
||||||
|
|
||||||
print(result);
|
print(result);
|
||||||
|
|
||||||
Assert.assertEquals("Haubachstr.", result.getLocations().get(0).name);
|
Assert.assertEquals("Haubachstr.", result.getLocations().get(0).name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,19 +98,23 @@ public class VbbProviderLiveTest extends AbstractProviderLiveTest
|
||||||
public void suggestLocationsUmlaut() throws Exception
|
public void suggestLocationsUmlaut() throws Exception
|
||||||
{
|
{
|
||||||
final SuggestLocationsResult result = suggestLocations("Güntzelstr.");
|
final SuggestLocationsResult result = suggestLocations("Güntzelstr.");
|
||||||
|
|
||||||
print(result);
|
print(result);
|
||||||
|
Assert.assertEquals("U Güntzelstr.", result.getLocations().get(0).name);
|
||||||
|
}
|
||||||
|
|
||||||
Assert.assertEquals("Güntzelstr. (U)", result.getLocations().get(0).name);
|
@Test
|
||||||
|
public void suggestLocationsPOI() throws Exception
|
||||||
|
{
|
||||||
|
final SuggestLocationsResult result = suggestLocations("schwules museum");
|
||||||
|
print(result);
|
||||||
|
Assert.assertThat(result.getLocations(), hasItem(new Location(LocationType.POI, "9980141")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void suggestLocationsAddress() throws Exception
|
public void suggestLocationsAddress() throws Exception
|
||||||
{
|
{
|
||||||
final SuggestLocationsResult result = suggestLocations("Sophienstr. 24");
|
final SuggestLocationsResult result = suggestLocations("Sophienstr. 24");
|
||||||
|
|
||||||
print(result);
|
print(result);
|
||||||
|
|
||||||
Assert.assertEquals("Sophienstr. 24", result.getLocations().get(0).name);
|
Assert.assertEquals("Sophienstr. 24", result.getLocations().get(0).name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +122,6 @@ public class VbbProviderLiveTest extends AbstractProviderLiveTest
|
||||||
public void suggestLocationsIncomplete() throws Exception
|
public void suggestLocationsIncomplete() throws Exception
|
||||||
{
|
{
|
||||||
final SuggestLocationsResult result = suggestLocations("nol");
|
final SuggestLocationsResult result = suggestLocations("nol");
|
||||||
|
|
||||||
print(result);
|
print(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue