@Test
public void readAttribute() throws XMLStreamException, FactoryConfigurationError, IOException {

  URL url = XmlHelperTest.class.getResource("/xml/default/kb-layout.xml");
  XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(url.openStream());
  reader.next();
  reader.require(XMLStreamConstants.START_ELEMENT, null, XmlHelper.KEYBOARD);
  assertEquals("40", XmlHelper.readAttribute(reader, XmlHelper.ATTR_KEY_WIDTH).orElse(null));
  assertEquals("30", XmlHelper.readAttribute(reader, XmlHelper.ATTR_KEY_HEIGHT).orElse(null));
  assertEquals("0", XmlHelper.readAttribute(reader, XmlHelper.ATTR_H_GAP).orElse(null));
  assertEquals("0", XmlHelper.readAttribute(reader, XmlHelper.ATTR_V_GAP).orElse(null));
  assertNull(XmlHelper.readAttribute(reader, "verticalGapX").orElse(null));
  assertNull(XmlHelper.readAttribute(reader, "").orElse(null));
  assertNull(XmlHelper.readAttribute(reader, null).orElse(null));
}