Ignore:
Timestamp:
2015-12-22T21:35:16+01:00 (9 years ago)
Author:
simon04
Message:

JOSM/wikipedia: Add FetchWikidataAction - see #josm10148

This action allows to fetch Wikidata IDs using wikipedia tags.

The icon (license: public domain) is taken from
https://commons.wikimedia.org/wiki/File:Wikidata-logo-without-paddings.svg

File:
1 edited

Legend:

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

    r31847 r31852  
    1313import java.util.Collection;
    1414import java.util.List;
     15import java.util.Map;
    1516
    1617import static org.hamcrest.CoreMatchers.hasItem;
     
    131132        }));
    132133    }
     134
     135    @Test
     136    public void testGetWikidataForArticles() throws Exception {
     137        final Map<String, String> map = WikipediaApp.getWikidataForArticles("en",
     138                Arrays.asList("London", "Vienna", "Völs, Tyrol", "a-non-existing-article"));
     139        assertThat(map.get("London"), is("Q84"));
     140        assertThat(map.get("Vienna"), is("Q1741"));
     141        assertThat(map.get("Völs, Tyrol"), is("Q278250"));
     142        assertThat(map.get("a-non-existing-article"), nullValue());
     143        assertThat(map.size(), is(4));
     144    }
    133145}
Note: See TracChangeset for help on using the changeset viewer.