@Test
public void testGenerate() throws Exception {

    ShpFiles shpFiles = new ShpFiles(backshp.toURI().toURL());
    FidIndexer.generate(shpFiles);
    ShapefileDataStore ds = new ShapefileDataStore(DataUtilities.fileToURL(backshp));
    SimpleFeatureSource fs = ds.getFeatureSource();
    int features = fs.getCount(Query.ALL);
    IndexedFidReader reader = new IndexedFidReader(shpFiles);
    try {
        assertEquals(features, reader.getCount());
        int i = 1;
        while (reader.hasNext()) {
            assertEquals(shpFiles.getTypeName() + "." + i, reader.next());
            assertEquals(shpFiles.getTypeName() + "." + i, i - 1, reader.currentSHXIndex());
            i++;
        }
        assertEquals(features, i - 1);
    } finally {
        reader.close();
        ds.dispose();
    }
}