Changeset 32687 in osm for applications/editors/josm/plugins/wikipedia/test/unit
- Timestamp:
- 2016-07-21T12:20:41+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wikipedia/test/unit/org/wikipedia/WikipediaAppTest.java
r32670 r32687 5 5 import org.openstreetmap.josm.Main; 6 6 import org.openstreetmap.josm.data.coor.LatLon; 7 import org.openstreetmap.josm.tools.Predicate;8 import org.openstreetmap.josm.tools.Predicates;9 import org.openstreetmap.josm.tools.Utils;10 7 import org.wikipedia.WikipediaApp.WikipediaEntry; 11 8 import org.wikipedia.WikipediaApp.WikipediaLangArticle; … … 20 17 import static org.hamcrest.CoreMatchers.is; 21 18 import static org.hamcrest.CoreMatchers.nullValue; 19 import static org.junit.Assert.assertEquals; 22 20 import static org.junit.Assert.assertThat; 23 21 import static org.junit.Assert.assertTrue; … … 142 140 final List<WikipediaEntry> entries = WikipediaApp.getEntriesFromCoordinates("de", 143 141 new LatLon(52.5179786, 13.3753321), new LatLon(52.5192215, 13.3768705)); 144 assertTrue(Utils.exists(entries, new Predicate<WikipediaEntry>() { 145 @Override 146 public boolean evaluate(WikipediaEntry entry) { 147 return "Reichstagsgebäude".equals(entry.wikipediaArticle) && "de".equals(entry.wikipediaLang); 148 } 149 })); 142 final long c = entries.stream() 143 .filter(entry -> "Reichstagsgebäude".equals(entry.wikipediaArticle) && "de".equals(entry.wikipediaLang)) 144 .count(); 145 assertEquals(1, c); 150 146 } 151 147 … … 166 162 final List<WikipediaEntry> entries = WikipediaApp.getEntriesFromCoordinates("wikidata", 167 163 new LatLon(47.20, 11.30), new LatLon(47.22, 11.32)); 168 assertTrue(Utils.exists(entries, new Predicate<WikipediaEntry>() { 169 @Override 170 public boolean evaluate(WikipediaEntry entry) { 171 return "Q865406".equals(entry.wikipediaArticle) && "wikidata".equals(entry.wikipediaLang) && "Birgitzer Alm".equals(entry.label); 172 } 173 })); 164 final long c = entries.stream() 165 .filter(entry -> "Q865406".equals(entry.wikipediaArticle) && "wikidata".equals(entry.wikipediaLang) && "Birgitzer Alm".equals(entry.label)) 166 .count(); 167 assertEquals(1, c); 174 168 } 175 169 … … 219 213 public void testCategoriesForPrefix() throws Exception { 220 214 final List<String> categories = WikipediaApp.getCategoriesForPrefix("de", "Gemeinde in Öster"); 221 assertTrue( Utils.exists(categories, Predicates.equalTo("Gemeinde in Österreich")));215 assertTrue(categories.contains("Gemeinde in Österreich")); 222 216 } 223 217 }
Note:
See TracChangeset
for help on using the changeset viewer.