2016-07-13 12:08:24 +02:00
|
|
|
package net.osmand.search;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import net.osmand.data.LatLon;
|
|
|
|
import net.osmand.search.SearchUICore.SearchResultMatcher;
|
|
|
|
import net.osmand.search.core.SearchCoreFactory;
|
|
|
|
import net.osmand.search.core.SearchPhrase;
|
|
|
|
|
|
|
|
import org.junit.Assert;
|
|
|
|
import org.junit.Test;
|
|
|
|
|
2016-07-13 12:12:53 +02:00
|
|
|
|
2016-07-13 12:11:00 +02:00
|
|
|
public class LocationSearchTest {
|
2016-07-13 12:08:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
@Test
|
2016-07-13 12:11:00 +02:00
|
|
|
public void testBasicSearch() throws IOException {
|
2016-07-13 12:08:24 +02:00
|
|
|
search("5.0,3.0", new LatLon(5, 3));
|
|
|
|
}
|
|
|
|
|
|
|
|
private void search(String string, LatLon latLon) throws IOException {
|
|
|
|
SearchResultMatcher srm = new SearchUICore.SearchResultMatcher(null, 0, null, 100);
|
|
|
|
new SearchCoreFactory.SearchLocationAndUrlAPI().
|
|
|
|
search(new SearchPhrase(null).generateNewPhrase(string, null), srm);
|
|
|
|
Assert.assertEquals(srm.getRequestResults().size(), 1);
|
|
|
|
Assert.assertEquals(srm.getRequestResults().get(0).location, latLon);
|
|
|
|
}
|
|
|
|
}
|