*/
public abstract class JDBCFeatureReaderTest extends JDBCTestSupport {
public void testNext() throws Exception {
Query query = new DefaultQuery(tname("ft1"));
FeatureReader reader = dataStore.getFeatureReader(query, Transaction.AUTO_COMMIT);
assertTrue(reader.hasNext());
SimpleFeature feature = (SimpleFeature) reader.next();
// feature tests
// test getName
assertEquals(feature.getName(), reader.getFeatureType().getName());
// test getters
int i = 0;
for (PropertyDescriptor desc : reader.getFeatureType().getDescriptors()) {
assertTrue(i < feature.getAttributeCount());
assertEquals(feature.getAttribute(desc.getName()), feature.getAttribute(i++));
}
// test set
List<Object> attrs = feature.getAttributes();
try {
attrs.set(2, 1.1D);
feature.setAttributes(attrs);
} catch (Exception e) {
fail();
}
assertEquals(attrs.get(2), feature.getAttribute(2));
Geometry g = (Geometry) feature.getDefaultGeometry();
assertNotNull(g);
assertTrue(g.getUserData() instanceof CoordinateReferenceSystem);
reader.close();
}