SvgDrawContext { public void addNamedObject(String name, ISvgNodeRenderer namedObject) { if (namedObject == null) { throw new SvgProcessingException(SvgLogMessageConstant.NAMED_OBJECT_NULL); } if (name == null || name.isEmpty()) { throw new SvgProcessingException(SvgLogMessageConstant.NAMED_OBJECT_NAME_NULL_OR_EMPTY); } if (!this.namedObjects.containsKey(name)) { this.namedObjects.put(name, namedObject); } } SvgDrawContext(ResourceResolver resourceResolver, FontProvider fontProvider);  SvgDrawContext(ResourceResolver resourceResolver, FontProvider fontProvider, ISvgNodeRenderer svgRootRenderer); PdfCanvas getCurrentCanvas(); PdfCanvas popCanvas(); void pushCanvas(PdfCanvas canvas); int size(); void addViewPort(Rectangle viewPort); Rectangle getCurrentViewPort(); Rectangle getRootViewPort(); void removeCurrentViewPort(); void addNamedObject(String name, ISvgNodeRenderer namedObject); ISvgNodeRenderer getNamedObject(String name); ResourceResolver getResourceResolver(); void addNamedObjects(Map<String, ISvgNodeRenderer> namedObjects); FontProvider getFontProvider(); FontSet getTempFonts(); void setTempFonts(FontSet tempFonts); boolean isIdUsedByUseTagBefore(String elementId); void addUsedId(String elementId); void removeUsedId(String elementId); AffineTransform getLastTextTransform(); void setLastTextTransform(AffineTransform newTransform); float[] getTextMove(); void resetTextMove(); void addTextMove(float additionalMoveX, float additionalMoveY); AffineTransform getCurrentCanvasTransform(); float getRemValue();  }
@Test public void addNullToNamedObjects() { junitExpectedException.expect(SvgProcessingException.class); junitExpectedException.expectMessage(SvgLogMessageConstant.NAMED_OBJECT_NULL); String name = "expected"; this.context.addNamedObject(name, null); }
@Test public void addNamedObjectWithNullName() { junitExpectedException.expect(SvgProcessingException.class); junitExpectedException.expectMessage(SvgLogMessageConstant.NAMED_OBJECT_NAME_NULL_OR_EMPTY); ISvgNodeRenderer expected = new DummySvgNodeRenderer(); this.context.addNamedObject(null, expected); }
@Test public void addNamedObjectWithEmptyName() { junitExpectedException.expect(SvgProcessingException.class); junitExpectedException.expectMessage(SvgLogMessageConstant.NAMED_OBJECT_NAME_NULL_OR_EMPTY); ISvgNodeRenderer expected = new DummySvgNodeRenderer(); this.context.addNamedObject("", expected); }