Ignore:
Timestamp:
2016-07-10T22:57:01+02:00 (9 years ago)
Author:
simon04
Message:

JOSM/wikipedia: query Wikidata description - #josm12039

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wikipedia/test/unit/org/wikipedia/WikipediaAppTest.java

    r32625 r32626  
    151151    @Test
    152152    public void testForQuery() throws Exception {
    153         final List<WikipediaApp.WikidataEntry> entries = WikipediaApp.getWikidataEntriesForQuery("de", "Österreich");
    154         assertThat(entries.get(0).wikipediaArticle, is("Q40"));
    155         assertThat(entries.get(0).wikipediaLang, is("wikidata"));
    156         // assertThat(entries.get(0).label, is("Österreich"));
     153        final List<WikipediaApp.WikidataEntry> de = WikipediaApp.getWikidataEntriesForQuery("de", "Österreich", Locale.GERMAN);
     154        final List<WikipediaApp.WikidataEntry> en = WikipediaApp.getWikidataEntriesForQuery("de", "Österreich", Locale.ENGLISH);
     155        assertThat(de.get(0).wikipediaArticle, is("Q40"));
     156        assertThat(de.get(0).wikipediaLang, is("wikidata"));
     157        assertThat(de.get(0).label, is("Österreich"));
     158        assertThat(de.get(0).description, is("Staat in Mitteleuropa"));
     159        assertThat(en.get(0).label, is("Austria"));
     160        assertThat(en.get(0).description, is("country in Central Europe"));
    157161    }
    158162
     
    188192        // not found -> null
    189193        assertThat(WikipediaApp.getLabelForWikidata("Q" + Long.MAX_VALUE, Locale.ENGLISH), nullValue());
    190         final Map<String, String> twoLabels = WikipediaApp.getLabelForWikidata(Arrays.asList("Q84", "Q1741"), Locale.GERMAN);
    191         assertThat(twoLabels.get("Q84"), is("London"));
    192         assertThat(twoLabels.get("Q1741"), is("Wien"));
     194        final WikipediaApp.WikidataEntry q84 = new WikipediaApp.WikidataEntry("Q84", null, null, null);
     195        final WikipediaApp.WikidataEntry q1741 = new WikipediaApp.WikidataEntry("Q1741", null, null, null);
     196        final List<WikipediaApp.WikidataEntry> twoLabels = WikipediaApp.getLabelForWikidata(Arrays.asList(q84, q1741), Locale.GERMAN);
     197        assertThat(twoLabels.get(0).label, is("London"));
     198        assertThat(twoLabels.get(1).label, is("Wien"));
    193199    }
    194200
Note: See TracChangeset for help on using the changeset viewer.