SimpleFeatureSource table = storeTable.getFeatureSource( "table" );
//GenericEntity.f004=description-f004|name-f004
FeatureId fid1 = ff.featureId("GenericEntity.f004");
Filter select = ff.id( Collections.singleton(fid1));
SimpleFeatureCollection featureCollection = table.getFeatures( select );
featureCollection.accepts(new FeatureVisitor() {
public void visit(Feature f) {
SimpleFeature feature = (SimpleFeature) f;
String name = (String) feature.getAttribute("name");
assertEquals( "name-f004", name );
}
},null);
//GenericEntity.f003=description-f003|<null>
fid1 = ff.featureId("GenericEntity.f003");
select = ff.id( Collections.singleton(fid1));
featureCollection = table.getFeatures( select );
featureCollection.accepts(new FeatureVisitor() {
public void visit(Feature f) {
SimpleFeature feature = (SimpleFeature) f;
String name = (String) feature.getAttribute("name");
System.out.println( name );
assertNull( "represent null", name );
}
},null);
//GenericEntity.f007=description-f007|
fid1 = ff.featureId("GenericEntity.f007");
select = ff.id( Collections.singleton(fid1));
featureCollection = table.getFeatures( select );
featureCollection.accepts(new FeatureVisitor() {
public void visit(Feature f) {
SimpleFeature feature = (SimpleFeature) f;
String name = (String) feature.getAttribute("name");
assertEquals( "represent empty string", "", name );
}
},null);
//" GenericEntity.f009=description-f009| "
fid1 = ff.featureId("GenericEntity.f009");
select = ff.id( Collections.singleton(fid1));
featureCollection = table.getFeatures( select );
featureCollection.accepts(new FeatureVisitor() {
public void visit(Feature f) {
SimpleFeature feature = (SimpleFeature) f;
String name = (String) feature.getAttribute("name");
assertEquals( "represent empty string", " ", name );
}