### Question:
IPListLoader { public static List<IPMapping> readMappings(File ipDir) { List<IPMapping> mappings = new ArrayList<IPMapping>(); try { FileInputStream fileIn = new FileInputStream(new File(ipDir, "index.txt")); DataInputStream in = new DataInputStream(fileIn); try { byte type = in.readByte(); while (true) { long start = in.readLong(); long end = in.readLong(); int mask = in.readInt(); CIDR cidr = new CIDR(start, end, mask); String filePath = in.readUTF(); mappings.add(new IPMapping(cidr, new File(ipDir, filePath), type)); } } catch (EOFException ex) { } fileIn.close(); } catch (IOException e) { e.printStackTrace(); } return mappings; } private  IPListLoader(); static List<IPMapping> readMappings(File ipDir);  }### Answer:
@Test public void testReadMappings() throws URISyntaxException { URL url = IPListLoaderTest.class.getResource("/ipdir/index.txt"); File indexFile = new File(url.toURI()); File ipDir = indexFile.getParentFile(); List<IPMapping> mappings = IPListLoader.readMappings(ipDir); assertEquals(19432, mappings.size()); IPMapping mapping = mappings.get(0); assertEquals(new CIDR("0.0.0.0/16"), mapping.getRange()); assertEquals(new File(ipDir, "0/0.0.0.0-16"), mapping.getIpFile()); }