Package com.maxmind.geoip2

Source Code of com.maxmind.geoip2.MeTest

package com.maxmind.geoip2;

import static org.junit.Assert.assertEquals;

import java.io.IOException;

import org.junit.Before;
import org.junit.Test;

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

public class MeTest {
    private WebServiceClient client;

    @Before
    public void createClient() {
        HttpTransport transport = new TestTransport();

        this.client = new WebServiceClient.Builder(42, "abcdef123456")
                .testTransport(transport).build();

    }

    @Test
    public void insights() throws IOException, GeoIp2Exception {
        assertEquals(this.client.insights().getTraits().getIpAddress(),
                "24.24.24.24");
    }

    @Test
    public void city() throws IOException, GeoIp2Exception {
        assertEquals(this.client.city().getTraits().getIpAddress(),
                "24.24.24.24");
    }

    @Test
    public void country() throws IOException, GeoIp2Exception {
        assertEquals(this.client.country().getTraits().getIpAddress(),
                "24.24.24.24");
    }
}
TOP

Related Classes of com.maxmind.geoip2.MeTest

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.