diff options
Diffstat (limited to 'src/test/java/org/zwobble/mammoth/tests/xml/XmlElementTests.java')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/xml/XmlElementTests.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/xml/XmlElementTests.java b/src/test/java/org/zwobble/mammoth/tests/xml/XmlElementTests.java new file mode 100644 index 0000000..f396b1b --- /dev/null +++ b/src/test/java/org/zwobble/mammoth/tests/xml/XmlElementTests.java @@ -0,0 +1,21 @@ +package org.zwobble.mammoth.tests.xml; + +import org.junit.Test; +import org.zwobble.mammoth.internal.xml.XmlElement; +import org.zwobble.mammoth.internal.xml.XmlNodes; + +import static org.junit.Assert.assertEquals; +import static org.zwobble.mammoth.tests.util.MammothAsserts.assertThrows; + +public class XmlElementTests { + @Test + public void TryingToGetNonExistentAttributeThrowsException() { + XmlElement element = XmlNodes.element("p"); + + RuntimeException exception = assertThrows( + RuntimeException.class, + () -> element.getAttribute("class")); + + assertEquals("Element has no 'class' attribute", exception.getMessage()); + } +} |
