Package wicket.contrib.gmap.util

Source Code of wicket.contrib.gmap.util.GeocoderTest

package wicket.contrib.gmap.util;

import org.junit.Assert;
import org.junit.Test;
import org.wicketstuff.gmap.api.GLatLng;
import org.wicketstuff.gmap.geocoder.Geocoder;

public class GeocoderTest {

    @Test
    public void testEncode() {
        System.out.println("encode");
        Geocoder coder = new Geocoder();
        String encode = coder.encode("Salzburgerstraße 205, 4030 Linz, Österreich");
        Assert.assertEquals("http://maps.googleapis.com/maps/api/geocode/json?address=Salzburgerstra%C3%9Fe+205%2C+4030+Linz%2C+%C3%96sterreich&sensor=false", encode);
    }

    @Test
    public void testGeocoding() throws Exception {
        System.out.println("geocoding");
        Geocoder coder = new Geocoder();
        GLatLng result = coder.geocode("Salzburgerstraße 205, 4030 Linz, Österreich");
        Assert.assertNotNull(result);
        Assert.assertEquals(48.25763170, result.getLat(), 0.00001);
        Assert.assertEquals(14.29231840, result.getLng(), 0.00001);
    }
}
TOP

Related Classes of wicket.contrib.gmap.util.GeocoderTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.