@Test
public void testQueryCapabilities() throws Exception {

    URL url = TestData.url(STATE_POP);
    
    Map params = new KVP( URLP.key,url );
    DataStore dataStore = factory.createDataStore( params );
    Name typeName = dataStore.getNames().get(0);
    SimpleFeatureSource featureSource = dataStore.getFeatureSource( typeName);
    
    QueryCapabilities caps = featureSource.getQueryCapabilities();
    
    SortBy[] sortBy = new SortBy[]{SortBy.NATURAL_ORDER,};
    assertTrue( "Natural", caps.supportsSorting( sortBy ));
    
    SimpleFeatureType schema = featureSource.getSchema();
    String attr = schema.getDescriptor(1).getLocalName();
    
    sortBy[0] = ff.sort( attr, SortOrder.ASCENDING );
    assertTrue( "Sort "+attr, caps.supportsSorting( sortBy ));
    
    sortBy[0] = ff.sort( "the_geom", SortOrder.ASCENDING );
    assertFalse( "Cannot sort the_geom", caps.supportsSorting( sortBy ));
}