{
double widthValue = 13;
double scaleMetersToPixel = 17;
Unit<Length> uom = SI.METER;
StyleBuilder styleBuilder = new StyleBuilder();
UomRescaleStyleVisitor visitor = null;
// creates the feature used for the test
SimpleFeatureTypeBuilder featureTypeBuilder = new SimpleFeatureTypeBuilder();
featureTypeBuilder.setName("TestType");
featureTypeBuilder.add("geom", LineString.class, DefaultGeographicCRS.WGS84);
featureTypeBuilder.add("width", Double.class);
SimpleFeatureType featureType = featureTypeBuilder.buildFeatureType();
GeometryFactory geomFactory = new GeometryFactory();
Geometry geom = geomFactory.createLineString(new Coordinate[] { new Coordinate(1,1), new Coordinate(2,2) });
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType);
featureBuilder.set("geom", geom);
featureBuilder.set("width", widthValue);
SimpleFeature feature = featureBuilder.buildFeature("1");
// creates the symbolizer for the test
Expression color = styleBuilder.colorExpression(Color.RED);
Expression width = styleBuilder.attributeExpression("width");
Stroke stroke = styleBuilder.createStroke(color, width);
LineSymbolizerImpl lineSymb = (LineSymbolizerImpl) styleBuilder.createLineSymbolizer(stroke);
lineSymb.setUnitOfMeasure(uom);
// rescales symbolizer
visitor = new UomRescaleStyleVisitor(scaleMetersToPixel);