### Question:
Hosts { @Nullable public InetAddress get(String host) { if (!isValidHost(host)) { return null; } Cursor cursor = db.rawQuery("SELECT * FROM " + TABLE_HOSTS + " WHERE " + COLUMN_HOST + " = ?;", new String[] {host}); try { if (cursor.moveToNext()) { String ip = SqlUtils.getString(cursor, COLUMN_IP, null); return toInetAddress(host, ip); } else { return null; } } finally { cursor.close(); } } Hosts(Context context, String name); @Nullable InetAddress get(String host); boolean put(String host, String ip); void delete(String host); List<Pair<String, String>> getAll(); @Nullable static InetAddress toInetAddress(String host, String ip); static boolean isValidHost(String host); static boolean isValidIp(String ip);  }### Answer:
@Test public void testGet() { Hosts hosts = new Hosts(RuntimeEnvironment.application, "hosts.db"); assertEquals(null, hosts.get("ni.hao")); hosts.put("ni.hao", "127.0.0.1"); assertEquals("ni.hao/127.0.0.1", hosts.get("ni.hao").toString()); assertEquals(null, hosts.get(null)); }