Ignore:
Timestamp:
2016-07-21T12:20:41+02:00 (9 years ago)
Author:
simon04
Message:

JOSM/wikipedia: switch to Java 8

File:
1 edited

Legend:

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

    r32670 r32687  
    55import org.openstreetmap.josm.Main;
    66import 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;
    107import org.wikipedia.WikipediaApp.WikipediaEntry;
    118import org.wikipedia.WikipediaApp.WikipediaLangArticle;
     
    2017import static org.hamcrest.CoreMatchers.is;
    2118import static org.hamcrest.CoreMatchers.nullValue;
     19import static org.junit.Assert.assertEquals;
    2220import static org.junit.Assert.assertThat;
    2321import static org.junit.Assert.assertTrue;
     
    142140        final List<WikipediaEntry> entries = WikipediaApp.getEntriesFromCoordinates("de",
    143141                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);
    150146    }
    151147
     
    166162        final List<WikipediaEntry> entries = WikipediaApp.getEntriesFromCoordinates("wikidata",
    167163                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);
    174168    }
    175169
     
    219213    public void testCategoriesForPrefix() throws Exception {
    220214        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"));
    222216    }
    223217}
Note: See TracChangeset for help on using the changeset viewer.