Fix tests

This commit is contained in:
Victor Shcherb 2016-07-13 12:24:54 +02:00
parent 1f3e4eaff0
commit 0642c02422
3 changed files with 47 additions and 12 deletions

View file

@ -211,7 +211,7 @@ public class GeoPointParserUtil {
actual = GeoPointParserUtil.parse(url);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://download.osmand.net/go?lat=c&lon=-106.61568&z=11
// http://download.osmand.net/go?lat=34.99393&lon=-106.61568&z=11
url = "http://download.osmand.net/go?lat=" + dlat + "&lon=" + dlon + "&z=" + z;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse(url);
@ -828,7 +828,6 @@ public class GeoPointParserUtil {
* @return {@link GeoParsedPoint}
*/
public static GeoParsedPoint parse(final String uriString) {
System.out.println("parse(" + "uriString=" + uriString + ")");
URI uri;
try {
// amap.com uses | in their URLs, which is an illegal character for a URL

View file

@ -32,8 +32,7 @@ import com.google.gson.GsonBuilder;
*/
@RunWith(Parameterized.class)
@Ignore
public class RouteTestingTest {
public class RouteTestingTestIgnore {
private LatLon startPoint;
@ -42,7 +41,7 @@ public class RouteTestingTest {
private Map<String, String> params;
public RouteTestingTest(String testName, LatLon startPoint, LatLon endPoint, Map<Long, String> expectedResults,
public RouteTestingTestIgnore(String testName, LatLon startPoint, LatLon endPoint, Map<Long, String> expectedResults,
Map<String, String> params) {
this.startPoint = startPoint;
this.endPoint = endPoint;
@ -58,7 +57,7 @@ public class RouteTestingTest {
@Parameterized.Parameters(name = "{index}: {0}")
public static Collection<Object[]> data() throws IOException {
String fileName = "/test_routing.json";
Reader reader = new InputStreamReader(RouteTestingTest.class.getResourceAsStream(fileName));
Reader reader = new InputStreamReader(RouteTestingTestIgnore.class.getResourceAsStream(fileName));
Gson gson = new GsonBuilder().setPrettyPrinting().create();
TestEntry[] testEntries = gson.fromJson(reader, TestEntry[].class);
ArrayList<Object[]> twoDArray = new ArrayList<Object[]>();

View file

@ -12,12 +12,6 @@ import org.junit.Test;
public class LocationSearchTest {
@Test
public void testBasicSearch() 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);
@ -26,4 +20,47 @@ public class LocationSearchTest {
Assert.assertEquals(srm.getRequestResults().size(), 1);
Assert.assertEquals(srm.getRequestResults().get(0).location, latLon);
}
@Test
public void testGeo() throws IOException {
search("geo:34.99393,-106.61568 (Treasure Island, other irrelevant info) ", new LatLon(34.99393, -106.61568));
search("http://download.osmand.net/go?lat=34.99393&lon=-106.61568&z=11", new LatLon(34.99393, -106.61568));
}
@Test
public void testBasicCommaSearch() throws IOException {
search("5.0,3.0", new LatLon(5, 3));
search("5.445,3.523", new LatLon(5.445, 3.523));
search("5:1:1,3:1", new LatLon(5 + 1/60f + 1/3600f, 3 + 1/60f));
}
@Test
public void testBasicSpaceSearch() throws IOException {
search("5.0 3.0", new LatLon(5, 3));
search("5.445 3.523", new LatLon(5.445, 3.523));
search("5:1:1 3:1", new LatLon(5 + 1/60f + 1/3600f, 3 + 1/60f));
}
// TODO 17R 419230 2714967
// 17N6734294749123
// 45° 30'30"W
// -45
// 45 W
// 45 S
// 45.50W
// 45.50S
// W45
// S45
// 45 30.5W
// 44 30.5S
// 45 30 30 W
// 45 30 30 N
// -45 30 30
// 45 30 30
// 45 30.50W
// 45 30.50
}