From af646c7e799f3bf82250f1917b11067cb5b9679e Mon Sep 17 00:00:00 2001 From: "andreas.schildbach" Date: Sun, 8 Aug 2010 19:50:54 +0000 Subject: [PATCH] fixed footways without link git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@53 0924bc21-9374-b0fa-ee44-9ff1593b38f0 --- src/de/schildbach/pte/VbbProvider.java | 4 +-- test/de/schildbach/pte/VbbProviderTest.java | 36 +++++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/de/schildbach/pte/VbbProvider.java b/src/de/schildbach/pte/VbbProvider.java index dc736124..bcff849b 100644 --- a/src/de/schildbach/pte/VbbProvider.java +++ b/src/de/schildbach/pte/VbbProvider.java @@ -306,7 +306,7 @@ public final class VbbProvider implements NetworkProvider + "(\\d+) Min\\.[\n\\s]?" // footway + "Fussweg\n?" // + ".*?(?:\n?" // arrivalId - + "(.*?)|(\\w.*?)).*?" // arrival + + "(.*?)|(\\w.*?)|(.*?)).*?" // arrival + ").*?", Pattern.DOTALL); public GetConnectionDetailsResult getConnectionDetails(final String uri) throws IOException @@ -387,7 +387,7 @@ public final class VbbProvider implements NetworkProvider { final int arrivalId = mDetFine.group(12) != null ? Integer.parseInt(mDetFine.group(12)) : 0; - final String arrival = ParserUtils.resolveEntities(selectNotNull(mDetFine.group(13), mDetFine.group(14))); + final String arrival = ParserUtils.resolveEntities(selectNotNull(mDetFine.group(13), mDetFine.group(14), mDetFine.group(15))); if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway) { diff --git a/test/de/schildbach/pte/VbbProviderTest.java b/test/de/schildbach/pte/VbbProviderTest.java index 5b92901c..135b84bf 100644 --- a/test/de/schildbach/pte/VbbProviderTest.java +++ b/test/de/schildbach/pte/VbbProviderTest.java @@ -29,14 +29,7 @@ import org.junit.Test; public class VbbProviderTest { @Test - public void fusswegWithSpace() - { - assertFineConnectionDetails("6 Min. Fussweg
" - + "S Messe Nord/ICC (Berlin)
"); - } - - @Test - public void fussweg() + public void footwayWithLink() { assertFineConnectionDetails("10405 Bln Pankow, Christburger Str. 123\n" + "
\n" @@ -44,7 +37,32 @@ public class VbbProviderTest + "Fussweg\n" + "
\n" + "\n" - + "Prenzlauer Allee/Danziger Str. (Berlin)\n" + "\n" + "
"); + + "Prenzlauer Allee/Danziger Str. (Berlin)\n" // + + "\n" // + + "
"); + } + + @Test + public void footwayWithoutLink() + { + assertFineConnectionDetails("18 Min.\n" // + + "Fussweg\n" // + + "
\n" // + + "Berlin, Deutschlandhalle\n" // + + "
Messedamm 26; 14055 Berlin\n" // + + "
"); // + } + + @Test + public void footwayStripped() + { + assertFineConnectionDetails("6 Min. " // + + "Fussweg" // + + "
" // + + "" // + + "S Messe Nord/ICC (Berlin) "// + + "" // + + "
"); } @Test