Changeset 30125 in osm for applications/editors/josm/plugins/wikipedia/test/org/wikipedia/WikipediaAppTest.java
- Timestamp:
- 2013-12-15T11:44:32+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wikipedia/test/org/wikipedia/WikipediaAppTest.java
r29621 r30125 2 2 3 3 import org.junit.Test; 4 import org.openstreetmap.josm.data.coor.LatLon; 5 import org.openstreetmap.josm.tools.Predicate; 6 import org.openstreetmap.josm.tools.Utils; 4 7 import org.wikipedia.WikipediaApp.WikipediaEntry; 5 8 import org.wikipedia.WikipediaApp.WikipediaLangArticle; … … 7 10 import java.util.Arrays; 8 11 import java.util.Collection; 12 import java.util.List; 9 13 10 14 import static org.hamcrest.CoreMatchers.is; 11 15 import static org.hamcrest.CoreMatchers.nullValue; 12 16 import static org.junit.Assert.assertThat; 17 import static org.junit.Assert.assertTrue; 13 18 import static org.junit.matchers.JUnitMatchers.hasItem; 14 19 … … 46 51 final WikipediaLangArticle actual = WikipediaLangArticle.parseFromUrl("http://de.wikipedia.org/wiki/Sternheim_%26_Emanuel"); 47 52 assertThat(actual.article, is("Sternheim_&_Emanuel")); 53 assertThat(actual.lang, is("de")); 54 } 55 56 @Test 57 public void testParseFromUrl4() { 58 final WikipediaLangArticle actual = WikipediaLangArticle.parseFromUrl("//de.wikipedia.org/wiki/Reichstagsgeb%C3%A4ude"); 59 assertThat(actual.article, is("Reichstagsgebäude")); 48 60 assertThat(actual.lang, is("de")); 49 61 } … … 103 115 } 104 116 117 @Test 118 public void testFromCoordinates() throws Exception { 119 final List<WikipediaEntry> entries = WikipediaApp.getEntriesFromCoordinates("de", 120 new LatLon(52.5179786, 13.3753321), new LatLon(52.5192215, 13.3768705)); 121 assertTrue(Utils.exists(entries, new Predicate<WikipediaEntry>() { 122 @Override 123 public boolean evaluate(WikipediaEntry entry) { 124 return "Deutscher Bundestag".equals(entry.wikipediaArticle) && "de".equals(entry.wikipediaLang); 125 } 126 })); 127 } 105 128 }
Note:
See TracChangeset
for help on using the changeset viewer.