SimpleElementReader implements ElementReader { public String getAttribute(Element element, String attribute) { return element.getAttribute(attribute).trim(); }  String getAttribute(Element element, String attribute); String getNodeValue(Element element);  }
@Test public void testGetAttribute() { Element element = mock(Element.class); when(element.getAttribute("A")).thenReturn(" B "); String result = reader.getAttribute(element, "A"); assertEquals("B", result); }