### Question:
CachedPointSymbolizer extends CachedSymbolizer<PointSymbolizer> { @Override public float getMargin(Object candidate, RenderingContext2D ctx) { return cachedGraphic.getMargin(candidate, ctx.getUnitCoefficient(this.styleElement.getUnitOfMeasure())); } CachedPointSymbolizer(final PointSymbolizer point,
            final SymbolizerRendererService<PointSymbolizer,? extends CachedSymbolizer<PointSymbolizer>> renderer); @Override float getMargin(Object candidate, RenderingContext2D ctx); @Override boolean isVisible(final Object candidate); BufferedImage getImage(final Object candidate, final float coeff, final RenderingHints hints); BufferedImage getImage(final Object candidate, final float coeff, boolean withRotation, final RenderingHints hints); BufferedImage getImage(final Object candidate, final Float forcedSize, final float coeff, final RenderingHints hints); BufferedImage getImage(final Object candidate, final Float forcedSize,
            final float coeff, boolean withRotation, final RenderingHints hints); float[] getDisplacement(final Object candidate, final float[] buffer); float[] getAnchor(final Object candidate, final float[] buffer); float getRotation(final Object candidate);  }### Answer:
@Test public void testMargin() throws FactoryException{ final J2DCanvas canvas = new J2DCanvasBuffered(CommonCRS.WGS84.normalizedGeographic(), new Dimension(1, 1)); final RenderingContext2D ctx = new RenderingContext2D(canvas); final BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); canvas.prepareContext(ctx, img.createGraphics(), new Rectangle(1, 1)); { final List<GraphicalSymbol> symbols = new ArrayList<>(); final Stroke stroke = SF.stroke(Color.BLACK, 2); final Fill fill = SF.fill(Color.RED); final Mark mark = SF.mark(MARK_CIRCLE, fill, stroke); symbols.add(mark); final Graphic graphic = SF.graphic(symbols, LITERAL_ONE_FLOAT, FF.literal(12), LITERAL_ONE_FLOAT, DEFAULT_ANCHOR_POINT, DEFAULT_DISPLACEMENT); final PointSymbolizer symbolizer = SF.pointSymbolizer("mySymbol",(String)null,DEFAULT_DESCRIPTION, Units.POINT, graphic); final CachedSymbolizer cached = GO2Utilities.getCached(symbolizer, null); final float margin = cached.getMargin(null, ctx); assertEquals(8f,margin,DELTA); } { final List<GraphicalSymbol> symbols = new ArrayList<>(); final Stroke stroke = SF.stroke(Color.BLACK, 2); final Fill fill = SF.fill(Color.RED); final Mark mark = SF.mark(MARK_CIRCLE, fill, stroke); symbols.add(mark); final Graphic graphic = SF.graphic(symbols, LITERAL_ONE_FLOAT, FF.literal(12), LITERAL_ONE_FLOAT, DEFAULT_ANCHOR_POINT, SF.displacement(10, 15)); final PointSymbolizer symbolizer = SF.pointSymbolizer("mySymbol",(String)null,DEFAULT_DESCRIPTION, Units.POINT, graphic); final CachedSymbolizer cached = GO2Utilities.getCached(symbolizer, null); final float margin = cached.getMargin(null, ctx); assertEquals(23f,margin,DELTA); } { final List<GraphicalSymbol> symbols = new ArrayList<>(); final Stroke stroke = SF.stroke(Color.BLACK, 2); final Fill fill = SF.fill(Color.RED); final Mark mark = SF.mark(MARK_CIRCLE, fill, stroke); symbols.add(mark); final Graphic graphic = SF.graphic(symbols, LITERAL_ONE_FLOAT, FF.literal(12), LITERAL_ONE_FLOAT, SF.anchorPoint(0, 1.7), SF.displacement(10, 15)); final PointSymbolizer symbolizer = SF.pointSymbolizer("mySymbol",(String)null,DEFAULT_DESCRIPTION, Units.POINT, graphic); final CachedSymbolizer cached = GO2Utilities.getCached(symbolizer, null); final float margin = cached.getMargin(null, ctx); assertEquals(23f+19.2f,margin,DELTA); } }