Handle toString for XhtmlNode when nodeType == null
This commit is contained in:
parent
2156a44395
commit
8ab4340014
|
@ -626,6 +626,9 @@ public class XhtmlNode extends XhtmlFluent implements IBaseXhtml {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
if (nodeType == null) {
|
||||||
|
return super.toString();
|
||||||
|
}
|
||||||
switch (nodeType) {
|
switch (nodeType) {
|
||||||
case Document:
|
case Document:
|
||||||
case Element:
|
case Element:
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package org.hl7.fhir.utilities.xhtml;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
public class XhtmlTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToStringOnNullType()
|
||||||
|
{
|
||||||
|
XhtmlNode node = new XhtmlNode(null, "Blah");
|
||||||
|
String actual = node.toString();
|
||||||
|
assertTrue(actual.startsWith("org.hl7.fhir.utilities.xhtml.XhtmlNode@"), "toString() should return java the toString default method for objects, which starts with the full class name");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue