### Question:
IndexedFidReader implements FeatureIDReader, Closeable { public long findFid(final String fid) throws IOException { try { final long desired; if(fid.startsWith(typeName)){ try{ desired = Long.parseLong(fid.substring(typeName.length()), 10); }catch(NumberFormatException e){ return -1; } }else{ return -1; } if (desired < 0) { return -1; } if (desired < count) { return search(desired, -1, this.count, desired - 1); } else { return search(desired, -1, this.count, count - 1); } } catch (NumberFormatException e) { LOGGER.log(Level.WARNING, "Fid is not recognized as a fid for this shapefile: {0}", typeName); return -1; } } IndexedFidReader(final URI fixUrl, final ReadableByteChannel fixChannel,
            final RecordNumberTracker reader); long getCount(); int getRemoves(); long findFid(final String fid); void goTo(final long recno); @Override void close(); @Override boolean isClosed(); @Override boolean hasNext(); @Override String next(); int currentSHXIndex(); long getCurrentFIDIndex();  }### Answer:
@Test public void testFindFid() throws Exception { long offset = reader.findFid(TYPE_NAME + ".4"); assertEquals(3, offset); offset = reader.findFid(TYPE_NAME + ".1"); assertEquals(0, offset); offset = reader.findFid(TYPE_NAME + ".10000000"); assertEquals(-1, offset); offset = reader.findFid(TYPE_NAME + ".-1"); assertEquals(-1, offset); offset = reader.findFid(TYPE_NAME + ".1ABC"); assertEquals(-1, offset); offset = reader.findFid("prefix" + TYPE_NAME + ".1"); assertEquals(-1, offset); }