ConverterSwingWorker extends ProgressMonitorSwingWorker<List<Exception>, File> { static void addSelectedProductGeometry(Geometry geometry, HashMap<String, Object> parameterMap) { if (geometry instanceof Polygon) { final WKTWriter wktWriter = new WKTWriter(); final String multiPolygonWkt = wktWriter.write(geometry); parameterMap.put("region", multiPolygonWkt); } } ConverterSwingWorker(AppContext appContext, ExportParameter exportParameter);   }
@Test public void testAddSelectedGeometry_polygon() throws ConversionException { final JtsGeometryConverter converter = new JtsGeometryConverter(); final Geometry polygon = converter.parse("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"); final HashMap<String, Object> parameterMap = new HashMap<>(); ConverterSwingWorker.addSelectedProductGeometry(polygon, parameterMap); final String region = (String) parameterMap.get("region"); assertEquals("POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))", region); }
@Test public void testAddSelectedGeometry_point() throws ConversionException { final JtsGeometryConverter converter = new JtsGeometryConverter(); final Geometry polygon = converter.parse("POINT(4 6))"); final HashMap<String, Object> parameterMap = new HashMap<>(); ConverterSwingWorker.addSelectedProductGeometry(polygon, parameterMap); assertFalse(parameterMap.containsKey("region")); }