tb.add("integer", Integer.class);
GeometryFactory gf = new GeometryFactory();
SimpleFeatureBuilder b = new SimpleFeatureBuilder(tb.buildFeatureType());
DefaultFeatureCollection features = new DefaultFeatureCollection(null, b.getFeatureType());
DefaultFeatureCollection secondFeatures = new DefaultFeatureCollection(null, b
.getFeatureType());
Geometry[] firstArrayGeometry = new Geometry[5];
Geometry[] secondArrayGeometry = new Geometry[5];
for (int numFeatures = 0; numFeatures < 5; numFeatures++) {
Coordinate firstArray[] = new Coordinate[5];
for (int j = 0; j < 4; j++) {
firstArray[j] = new Coordinate(j + numFeatures, j + numFeatures);
}
firstArray[4] = new Coordinate(0 + numFeatures, 0 + numFeatures);
LinearRing shell = new LinearRing(firstArray, new PrecisionModel(), 0);
b.add(gf.createPolygon(shell, null));
b.add(0);
firstArrayGeometry[numFeatures] = gf.createPolygon(shell, null);
features.add(b.buildFeature(numFeatures + ""));
}
for (int numFeatures = 0; numFeatures < 5; numFeatures++) {
Coordinate array[] = new Coordinate[5];
for (int j = 0; j < 4; j++) {
array[j] = new Coordinate(j + numFeatures + 50, j + numFeatures + 50);
}
array[4] = new Coordinate(0 + numFeatures + 50, 0 + numFeatures + 50);
LinearRing shell = new LinearRing(array, new PrecisionModel(), 0);
b.add(gf.createPolygon(shell, null));
b.add(0);
secondArrayGeometry[numFeatures] = gf.createPolygon(shell, null);
secondFeatures.add(b.buildFeature(numFeatures + ""));
}
UnionFeatureCollection process = new UnionFeatureCollection();
SimpleFeatureCollection output = process.execute(features, secondFeatures);
assertEquals(5, output.size());