CentroidProcess implements VectorProcess { @DescribeResult(name = "result", description = "Centroids of input features") public SimpleFeatureCollection execute( @DescribeParameter(name = "features", description = "Input feature collection") SimpleFeatureCollection features) throws ProcessException { return DataUtilities.simple(new CentroidFeatureCollection(features)); }  @DescribeResult(name = "result", description = "Centroids of input features") SimpleFeatureCollection execute(
            @DescribeParameter(name = "features", description = "Input feature collection") SimpleFeatureCollection features);  }
@Test public void testSchema() { CentroidProcess cp = new CentroidProcess(); SimpleFeatureCollection result = cp.execute(fc); SimpleFeatureType ft = result.getSchema(); assertEquals(2, ft.getAttributeCount()); assertEquals(Point.class, ft.getGeometryDescriptor().getType().getBinding()); assertEquals(String.class, ft.getDescriptor("name").getType().getBinding()); }
@Test public void testResults() throws Exception { CentroidProcess cp = new CentroidProcess(); SimpleFeatureCollection result = cp.execute(fc); SimpleFeatureIterator it = result.features(); assertTrue(it.hasNext()); SimpleFeature f = it.next(); assertEquals(0, ((Point) f.getDefaultGeometry()).getX(), 1e-6); assertEquals(0, ((Point) f.getDefaultGeometry()).getY(), 1e-6); assertEquals("one", f.getAttribute("name")); f = it.next(); assertEquals(10, ((Point) f.getDefaultGeometry()).getX(), 1e-6); assertEquals(0, ((Point) f.getDefaultGeometry()).getY(), 1e-6); assertEquals("two", f.getAttribute("name")); }