Search in sources :

Example 6 with Listing

use of org.wikivoyage.listings.entity.Listing in project wikivoyage-listings by baturin.

the class InputTests method caseInsensitiveListingNames.

@Test
public void caseInsensitiveListingNames() throws Exception {
    Listing poi = parseResourceSinglePOI("case-insensitive-templates.wikicode");
    Assert.assertEquals("Черниговская областная филармония", poi.getTitle());
}
Also used : Listing(org.wikivoyage.listings.entity.Listing) Test(org.junit.Test)

Example 7 with Listing

use of org.wikivoyage.listings.entity.Listing in project wikivoyage-listings by baturin.

the class InputTests method skipDeadLinks.

@Test
public void skipDeadLinks() throws Exception {
    Listing poi = parseResourceSinglePOI("dead-link.wikicode");
    Assert.assertEquals("http://www.isbryderen-elbjorn.dk", poi.getUrl());
}
Also used : Listing(org.wikivoyage.listings.entity.Listing) Test(org.junit.Test)

Example 8 with Listing

use of org.wikivoyage.listings.entity.Listing in project wikivoyage-listings by baturin.

the class InputTests method processFrench.

@Test
public void processFrench() throws Exception {
    List<Listing> pois = parseResourcePOIs("sample-article-fr.wikicode", new French(), "Thouars");
    // Check number of POIs
    Assert.assertEquals(28, pois.size());
    // Check a particular POI in detail
    Listing poi = pois.get(25);
    Assert.assertEquals("Thouars", poi.getArticle());
    Assert.assertEquals("sleep", poi.getType());
    Assert.assertEquals("Camping municipal", poi.getTitle());
    Assert.assertEquals("", poi.getAlt());
    Assert.assertEquals("13 Rue de la Grande Côte de Crevant", poi.getAddress());
    Assert.assertEquals("", poi.getDirections());
    Assert.assertEquals("+33 5 49 66 17 99", poi.getPhone());
    Assert.assertEquals("", poi.getTollFree());
    Assert.assertEquals("", poi.getEmail());
    Assert.assertEquals("", poi.getFax());
    Assert.assertEquals("http://www.ville-thouars.fr/decouvrir/camping.htm", poi.getUrl());
    Assert.assertEquals("", poi.getHours());
    Assert.assertEquals("", poi.getCheckIn());
    Assert.assertEquals("", poi.getCheckOut());
    Assert.assertEquals("", poi.getImage());
    Assert.assertEquals("3.2€", poi.getPrice());
    Assert.assertEquals("46.979967", poi.getLatitude());
    Assert.assertEquals("-0.219622", poi.getLongitude());
    Assert.assertEquals("Situé au bord de la rivière, immédiatement en contrebas du Parc Imbert et du vieux " + "centre ville. 9 h - 12 h et 15 h 30 - 19 h 30, seulement l'été.", poi.getDescription());
}
Also used : French(org.wikivoyage.listings.language.french.French) Listing(org.wikivoyage.listings.entity.Listing) Test(org.junit.Test)

Example 9 with Listing

use of org.wikivoyage.listings.entity.Listing in project wikivoyage-listings by baturin.

the class InputTests method processRussianRoadTemplate.

@Test
public void processRussianRoadTemplate() throws Exception {
    Listing poi = parseResourceSinglePOI("russian-road-template.wikicode", new Russian());
    Assert.assertEquals("На 38 км Ново-Рижского шоссе М9 (19 км от МКАД) " + "свернуть по указателю на пирамиду.", poi.getDirections());
}
Also used : Russian(org.wikivoyage.listings.language.russian.Russian) Listing(org.wikivoyage.listings.entity.Listing) Test(org.junit.Test)

Example 10 with Listing

use of org.wikivoyage.listings.entity.Listing in project wikivoyage-listings by baturin.

the class InputTests method processEnglish.

@Test
public void processEnglish() throws Exception {
    List<Listing> pois = parseResourcePOIs("sample-article-en.wikicode", new English(), "Tokyo/Roppongi");
    // Check number of POIs
    Assert.assertEquals(71, pois.size());
    // Check a particular POI in detail
    Listing poi = pois.get(68);
    Assert.assertEquals("Tokyo/Roppongi", poi.getArticle());
    Assert.assertEquals("sleep", poi.getType());
    Assert.assertEquals("Grand Hyatt Tokyo", poi.getTitle());
    Assert.assertEquals("", poi.getAlt());
    Assert.assertEquals("6-10-3 Roppongi", poi.getAddress());
    Assert.assertEquals("In Roppongi Hills", poi.getDirections());
    Assert.assertEquals("+81 3 4333-1234", poi.getPhone());
    Assert.assertEquals("", poi.getTollFree());
    Assert.assertEquals("", poi.getEmail());
    Assert.assertEquals("+81 3 4333-8123", poi.getFax());
    Assert.assertEquals("http://tokyo.grand.hyatt.com/", poi.getUrl());
    Assert.assertEquals("", poi.getHours());
    Assert.assertEquals("15:00", poi.getCheckIn());
    Assert.assertEquals("12:00", poi.getCheckOut());
    Assert.assertEquals("Grand Hyatt Tokyo.JPG", poi.getImage());
    Assert.assertEquals("Rack rates marginally cheaper than the Park Hyatt at ¥37,000 and up", poi.getPrice());
    Assert.assertEquals("35.65968", poi.getLatitude());
    Assert.assertEquals("139.72814", poi.getLongitude());
    Assert.assertEquals("A part of Roppongi Hills, and not to be confused with the more famous Park Hyatt " + "of ''Lost in Translation'' fame, which is in Shinjuku. Sleek and minimalistic, " + "all black, gray and brown, with expensive design that never hesitates to sacrifice " + "function for form, but the superlative service makes up for it.", poi.getDescription());
}
Also used : English(org.wikivoyage.listings.language.english.English) Listing(org.wikivoyage.listings.entity.Listing) Test(org.junit.Test)

Aggregations

Listing (org.wikivoyage.listings.entity.Listing)30 Test (org.junit.Test)16 XMLSimpleNode (org.wikivoyage.listings.utils.XMLSimpleNode)5 BufferedWriter (java.io.BufferedWriter)3 FileWriter (java.io.FileWriter)3 IOException (java.io.IOException)3 French (org.wikivoyage.listings.language.french.French)3 WebsiteURLValidator (org.wikivoyage.listings.validators.WebsiteURLValidator)3 LinkedList (java.util.LinkedList)2 EmailValidator (org.wikivoyage.listings.validators.EmailValidator)2 WikidataValidator (org.wikivoyage.listings.validators.WikidataValidator)2 FileOutputStream (java.io.FileOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 ArrayList (java.util.ArrayList)1 NoSuchElementException (java.util.NoSuchElementException)1 ParserConfig (org.sweble.wikitext.parser.ParserConfig)1 WikitextPreprocessor (org.sweble.wikitext.parser.WikitextPreprocessor)1 WtNode (org.sweble.wikitext.parser.nodes.WtNode)1 SimpleParserConfig (org.sweble.wikitext.parser.utils.SimpleParserConfig)1 StringConversionException (org.sweble.wikitext.parser.utils.StringConversionException)1