Add tests

This commit is contained in:
Victor Shcherb 2016-07-13 12:08:24 +02:00
parent 1e4bef54fa
commit d3a162b467
2 changed files with 32 additions and 0 deletions

View file

@ -19,6 +19,7 @@ import net.osmand.data.LatLon;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@ -31,6 +32,7 @@ import com.google.gson.GsonBuilder;
*/
@RunWith(Parameterized.class)
@Ignore
public class RouteTestingTest {

View file

@ -0,0 +1,30 @@
package net.osmand.search;
import java.io.IOException;
import junit.framework.TestCase;
import net.osmand.data.LatLon;
import net.osmand.search.SearchUICore.SearchResultMatcher;
import net.osmand.search.core.SearchCoreFactory;
import net.osmand.search.core.SearchCoreFactory.SearchLocationAndUrlAPI;
import net.osmand.search.core.SearchPhrase;
import org.junit.Assert;
import org.junit.Test;
public class TestLocationSearch {
@Test
public void testLocationSearch() throws IOException {
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);
}
}