/* * Copyright 2010 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 * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package de.schildbach.pte; import static junit.framework.Assert.assertTrue; import java.util.regex.Matcher; import org.junit.Test; /** * @author Andreas Schildbach */ public class VbbProviderTest { @Test public void fusswegWithSpace() { assertFineConnectionDetails("6 Min. Fussweg
" + "S Messe Nord/ICC (Berlin)
"); } @Test public void fussweg() { assertFineConnectionDetails("10405 Bln Pankow, Christburger Str. 123\n" + "
\n" + "10 Min.\n" + "Fussweg\n" + "
\n" + "\n" + "Prenzlauer Allee/Danziger Str. (Berlin)\n" + "\n" + "
"); } @Test public void trip() { assertFineConnectionDetails("\n" + "Brandenburg, Frhr.-v.-Thüngen-Str.\n" + "\n" + "
\n" + "ab 09:35\n" + "
BusH/528\n" + "Ri. Brandenburg, Potsdamer Str.\n" + "
\n" + "an 09:41\n" + "
\n" + "\n" + "Brandenburg, Plauer Str.\n" // + "\n" // + "
"); } private void assertFineConnectionDetails(String s) { Matcher m = VbbProvider.P_CONNECTION_DETAILS_FINE.matcher(s); assertTrue(m.matches()); // ParserUtils.printGroups(m); } }