mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 16:20:34 +00:00
DSB: Normalize a bus name. Also fix a test in DsbProviderLiveTest.
This commit is contained in:
parent
1c7a208817
commit
3b38a48bff
2 changed files with 16 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2010-2015 the original author or authors.
|
||||
* Copyright 2010-2017 the original author or authors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -19,6 +19,7 @@ package de.schildbach.pte;
|
|||
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import de.schildbach.pte.dto.Product;
|
||||
|
||||
|
@ -99,4 +100,17 @@ public class DsbProvider extends AbstractHafasLegacyProvider {
|
|||
|
||||
return super.normalizeType(type);
|
||||
}
|
||||
|
||||
// Busses line name is formatted as "42#Bus 42" but we just want "42"
|
||||
private static final Pattern P_NORMALIZE_LINE_NAME_BUS_DSB = Pattern.compile(".*?#Bus (.*)",
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
|
||||
@Override
|
||||
protected String normalizeLineName(final String lineName) {
|
||||
final Matcher mBus = P_NORMALIZE_LINE_NAME_BUS_DSB.matcher(lineName);
|
||||
if (mBus.matches())
|
||||
return mBus.group(1);
|
||||
|
||||
return super.normalizeLineName(lineName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class DsbProviderLiveTest extends AbstractProviderLiveTest {
|
|||
public void shortTrip() throws Exception {
|
||||
final QueryTripsResult result = queryTrips(
|
||||
new Location(LocationType.STATION, "900000011", null, "Copenhagen Airport"), null,
|
||||
new Location(LocationType.STATION, "551922500", null, "Billund Airport"), new Date(), true, Product.ALL,
|
||||
new Location(LocationType.POI, "551922500", null, "Billund Airport"), new Date(), true, Product.ALL,
|
||||
WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue