Source:
public void testGeometryProcessing() throws MalformedScriptException { URI uri = URI.create(UUID.randomUUID().toString()); Map<URI, Object> dataMap = new HashMap<>(); dataMap.put(uri, "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))"); List<Format> formatList = FormatFactory.getFormatsFromExtensions(new String[]{".txt"}); List<DataType> geometryList = new ArrayList<>(); geometryList.add(DataType.POLYGON); GeometryData geometryData = new GeometryData(formatList, geometryList); geometryData.setExcludedTypeList(new ArrayList<DataType>()); geometryData.setDimension(2); CodeType identifier = new CodeType(); identifier.setValue(uri.toString()); InputDescriptionType input = new InputDescriptionType(); input.setIdentifier(identifier); input.setDataDescription(objectFactory.createGeometryData(geometryData)); dataProcessingManager.preProcessData(input, dataMap, null); Object result = dataMap.get(uri); Assert.assertTrue("The object resulting of the preprocessing of the geometry data should be a geometry.", result instanceof Geometry); Geometry geometry = (Geometry)result; Assert.assertEquals("The geometry dimension should be 2.", 2, geometry.getDimension()); Assert.assertEquals("The bounding box geometry wasn't the one expected.", "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))", wktWriter.write(geometry)); OutputDescriptionType output = new OutputDescriptionType(); output.setIdentifier(identifier); output.setDataDescription(objectFactory.createGeometryData(geometryData)); dataProcessingManager.postProcessData(output, dataMap, new HashMap<URI, Object>() ,null); Object result2 = dataMap.get(uri); Assert.assertTrue("The object resulting of the postprocessing of the bounding box should be a String.", result2 instanceof String); String str = result2.toString(); Assert.assertEquals("The bounding box geometry wasn't the one expected.", "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))", str); }

Target:
public void testGeometryProcessing() { URI uri = URI.create(UUID.randomUUID().toString()); Map<URI, Object> dataMap = new HashMap<>(); dataMap.put(uri, "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))"); List<Format> formatList = FormatFactory.getFormatsFromExtensions(new String[]{".txt"}); List<DataType> geometryList = new ArrayList<>(); geometryList.add(DataType.POLYGON); GeometryData geometryData = null; try { geometryData = new GeometryData(formatList, geometryList); } catch (MalformedScriptException ignored) geometryData.setDimension(2); CodeType identifier = new CodeType(); identifier.setValue(uri.toString()); InputDescriptionType input = new InputDescriptionType(); input.setIdentifier(identifier); input.setDataDescription(objectFactory.createGeometryData(geometryData)); dataProcessingManager.preProcessData(input, dataMap, null); Object result = dataMap.get(uri); Assert.assertTrue("The object resulting of the preprocessing of the geometry data should be a geometry.", result instanceof Geometry); Geometry geometry = (Geometry)result; Assert.assertEquals("The geometry dimension should be 2.", 2, geometry.getDimension()); Assert.assertEquals("The bounding box geometry wasn't the one expected.", "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))", wktWriter.write(geometry)); OutputDescriptionType output = new OutputDescriptionType(); output.setIdentifier(identifier); output.setDataDescription(objectFactory.createGeometryData(geometryData)); dataProcessingManager.postProcessData(output, dataMap, new HashMap<URI, Object>() ,null); Object result2 = dataMap.get(uri); Assert.assertTrue("The object resulting of the postprocessing of the bounding box should be a String.", result2 instanceof String); String str = result2.toString(); Assert.assertEquals("The bounding box geometry wasn't the one expected.", "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))", str); }