### Question:
AbstractTagHandler implements TagHandler { protected final <T> T getValueFromTag(Element tag, String name, TemplateProcessor processor, Class<T> type) { if (tag.hasAttribute(name)) { return processor.evaluate(tag.getAttribute(name), type, null); } else { return null; } } AbstractTagHandler(String namespaceUri, String tagName); String getTagName(); String getNamespaceUri();  }### Answer:
@Test public void getValueFromTag() { Element element = document.createElement("test"); element.setAttribute("key", "expression"); expect(templateProcessor.evaluate(eq("expression"), eq(String.class), (String) isNull())) .andReturn("evaluated"); replay(templateProcessor); assertEquals("evaluated", handler.getValueFromTag(element, "key", templateProcessor, String.class)); verify(templateProcessor); }
@Test public void getValueFromTagNoAttribute() { Element element = document.createElement("test"); replay(templateProcessor); assertNull(handler.getValueFromTag(element, "notthere", templateProcessor, String.class)); verify(templateProcessor); }