@Test
public void testEnableIndexParameter() throws Exception {

    Map<String, Serializable> params;
    ShapefileDataStore ds;
    // remote (jar file) shapefiles
    URL remoteUrl = TestData.url(STATE_POP);
    // local shapefiles (copied out of jar)
    File f = copyShapefiles(STATE_POP);
    URL localUrl = f.toURI().toURL();
    // test remote file has spatial index disabled even if requested
    params = map(URLP.key, remoteUrl, ENABLE_SPATIAL_INDEX.key, true);
    ds = (ShapefileDataStore) factory.createDataStore(params);
    assertNotNull("Null datastore should not be returned", ds);
    assertTrue("should be a non indexed shapefile",
            ds instanceof org.geotools.data.shapefile.ShapefileDataStore);
    ds.dispose();
    // test default has spatial index enabled
    params = map(URLP.key, localUrl);
    ds = (ShapefileDataStore) factory.createDataStore(params);
    assertNotNull("Null datastore should not be returned", ds);
    assertTrue(ds.isIndexed());
    assertTrue(ds.isIndexCreationEnabled());
    ds.dispose();
    // test disable works
    params = map(URLP.key, localUrl, ENABLE_SPATIAL_INDEX.key, false);
    ds = (ShapefileDataStore) factory.createDataStore(params);
    assertNotNull("Null datastore should not be returned", ds);
    assertFalse(ds.isIndexed());
    assertFalse(ds.isIndexCreationEnabled());
    ds.dispose();
    // text explicit enable works
    params = map(URLP.key, localUrl, ENABLE_SPATIAL_INDEX.key, true);
    ds = (ShapefileDataStore) factory.createDataStore(params);
    assertNotNull("Null datastore should not be returned", ds);
    assertTrue(ds.isIndexed());
    assertTrue(ds.isIndexCreationEnabled());
    ds.dispose();
}