Changeset 33070 in osm for applications/editors/josm/plugins
- Timestamp:
- 2016-11-17T23:29:10+01:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/wikipedia
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaApp.java
r33066 r33070 216 216 final String wikidata = X_PATH.evaluateString("./@id", node); 217 217 final String wikipedia = X_PATH.evaluateString("./sitelinks/sitelink/@title", node); 218 r.put(wikipedia, wikidata); 218 if (WIKIDATA_PATTERN.matcher(wikidata).matches()) { // non existing entries result in negative integers 219 r.put(wikipedia, wikidata); 220 } 219 221 }); 220 222 } -
applications/editors/josm/plugins/wikipedia/test/unit/org/wikipedia/WikipediaAppTest.java
r33066 r33070 8 8 import org.wikipedia.data.WikipediaEntry; 9 9 10 import java.util.ArrayList;11 10 import java.util.Arrays; 12 11 import java.util.Collection; … … 116 115 assertThat(map.get("Völs, Tyrol"), is("Q278250")); 117 116 assertThat(map.get("a-non-existing-article"), nullValue()); 118 assertThat(map.size(), is( 4));117 assertThat(map.size(), is(3)); 119 118 } 120 119 … … 124 123 Stream.iterate("London", x -> x).limit(100).collect(Collectors.toList())); 125 124 assertThat(map, is(Collections.singletonMap("London", "Q84"))); 125 final List<String> articles = IntStream.range(0, 200) 126 .mapToObj(i -> "a-non-existing-article-" + i) 127 .collect(Collectors.toList()); 128 assertTrue(WikipediaApp.getWikidataForArticles("en", articles).isEmpty()); 126 129 } 127 130
Note:
See TracChangeset
for help on using the changeset viewer.