JHighlightColorer implements Colorer { protected Renderer getRenderer(final String fileExtension) { Validate.notNull(fileExtension, "File extension cannot be null"); return rendererMappings.get(fileExtension.toLowerCase()); }  @Override String getColorizedContent(final String content, final String fileExtension, final String encoding); void setRendererMappings(final Map<String, Renderer> rendererMappings);  }
@Test public void testGetRenderer() throws Exception { final JHighlightColorer colorer = new JHighlightColorer(); colorer.setRendererMappings(getRendererMappings()); try { colorer.getRenderer(null); fail("If content is null, IAE is expected."); } catch (IllegalArgumentException iae) { } assertNull(colorer.getRenderer("")); assertNull(colorer.getRenderer("txt")); assertNull(colorer.getRenderer("htm")); assertTrue(colorer.getRenderer("java") instanceof JavaXhtmlRenderer); assertTrue(colorer.getRenderer("xml") instanceof XmlXhtmlRenderer); assertTrue(colorer.getRenderer("cs") instanceof CSharpXhtmlRenderer); }