InclusionFeatureCollection implements VectorProcess { @DescribeResult(description = "Output feature collection") public SimpleFeatureCollection execute( @DescribeParameter(name = "first", description = "First feature collection") SimpleFeatureCollection firstFeatures, @DescribeParameter(name = "second", description = "Second feature collection") SimpleFeatureCollection secondFeatures) { return new IncludedFeatureCollection(firstFeatures, secondFeatures); }  @DescribeResult(description = "Output feature collection") SimpleFeatureCollection execute(
            @DescribeParameter(name = "first", description = "First feature collection") SimpleFeatureCollection firstFeatures,
            @DescribeParameter(name = "second", description = "Second feature collection") SimpleFeatureCollection secondFeatures);  }
@Test public void testExecute() throws Exception { SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); tb.setName("featureType"); tb.add("geometry", Geometry.class); 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()); Coordinate firstArray[] = new Coordinate[5]; for (int numFeatures = 0; numFeatures < 1; numFeatures++) { firstArray[0] = new Coordinate(0, 0); firstArray[1] = new Coordinate(1, 0); firstArray[2] = new Coordinate(1, 1); firstArray[3] = new Coordinate(0, 1); firstArray[4] = new Coordinate(0, 0); LinearRing shell = gf.createLinearRing(firstArray); b.add(gf.createPolygon(shell, null)); b.add(0); features.add(b.buildFeature(numFeatures + "")); } for (int numFeatures = 0; numFeatures < 1; numFeatures++) { Coordinate array[] = new Coordinate[5]; array[0] = new Coordinate(firstArray[0].x - 1, firstArray[0].y - 1); array[1] = new Coordinate(firstArray[1].x + 1, firstArray[1].y - 1); array[2] = new Coordinate(firstArray[2].x + 1, firstArray[2].y + 1); array[3] = new Coordinate(firstArray[3].x - 1, firstArray[3].y + 1); array[4] = new Coordinate(firstArray[0].x - 1, firstArray[0].y - 1); LinearRing shell = gf.createLinearRing(array); b.add(gf.createPolygon(shell, null)); b.add(0); secondFeatures.add(b.buildFeature(numFeatures + "")); } InclusionFeatureCollection process = new InclusionFeatureCollection(); SimpleFeatureCollection output = process.execute(features, secondFeatures); assertEquals(1, output.size()); SimpleFeatureIterator iterator = output.features(); Geometry expected = (Geometry) features.features().next().getDefaultGeometry(); SimpleFeature sf = iterator.next(); assertTrue(expected.equals((Geometry) sf.getDefaultGeometry())); }