summaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/xml/XmlElementTests.java
blob: f82b11ec35d2999127d67ed880122c278a7ec62e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package org.zwobble.mammoth.tests.xml;

import org.junit.jupiter.api.Test;
import org.zwobble.mammoth.internal.xml.XmlElement;
import org.zwobble.mammoth.internal.xml.XmlNodes;

import static org.junit.jupiter.api.Assertions.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());
    }
}