// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.io; import static org.junit.Assert.assertEquals; import java.io.StringReader; import java.util.Arrays; import java.util.stream.Collectors; import org.junit.Test; /** * Unit tests of {@link NameFinder} class. */ public class NameFinderTest { // CHECKSTYLE.OFF: LineLength /** * Sample Nominatim results. */ public static final String SAMPLE = "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + ""; // CHECKSTYLE.ON: LineLength /** * Unit test of {@link NameFinder#parseSearchResults}. * @throws Exception if any error occurs */ @Test public void testParseSearchResults() throws Exception { try (StringReader reader = new StringReader(SAMPLE)) { assertEquals(Arrays.asList( 2702400314L, 1942586L, 301750823L, 300479055L, 33197279L, 150960458L, 153844606L, 132164L, 151839268L, 151753473L), NameFinder.parseSearchResults(reader).stream().map(r -> r.getOsmId().getUniqueId()).collect(Collectors.toList())); } } }