// Path: src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java
// public enum ConnectionType {
//     DIALUP("Dialup"), CABLE_DSL("Cable/DSL"), CORPORATE("Corporate"), CELLULAR(
//             "Cellular");
// 
//     private final String name;
// 
//     ConnectionType(String name) {
//         this.name = name;
//     }
// 
//     /*
//      * (non-Javadoc)
//      *
//      * @see java.lang.Enum#toString()
//      */
//     @JsonValue
//     @Override
//     public String toString() {
//         return this.name;
//     }
// 
//     public static ConnectionType fromString(String s) {
//         if (s == null) {
//             return null;
//         }
// 
//         switch (s) {
//             case "Dialup":
//                 return ConnectionType.DIALUP;
//             case "Cable/DSL":
//                 return ConnectionType.CABLE_DSL;
//             case "Corporate":
//                 return ConnectionType.CORPORATE;
//             case "Cellular":
//                 return ConnectionType.CELLULAR;
//             default:
//                 return null;
//         }
//     }
// }


import com.maxmind.db.Reader;
import com.maxmind.geoip2.exception.AddressNotFoundException;
import com.maxmind.geoip2.exception.GeoIp2Exception;
import com.maxmind.geoip2.model.*;
import com.maxmind.geoip2.model.ConnectionTypeResponse.ConnectionType;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.*;
        try (DatabaseReader reader = new DatabaseReader.Builder(
                getFile("GeoIP2-City-Test.mmdb")).build()
        ) {
            InetAddress ipAddress = InetAddress.getByName("81.2.69.192");

            CityResponse response = reader.city(ipAddress);
            assertEquals(2635167, response.getCountry().getGeoNameId().intValue());
            assertEquals(100, response.getLocation().getAccuracyRadius().intValue());
            assertFalse(response.getTraits().isLegitimateProxy());
            assertEquals(ipAddress.getHostAddress(), response.getTraits().getIpAddress());
            assertEquals("81.2.69.192/28", response.getTraits().getNetwork().toString());

            CityResponse tryResponse = reader.tryCity(ipAddress).get();
            assertEquals(response.toJson(), tryResponse.toJson());

            // Test that the methods can be called on DB without
            // an exception
            reader.country(ipAddress);
        }
    }

    @Test
    public void testConnectionType() throws Exception {
        try (DatabaseReader reader = new DatabaseReader.Builder(
                this.getFile("GeoIP2-Connection-Type-Test.mmdb")).build()
        ) {
            InetAddress ipAddress = InetAddress.getByName("1.0.1.0");

            ConnectionTypeResponse response = reader.connectionType(ipAddress);

// Path: src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java
// public enum ConnectionType {
//     DIALUP("Dialup"), CABLE_DSL("Cable/DSL"), CORPORATE("Corporate"), CELLULAR(
//             "Cellular");
// 
//     private final String name;
// 
//     ConnectionType(String name) {
//         this.name = name;
//     }
// 
//     /*
//      * (non-Javadoc)
//      *
//      * @see java.lang.Enum#toString()
//      */
//     @JsonValue
//     @Override
//     public String toString() {
//         return this.name;
//     }
// 
//     public static ConnectionType fromString(String s) {
//         if (s == null) {
//             return null;
//         }
// 
//         switch (s) {
//             case "Dialup":
//                 return ConnectionType.DIALUP;
//             case "Cable/DSL":
//                 return ConnectionType.CABLE_DSL;
//             case "Corporate":
//                 return ConnectionType.CORPORATE;
//             case "Cellular":
//                 return ConnectionType.CELLULAR;
//             default:
//                 return null;
//         }
//     }
// }


// Path: src/test/java/com/maxmind/geoip2/DatabaseReaderTest.java
import com.maxmind.db.Reader;
import com.maxmind.geoip2.exception.AddressNotFoundException;
import com.maxmind.geoip2.exception.GeoIp2Exception;
import com.maxmind.geoip2.model.*;
import com.maxmind.geoip2.model.ConnectionTypeResponse.ConnectionType;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.*;

        try (DatabaseReader reader = new DatabaseReader.Builder(
                getFile("GeoIP2-City-Test.mmdb")).build()
        ) {
            InetAddress ipAddress = InetAddress.getByName("81.2.69.192");

            CityResponse response = reader.city(ipAddress);
            assertEquals(2635167, response.getCountry().getGeoNameId().intValue());
            assertEquals(100, response.getLocation().getAccuracyRadius().intValue());
            assertFalse(response.getTraits().isLegitimateProxy());
            assertEquals(ipAddress.getHostAddress(), response.getTraits().getIpAddress());
            assertEquals("81.2.69.192/28", response.getTraits().getNetwork().toString());

            CityResponse tryResponse = reader.tryCity(ipAddress).get();
            assertEquals(response.toJson(), tryResponse.toJson());

            // Test that the methods can be called on DB without
            // an exception
            reader.country(ipAddress);
        }
    }

    @Test
    public void testConnectionType() throws Exception {
        try (DatabaseReader reader = new DatabaseReader.Builder(
                this.getFile("GeoIP2-Connection-Type-Test.mmdb")).build()
        ) {
            InetAddress ipAddress = InetAddress.getByName("1.0.1.0");

            ConnectionTypeResponse response = reader.connectionType(ipAddress);

            assertEquals(ConnectionType.CABLE_DSL, response.getConnectionType());