blob: f396b1b4a37da3fada7f9e94ff143690ae07a8aa (
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.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());
}
}
|