Package com.maxmind.geoip2

Source Code of com.maxmind.geoip2.HostTest

package com.maxmind.geoip2;

import static org.junit.Assert.assertEquals;

import java.io.IOException;
import java.net.InetAddress;

import org.junit.Test;

import com.google.api.client.http.HttpTransport;
import com.maxmind.geoip2.exception.GeoIp2Exception;
import com.maxmind.geoip2.model.InsightsResponse;

public class HostTest {

    @Test
    public void insights() throws IOException, GeoIp2Exception {
        HttpTransport transport = new TestTransport();
        WebServiceClient client = new WebServiceClient.Builder(42,
                "abcdef123456").host("blah.com").testTransport(transport)
                .build();

        InsightsResponse insights = client.insights(InetAddress
                .getByName("128.101.101.101"));
        assertEquals(insights.getTraits().getIpAddress(), "128.101.101.101");
    }
}
TOP

Related Classes of com.maxmind.geoip2.HostTest

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.