// Path: src/main/java/com/maxmind/geoip2/model/InsightsResponse.java
// public class InsightsResponse extends AbstractCityResponse {
//     public InsightsResponse(
//             @JsonProperty("city") City city,
//             @JsonProperty("continent") Continent continent,
//             @JsonProperty("country") Country country,
//             @JsonProperty("location") Location location,
//             @JsonProperty("maxmind") MaxMind maxmind,
//             @JsonProperty("postal") Postal postal,
//             @JsonProperty("registered_country") Country registeredCountry,
//             @JsonProperty("represented_country") RepresentedCountry representedCountry,
//             @JsonProperty("subdivisions") List<Subdivision> subdivisions,
//             @JacksonInject("traits") @JsonProperty("traits") Traits traits
//     ) {
//         super(city, continent, country, location, maxmind, postal, registeredCountry,
//                 representedCountry, subdivisions, traits);
//     }
// }


import com.github.tomakehurst.wiremock.junit.WireMockRule;
import com.maxmind.geoip2.exception.*;
import com.maxmind.geoip2.model.InsightsResponse;
import com.maxmind.geoip2.record.*;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.hamcrest.CoreMatchers;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.nio.charset.StandardCharsets;
import java.util.List;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.jcabi.matchers.RegexMatchers.matchesPattern;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.StringStartsWith.startsWith;
import static org.junit.Assert.*;
package com.maxmind.geoip2;





@RunWith(JUnitParamsRunner.class)
public class WebServiceClientTest {

    @Rule
    public final WireMockRule wireMockRule = new WireMockRule(0); // 0 picks random port

    @Test
    public void test200WithNoBody() throws Exception {
        WebServiceClient client = createSuccessClient("insights", "me", "");

        Exception ex = assertThrows(GeoIp2Exception.class, client::insights);
        assertEquals("Received a 200 response but could not decode it as JSON", ex.getMessage());
    }

    @Test
    public void test200WithInvalidJson() throws Exception {
        WebServiceClient client = createSuccessClient("insights", "me", "{");

        Exception ex = assertThrows(GeoIp2Exception.class, client::insights);
        assertEquals("Received a 200 response but could not decode it as JSON", ex.getMessage());
    }

    @Test
    public void test200WithDefaultValues() throws Exception {
        WebServiceClient client = createSuccessClient("insights", "1.2.3.13",
                "{\"traits\":{\"ip_address\":\"1.2.3.13\",\"network\":\"1.2.3.0/24\"}}");

// Path: src/main/java/com/maxmind/geoip2/model/InsightsResponse.java
// public class InsightsResponse extends AbstractCityResponse {
//     public InsightsResponse(
//             @JsonProperty("city") City city,
//             @JsonProperty("continent") Continent continent,
//             @JsonProperty("country") Country country,
//             @JsonProperty("location") Location location,
//             @JsonProperty("maxmind") MaxMind maxmind,
//             @JsonProperty("postal") Postal postal,
//             @JsonProperty("registered_country") Country registeredCountry,
//             @JsonProperty("represented_country") RepresentedCountry representedCountry,
//             @JsonProperty("subdivisions") List<Subdivision> subdivisions,
//             @JacksonInject("traits") @JsonProperty("traits") Traits traits
//     ) {
//         super(city, continent, country, location, maxmind, postal, registeredCountry,
//                 representedCountry, subdivisions, traits);
//     }
// }


// Path: src/test/java/com/maxmind/geoip2/WebServiceClientTest.java
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import com.maxmind.geoip2.exception.*;
import com.maxmind.geoip2.model.InsightsResponse;
import com.maxmind.geoip2.record.*;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.hamcrest.CoreMatchers;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.nio.charset.StandardCharsets;
import java.util.List;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.jcabi.matchers.RegexMatchers.matchesPattern;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.StringStartsWith.startsWith;
import static org.junit.Assert.*;

package com.maxmind.geoip2;





@RunWith(JUnitParamsRunner.class)
public class WebServiceClientTest {

    @Rule
    public final WireMockRule wireMockRule = new WireMockRule(0); // 0 picks random port

    @Test
    public void test200WithNoBody() throws Exception {
        WebServiceClient client = createSuccessClient("insights", "me", "");

        Exception ex = assertThrows(GeoIp2Exception.class, client::insights);
        assertEquals("Received a 200 response but could not decode it as JSON", ex.getMessage());
    }

    @Test
    public void test200WithInvalidJson() throws Exception {
        WebServiceClient client = createSuccessClient("insights", "me", "{");

        Exception ex = assertThrows(GeoIp2Exception.class, client::insights);
        assertEquals("Received a 200 response but could not decode it as JSON", ex.getMessage());
    }

    @Test
    public void test200WithDefaultValues() throws Exception {
        WebServiceClient client = createSuccessClient("insights", "1.2.3.13",
                "{\"traits\":{\"ip_address\":\"1.2.3.13\",\"network\":\"1.2.3.0/24\"}}");

        InsightsResponse insights = client.insights(InetAddress