DimensionFormatter implements Formatter { @Override public Element buildCategoryTag(CategorySummary result) { Element dimensionTag = new Element("category"); dimensionTag.setAttribute("value", result.value); dimensionTag.setAttribute("label", result.label); dimensionTag.setAttribute("count", Integer.toString(result.count)); return dimensionTag; } DimensionFormatter(Dimension dimension); @Override Element buildDimensionTag(int count); @Override Element buildCategoryTag(CategorySummary result);  }
@Test public void testBuildCategoryTag() { CategorySummary result = new CategorySummary(); result.value = "oceans"; result.label = "Oceans"; result.count = 3; Element categoryTag = formatter.buildCategoryTag(result); assertEquals("category", categoryTag.getName()); assertEquals(0, categoryTag.getContent().size()); assertEquals(3, categoryTag.getAttributes().size()); assertEquals("oceans", categoryTag.getAttributeValue("value")); assertEquals("Oceans", categoryTag.getAttributeValue("label")); assertEquals("3", categoryTag.getAttributeValue("count")); }