Changeset 33075 in osm for applications/editors/josm/plugins/wikipedia/test/unit
- Timestamp:
- 2016-11-18T20:00:49+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wikipedia/test/unit/org/wikipedia/WikipediaAppTest.java
r33070 r33075 55 55 @Test 56 56 public void testGetInterwikiArticles1() { 57 final Collection<WikipediaEntry> iw = WikipediaApp. getInterwikiArticles("de","Österreich");57 final Collection<WikipediaEntry> iw = WikipediaApp.forLanguage("de").getInterwikiArticles("Österreich"); 58 58 assertThat(iw, hasItem(new WikipediaEntry("en", "Austria"))); 59 59 assertThat(iw, hasItem(new WikipediaEntry("no", "Østerrike"))); … … 63 63 @Test 64 64 public void testGetInterwikiArticles2() { 65 final Collection<WikipediaEntry> iw = WikipediaApp. getInterwikiArticles("en","Ampersand");65 final Collection<WikipediaEntry> iw = WikipediaApp.forLanguage("en").getInterwikiArticles("Ampersand"); 66 66 assertThat(iw, hasItem(new WikipediaEntry("fi", "&"))); 67 67 } … … 69 69 @Test 70 70 public void testGetCoordinates() throws Exception { 71 assertThat(WikipediaApp. getCoordinateForArticle("de","Marchreisenspitze"), is(new LatLon(47.1725, 11.30833333)));72 assertThat(WikipediaApp. getCoordinateForArticle("en","Austria"), is(new LatLon(47.33333333, 13.33333333)));73 assertThat(WikipediaApp. getCoordinateForArticle("en","Foobar2000"), nullValue());71 assertThat(WikipediaApp.forLanguage("de").getCoordinateForArticle("Marchreisenspitze"), is(new LatLon(47.1725, 11.30833333))); 72 assertThat(WikipediaApp.forLanguage("en").getCoordinateForArticle("Austria"), is(new LatLon(47.33333333, 13.33333333))); 73 assertThat(WikipediaApp.forLanguage("en").getCoordinateForArticle("Foobar2000"), nullValue()); 74 74 } 75 75 76 76 @Test 77 77 public void testFromCoordinates() throws Exception { 78 final List<WikipediaEntry> entries = WikipediaApp. getEntriesFromCoordinates("de",79 new LatLon(52.5179786, 13.3753321), new LatLon(52.5192215, 13.3768705));78 final List<WikipediaEntry> entries = WikipediaApp.forLanguage("de") 79 .getEntriesFromCoordinates(new LatLon(52.5179786, 13.3753321), new LatLon(52.5192215, 13.3768705)); 80 80 final long c = entries.stream() 81 81 .filter(entry -> "Reichstagsgebäude".equals(entry.article) && "de".equals(entry.lang)) … … 98 98 @Test 99 99 public void testFromCoordinatesWikidata() throws Exception { 100 final List<WikipediaEntry> entries = WikipediaApp. getEntriesFromCoordinates("wikidata",101 new LatLon(47.20, 11.30), new LatLon(47.22, 11.32));100 final List<WikipediaEntry> entries = WikipediaApp.forLanguage("wikidata") 101 .getEntriesFromCoordinates(new LatLon(47.20, 11.30), new LatLon(47.22, 11.32)); 102 102 final long c = entries.stream() 103 103 .map(WikidataEntry.class::cast) … … 109 109 @Test 110 110 public void testGetWikidataForArticles() throws Exception { 111 final Map<String, String> map = WikipediaApp. getWikidataForArticles("en",112 Arrays.asList("London", "Vienna", "Völs, Tyrol", "a-non-existing-article"));111 final Map<String, String> map = WikipediaApp.forLanguage("en") 112 .getWikidataForArticles(Arrays.asList("London", "Vienna", "Völs, Tyrol", "a-non-existing-article")); 113 113 assertThat(map.get("London"), is("Q84")); 114 114 assertThat(map.get("Vienna"), is("Q1741")); … … 120 120 @Test 121 121 public void testTicket13991() throws Exception { 122 final Map<String, String> map = WikipediaApp. getWikidataForArticles("en",123 Stream.iterate("London", x -> x).limit(100).collect(Collectors.toList()));122 final Map<String, String> map = WikipediaApp.forLanguage("en") 123 .getWikidataForArticles(Stream.iterate("London", x -> x).limit(100).collect(Collectors.toList())); 124 124 assertThat(map, is(Collections.singletonMap("London", "Q84"))); 125 125 final List<String> articles = IntStream.range(0, 200) 126 126 .mapToObj(i -> "a-non-existing-article-" + i) 127 127 .collect(Collectors.toList()); 128 assertTrue(WikipediaApp. getWikidataForArticles("en",articles).isEmpty());128 assertTrue(WikipediaApp.forLanguage("en").getWikidataForArticles(articles).isEmpty()); 129 129 } 130 130 … … 154 154 final WikipediaEntry entry2 = new WikipediaEntry("en", "London"); 155 155 final WikipediaEntry entry3 = new WikipediaEntry("en", "a-non-existing-article"); 156 WikipediaApp. updateWIWOSMStatus("en",Arrays.asList(entry1, entry2, entry3));156 WikipediaApp.forLanguage("en").updateWIWOSMStatus(Arrays.asList(entry1, entry2, entry3)); 157 157 assertThat(entry1.getWiwosmStatus(), is(true)); 158 158 assertThat(entry2.getWiwosmStatus(), is(true)); … … 162 162 @Test 163 163 public void testCategoriesForPrefix() throws Exception { 164 final List<String> categories = WikipediaApp. getCategoriesForPrefix("de","Gemeinde in Öster");164 final List<String> categories = WikipediaApp.forLanguage("de").getCategoriesForPrefix("Gemeinde in Öster"); 165 165 assertTrue(categories.contains("Gemeinde in Österreich")); 166 166 }
Note:
See TracChangeset
for help on using the changeset viewer.