### Question:
CssWebResource extends AbstractWebResourceFormatter { public String formatResource(String url, Map<String, String> params) { StringBuffer buffer = new StringBuffer(); buffer.append("<link type=\"text/css\" rel=\"stylesheet\" href=\"").append(url).append("\""); List attributes = getParametersAsAttributes(params); if (attributes != null && attributes.size() > 0) { buffer.append(" ").append(StringUtils.join(attributes.iterator(), " ")); } if (!params.containsKey(MEDIA_PARAM)) { buffer.append(" media=\"all\""); } buffer.append(">\n"); if (BooleanUtils.toBoolean(params.get(IEONLY_PARAM))) { buffer.insert(0, "<!--[if IE]>\n"); buffer.append("<![endif]-->\n"); } return buffer.toString(); }  boolean matches(String name); String formatResource(String url, Map<String, String> params);  }### Answer:
@Test public void testFormatIEResource() { final String url = "/confluence/download/resources/confluence.web.resources:master-styles/master-ie.css"; Map<String, String> params = new HashMap<String, String>(); params.put("ieonly", "true"); params.put("media", "screen"); assertEquals("<!--[if IE]>\n" + "<link type=\"text/css\" rel=\"stylesheet\" href=\"" + url + "\" media=\"screen\">\n" + "<![endif]-->\n", cssWebResource.formatResource(url, params)); }
@Test public void testFormatResource() { final String url = "/confluence/download/resources/confluence.web.resources:master-styles/master.css"; assertEquals("<link type=\"text/css\" rel=\"stylesheet\" href=\"" + url + "\" media=\"all\">\n", cssWebResource.formatResource(url, new HashMap<String, String>())); }
@Test public void testFormatResourceWithParameters() { final String url = "/confluence/download/resources/confluence.web.resources:master-styles/master.css"; HashMap<String, String> params = new HashMap<String, String>(); params.put("title", "Confluence Master CSS"); params.put("charset", "utf-8"); params.put("foo", "bar"); assertEquals("<link type=\"text/css\" rel=\"stylesheet\" href=\"" + url + "\" title=\"Confluence Master CSS\"" + " charset=\"utf-8\" media=\"all\">\n", cssWebResource.formatResource(url, params)); }