mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-16 01:19:49 +00:00
Testcases.
This commit is contained in:
parent
62d84eaf33
commit
5cc1956f99
9 changed files with 104 additions and 26 deletions
|
@ -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;
|
||||
|
@ -76,8 +78,13 @@ public class AvvProviderLiveTest extends AbstractProviderLiveTest
|
|||
@Test
|
||||
public void suggestLocationsWithUmlaut() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("grünwink");
|
||||
print(result);
|
||||
final SuggestLocationsResult result1 = suggestLocations("Barfüßerbrücke");
|
||||
print(result1);
|
||||
assertThat(result1.getLocations(), hasItem(new Location(LocationType.STATION, "131")));
|
||||
|
||||
final SuggestLocationsResult result2 = suggestLocations("Gärtnerstraße");
|
||||
print(result2);
|
||||
assertThat(result2.getLocations(), hasItem(new Location(LocationType.STATION, "557")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -171,6 +171,24 @@ public class BahnProviderLiveTest extends AbstractProviderLiveTest
|
|||
print(laterResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tripsAcrossBorder() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8506131", null, "Kreuzlingen"), null, new Location(
|
||||
LocationType.STATION, "8003400", null, "Konstanz"), new Date(), true, EnumSet.of(Product.BUS), WalkSpeed.NORMAL,
|
||||
Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
assertEquals(QueryTripsResult.Status.OK, result.status);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tripsByCoordinate() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(Location.coord(52535576, 13422171), null, Location.coord(52525589, 13369548), new Date(), true,
|
||||
Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tripsTooClose() throws Exception
|
||||
{
|
||||
|
|
|
@ -123,6 +123,10 @@ public class BayernProviderLiveTest extends AbstractProviderLiveTest
|
|||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "80000793", "München", "Ostbahnhof"), null, new Location(
|
||||
LocationType.STATION, "80000799", "München", "Pasing"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
@ -143,6 +147,10 @@ public class BayernProviderLiveTest extends AbstractProviderLiveTest
|
|||
final QueryTripsResult result = queryTrips(Location.coord(48165238, 11577473), null, Location.coord(47987199, 11326532), new Date(), true,
|
||||
Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
@ -153,6 +161,10 @@ public class BayernProviderLiveTest extends AbstractProviderLiveTest
|
|||
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 48238341, 11478230), null, new Location(
|
||||
LocationType.STATION, "80000793", "München", "Ostbahnhof"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
@ -163,6 +175,10 @@ public class BayernProviderLiveTest extends AbstractProviderLiveTest
|
|||
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, null, "München, Maximilianstr. 1"), null, new Location(
|
||||
LocationType.ADDRESS, null, null, "Starnberg, Jahnstraße 50"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
@ -174,6 +190,10 @@ public class BayernProviderLiveTest extends AbstractProviderLiveTest
|
|||
LocationType.ADDRESS, null, 48188018, 11574239, null, "München Frankfurter Ring 35"), new Date(), true, Product.ALL,
|
||||
WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
@ -185,6 +205,10 @@ public class BayernProviderLiveTest extends AbstractProviderLiveTest
|
|||
new Location(LocationType.POI, null, 47738372, 12630996, null, "Ruhpolding, Unternberg-Bahn"), new Date(), true, Product.ALL,
|
||||
WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
|
|
@ -78,8 +78,9 @@ public class BsvagProviderLiveTest extends AbstractProviderLiveTest
|
|||
@Test
|
||||
public void suggestLocationsWithUmlaut() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("grün");
|
||||
final SuggestLocationsResult result = suggestLocations("Münzstraße");
|
||||
print(result);
|
||||
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "26000300")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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;
|
||||
|
@ -83,8 +85,13 @@ public class DingProviderLiveTest extends AbstractProviderLiveTest
|
|||
@Test
|
||||
public void suggestLocationsWithUmlaut() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("grün");
|
||||
print(result);
|
||||
final SuggestLocationsResult result1 = suggestLocations("Schießstände");
|
||||
print(result1);
|
||||
assertThat(result1.getLocations(), hasItem(new Location(LocationType.STATION, "9001233")));
|
||||
|
||||
final SuggestLocationsResult result2 = suggestLocations("Blücherstraße");
|
||||
print(result2);
|
||||
assertThat(result2.getLocations(), hasItem(new Location(LocationType.STATION, "9001351")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -34,6 +34,7 @@ import de.schildbach.pte.dto.Product;
|
|||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||
import de.schildbach.pte.dto.QueryTripsResult;
|
||||
import de.schildbach.pte.dto.SuggestLocationsResult;
|
||||
import de.schildbach.pte.util.Iso8601Format;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
|
@ -102,10 +103,12 @@ public class NasaProviderLiveTest extends AbstractProviderLiveTest
|
|||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "11063", null, "Leipzig, Johannisplatz"), null, new Location(
|
||||
LocationType.STATION, "8010205", null, "Leipzig Hbf"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
assertEquals(QueryTripsResult.Status.OK, result.status);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
@ -116,10 +119,12 @@ public class NasaProviderLiveTest extends AbstractProviderLiveTest
|
|||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8010205", 51346546, 12383333, null, "Leipzig Hbf"), null,
|
||||
new Location(LocationType.STATION, "8012183", 51423340, 12223423, null, "Leipzig/Halle Flughafen"), new Date(), true, Product.ALL,
|
||||
WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
assertEquals(QueryTripsResult.Status.OK, result.status);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
@ -128,14 +133,9 @@ public class NasaProviderLiveTest extends AbstractProviderLiveTest
|
|||
public void outdatedTrip() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "13002", null, "Leipzig, Augustusplatz"), null, new Location(
|
||||
LocationType.STATION, "8010205", null, "Leipzig Hbf"), new Date(2011, 1, 1), true, Product.ALL, WalkSpeed.NORMAL,
|
||||
Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
LocationType.STATION, "8010205", null, "Leipzig Hbf"), Iso8601Format.newDateFormat().parse("2011-01-01"), true, Product.ALL,
|
||||
WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
assertEquals(QueryTripsResult.Status.INVALID_DATE, result.status);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -143,12 +143,8 @@ public class NasaProviderLiveTest extends AbstractProviderLiveTest
|
|||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.ANY, null, null, "Platz"), null, new Location(LocationType.STATION,
|
||||
"8010205", null, "Leipzig Hbf"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
assertEquals(QueryTripsResult.Status.AMBIGUOUS, result.status);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -156,12 +152,7 @@ public class NasaProviderLiveTest extends AbstractProviderLiveTest
|
|||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8010205", null, "Leipzig Hbf"), null, new Location(
|
||||
LocationType.STATION, "8010205", null, "Leipzig Hbf"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
assertEquals(QueryTripsResult.Status.TOO_CLOSE, result.status);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -170,10 +161,12 @@ public class NasaProviderLiveTest extends AbstractProviderLiveTest
|
|||
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 51334078, 12478331, "04319 Leipzig-Engelsdorf",
|
||||
"August-Bebel-Platz"), null, new Location(LocationType.STATION, "8010205", null, "Leipzig Hbf"), new Date(), true, Product.ALL,
|
||||
WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
assertEquals(QueryTripsResult.Status.OK, result.status);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
|
|
@ -85,6 +85,10 @@ public class SeptaProviderLiveTest extends AbstractProviderLiveTest
|
|||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "1021532", null, "30th St Station"), null, new Location(
|
||||
LocationType.STATION, "1001392", null, "15th St Station"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
@ -96,6 +100,10 @@ public class SeptaProviderLiveTest extends AbstractProviderLiveTest
|
|||
new Location(LocationType.ADDRESS, null, 40015670, -75209400, "Philadelphia 19127", "3601 Main St"), null, new Location(
|
||||
LocationType.STATION, "2090227", null, "Main Street"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
package de.schildbach.pte.live;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.hasItem;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -73,8 +76,13 @@ public class VgnProviderLiveTest extends AbstractProviderLiveTest
|
|||
@Test
|
||||
public void suggestLocationsWithUmlaut() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("grün");
|
||||
print(result);
|
||||
final SuggestLocationsResult result1 = suggestLocations("Dürrenhof");
|
||||
print(result1);
|
||||
assertThat(result1.getLocations(), hasItem(new Location(LocationType.STATION, "3000427")));
|
||||
|
||||
final SuggestLocationsResult result2 = suggestLocations("Röthenbach");
|
||||
print(result2);
|
||||
assertThat(result2.getLocations(), hasItem(new Location(LocationType.STATION, "3001970")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -88,4 +88,16 @@ public class ZvvProviderLiveTest extends AbstractProviderLiveTest
|
|||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void trip() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(
|
||||
new Location(LocationType.STATION, "8503000", 47378491, 8537945, "Zürich", "Zürich, Hauptbahnhof"), null, new Location(
|
||||
LocationType.STATION, "8530812", 47361762, 8560715, "Zürich", "Hegibachplatz"), new Date(), true, Product.ALL,
|
||||
WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue