FileTypeIconTag extends TagSupport { protected String extractDescriptionFromMapping(final String mapping) { if (StringUtils.isEmpty(mapping)) { return null; } final String[] s = mapping.trim().split(";"); return s.length > 1 ? s[1] : null; }  @Override int doStartTag(); void setFallbackIcon(final String fallbackIcon); void setFilename(final String filename);  }
@Test public void testExtractDescriptionFromMapping() throws Exception { final FileTypeIconTag iconTag = new FileTypeIconTag(); assertEquals(null, iconTag.extractDescriptionFromMapping(null)); assertEquals(null, iconTag.extractDescriptionFromMapping("")); assertEquals(null, iconTag.extractDescriptionFromMapping("images/icon_file_zip.png")); assertEquals(null, iconTag.extractDescriptionFromMapping("images/icon_file_zip.png ")); assertEquals(null, iconTag.extractDescriptionFromMapping("images/icon_file_zip.png;")); assertEquals("Web archive", iconTag.extractDescriptionFromMapping("images/icon_file_zip.png;Web archive")); }