Permalink
Browse files

Using Id filter directly was confused versioned postgis testing. Chan…

…ged it back and introduced an expected(Filter) method to quickly count FeatureIds protected by an instance of check
  • Loading branch information...
1 parent 39ed479 commit b78767299230f55b930fdc41f5b459a8f1e7ef47 @jodygarnett jodygarnett committed Oct 31, 2012
View
14 modules/library/main/src/main/java/org/geotools/data/DataTestCase.java
@@ -68,9 +68,9 @@
protected SimpleFeature[] roadFeatures;
protected ReferencedEnvelope roadBounds;
protected ReferencedEnvelope rd12Bounds;
- protected Id rd1Filter;
- protected Id rd2Filter;
- protected Id rd12Filter;
+ protected Filter rd1Filter;
+ protected Filter rd2Filter;
+ protected Filter rd12Filter;
protected SimpleFeature newRoad;
protected SimpleFeatureType riverType; // river: id, geom, river, flow
@@ -93,6 +93,14 @@ public DataTestCase(final String name) {
super(name);
}
+ protected int expected( Filter filter ){
+ if( filter instanceof Id){
+ Id id = (Id) filter;
+ return id.getIDs().size();
+ }
+ return -1;
+ }
+
/**
* Invoked before a test is run. The default implementation invokes {@link #dataSetUp}.
*/
View
4 modules/library/main/src/test/java/org/geotools/data/memory/MemoryFeatureCollectionTest.java
@@ -111,6 +111,7 @@ public void testIterator() throws Exception {
Iterator<SimpleFeature> it = roads.iterator();
try {
while( it.hasNext() ){
+ @SuppressWarnings("unused")
SimpleFeature feature = it.next();
count++;
}
@@ -125,13 +126,14 @@ public void testIterator() throws Exception {
FilteredIterator<SimpleFeature> filteredIterator = new FilteredIterator<SimpleFeature>( roads, rd12Filter );
try {
while( filteredIterator.hasNext() ){
+ @SuppressWarnings("unused")
SimpleFeature feature = filteredIterator.next();
count++;
}
} finally {
filteredIterator.close();
}
- assertEquals( rd12Filter.getIDs().size(), count );
+ assertEquals( expected( rd12Filter) , count );
}
public void testSubCollection(){

0 comments on commit b787672

Please sign in to comment.