public AttributeList getAttributeList(Element e) throws ConfigurationException { AttributeList attributeList = new AttributeList(); List childs = e.getChildren("attr"); for (Object child : childs) { Element childElement = (Element) child; String name = childElement.getAttributeValue("name"); name = getAttributeName(name); Attribute attr = new Attribute(name, getObject(childElement)); attributeList.add(attr); } return attributeList; }
@Test public void testGetAttributeName() throws Throwable { String result = new QFactory(new ObjectName(""), null).getAttributeName("testQFactoryName"); assertEquals("result", "TestQFactoryName", result); }
@Test public void testGetAttributeNameThrowsNullPointerException() throws Throwable { try { new QFactory(new ObjectName(""), null).getAttributeName(null); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); } }