Modified: xmlbeans/trunk/src/test/java/dom/checkin/DocumentTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/DocumentTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/DocumentTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/DocumentTest.java Sun Feb 6 01:51:55 2022 @@ -17,9 +17,9 @@ package dom.checkin; import dom.common.NodeWithChildrenTest; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.w3c.dom.*; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -27,7 +27,7 @@ import org.xml.sax.SAXException; import java.io.IOException; import java.io.StringReader; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class DocumentTest extends NodeWithChildrenTest { @@ -36,7 +36,7 @@ public class DocumentTest extends NodeWi m_node = m_doc; } - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); moveToNode(); @@ -55,75 +55,75 @@ public class DocumentTest extends NodeWi } @Test - public void testNodeName() { + void testNodeName() { assertEquals("#document", m_node.getNodeName()); } @Test - public void testNodeType() { + void testNodeType() { assertEquals(Node.DOCUMENT_NODE, m_node.getNodeType()); } @Test - public void testNodeValue() { + void testNodeValue() { assertNull(m_node.getNodeValue()); } @Test - public void testNextSibling() { + void testNextSibling() { assertNull(m_node.getNextSibling()); } @Test - public void testPreviousSibling() { + void testPreviousSibling() { assertNull(m_node.getPreviousSibling()); } @Test - public void testParent() { + void testParent() { assertNull(m_node.getParentNode()); } @Test - public void testOwnerDocument() { + protected void testOwnerDocument() { assertNull(m_node.getOwnerDocument());//API spec } @Test - public void testChildNodes() { + void testChildNodes() { assertEquals(1, m_node.getChildNodes().getLength()); } @Test - public void testFirstChild() { + protected void testFirstChild() { assertEquals("foo", m_node.getFirstChild().getLocalName()); } @Test - public void testLastChild() { + protected void testLastChild() { assertEquals("foo", m_node.getLastChild().getLocalName()); } @Test - public void testAppendChild() { + protected void testAppendChild() { DOMException de = assertThrows(DOMException.class, super::testAppendChild); assertEquals(DOMException.HIERARCHY_REQUEST_ERR, de.code); } @Test - public void testInsertBefore() { + protected void testInsertBefore() { DOMException de = assertThrows(DOMException.class, super::testInsertBefore); assertEquals(DOMException.HIERARCHY_REQUEST_ERR, de.code); } @Test - public void testInsertBeforeNullTarget() { + protected void testInsertBeforeNullTarget() { DOMException de = assertThrows(DOMException.class, super::testInsertBeforeNullTarget); assertEquals(DOMException.HIERARCHY_REQUEST_ERR, de.code); } @Test - public void testInsertExistingNode() { + void testInsertExistingNode() { DOMException de = assertThrows(DOMException.class, () -> super.testInsertExistingNode(m_node.getFirstChild())); assertEquals(DOMException.HIERARCHY_REQUEST_ERR, de.code); } @@ -157,17 +157,17 @@ public class DocumentTest extends NodeWi // } @Test - public void testGetChildNodes() { + protected void testGetChildNodes() { assertEquals(1, m_node.getChildNodes().getLength()); } @Test - public void testSetPrefix() { + protected void testSetPrefix() { super.testSetPrefix(); //see charData--is the exception correct } @Test - public void testInsertExisitingNode() { + void testInsertExisitingNode() { Node child = m_doc.getFirstChild().getFirstChild(); if (child == m_node) { child = m_doc.getLastChild(); @@ -179,31 +179,31 @@ public class DocumentTest extends NodeWi } @Test - public void testAppendChildExisting() { + void testAppendChildExisting() { Node child = m_node.getFirstChild().getFirstChild(); DOMException de = assertThrows(DOMException.class, () -> super.testAppendChildExisting(child)); assertEquals(DOMException.HIERARCHY_REQUEST_ERR, de.code); } - @Ignore + @Disabled public void testNormalize() { //unque doc child--normalize in elt. or text or comment, etc } @Test - public void testInsertBeforeDocFrag() { + protected void testInsertBeforeDocFrag() { DOMException de = assertThrows(DOMException.class, super::testInsertBeforeDocFrag); assertEquals(DOMException.HIERARCHY_REQUEST_ERR, de.code); } @Test - public void testAppendChildDocFrag() { + protected void testAppendChildDocFrag() { DOMException de = assertThrows(DOMException.class, super::testAppendChildDocFrag); assertEquals(DOMException.HIERARCHY_REQUEST_ERR, de.code); } @Test - public void testReplaceChildFront() { + void testReplaceChildFront() { Node node = m_doc.getDocumentElement(); assertEquals(node, m_node.getFirstChild()); Node newNode = m_doc.createElement("fooBAR"); @@ -212,7 +212,7 @@ public class DocumentTest extends NodeWi } @Test - public void testReplaceChildEnd() { + void testReplaceChildEnd() { Node node = m_doc.getDocumentElement(); assertEquals(node, m_node.getFirstChild()); Node newNode = m_doc.createElement("fooBAR"); @@ -220,13 +220,13 @@ public class DocumentTest extends NodeWi } @Test - public void testReplaceChildDocFrag() { + protected void testReplaceChildDocFrag() { DOMException de = assertThrows(DOMException.class, super::testReplaceChildDocFrag); assertEquals(DOMException.HIERARCHY_REQUEST_ERR, de.code); } @Test - public void testCreateAttribute() { + void testCreateAttribute() { Attr att = m_doc.createAttribute("at0"); assertNull(att.getOwnerElement()); assertEquals(m_doc, att.getOwnerDocument()); @@ -236,7 +236,7 @@ public class DocumentTest extends NodeWi } @Test - public void testCreateAttributeNS() { + void testCreateAttributeNS() { Attr att = m_doc.createAttributeNS("foo:uri", "at0"); assertEquals("foo:uri", att.getNamespaceURI()); assertNull(att.getOwnerElement()); @@ -244,7 +244,7 @@ public class DocumentTest extends NodeWi } @Test - public void testCreateCDATASection() { + void testCreateCDATASection() { CDATASection cdata = m_doc.createCDATASection("<CDATA Section>"); assertNull(cdata.getParentNode()); assertEquals(m_doc, cdata.getOwnerDocument()); @@ -256,7 +256,7 @@ public class DocumentTest extends NodeWi } @Test - public void testCreateComment() { + void testCreateComment() { Comment comment = m_doc.createComment("A comment"); assertNull(comment.getParentNode()); assertEquals(m_doc, comment.getOwnerDocument()); @@ -266,7 +266,7 @@ public class DocumentTest extends NodeWi } @Test - public void testCreateDocumentFragment() { + void testCreateDocumentFragment() { DocumentFragment doc_frag = m_doc.createDocumentFragment(); assertNull(doc_frag.getParentNode()); assertEquals(m_doc, doc_frag.getOwnerDocument()); @@ -274,7 +274,7 @@ public class DocumentTest extends NodeWi } @Test - public void testCreateElement() { + void testCreateElement() { Element elt1 = m_doc.createElement("elt1"); assertNull(elt1.getParentNode()); assertEquals(m_doc, elt1.getOwnerDocument()); @@ -282,7 +282,7 @@ public class DocumentTest extends NodeWi } @Test - public void testCreateElementNS() { + void testCreateElementNS() { Element elt1 = m_doc.createElementNS("uri:foo", "ns:elt1"); assertEquals("uri:foo", elt1.getNamespaceURI()); assertNull(elt1.getParentNode()); @@ -290,21 +290,21 @@ public class DocumentTest extends NodeWi } @Test - public void testCreateProcessingInstruction() { + void testCreateProcessingInstruction() { DOMException de1 = assertThrows(DOMException.class, () -> m_doc.createProcessingInstruction("xml", "version 1.0")); assertEquals(DOMException.INVALID_CHARACTER_ERR, de1.code); ProcessingInstruction pi = m_doc.createProcessingInstruction("xml-foo", null); assertEquals("", pi.getData()); - assertThrows("PI target can't be null", IllegalArgumentException.class, () -> m_doc.createProcessingInstruction(null, "foo")); + assertThrows(IllegalArgumentException.class, () -> m_doc.createProcessingInstruction(null, "foo"), "PI target can't be null"); - DOMException de3 = assertThrows("Invalid pi name", DOMException.class, () -> m_doc.createProcessingInstruction("invalid@", "foo")); + DOMException de3 = assertThrows(DOMException.class, () -> m_doc.createProcessingInstruction("invalid@", "foo"), "Invalid pi name"); assertEquals(DOMException.INVALID_CHARACTER_ERR, de3.code); } @Test - public void testCreateTextNode() { + void testCreateTextNode() { Text txt0 = m_doc.createTextNode("foo"); assertNull(txt0.getParentNode()); assertEquals(m_doc, txt0.getOwnerDocument()); @@ -314,12 +314,12 @@ public class DocumentTest extends NodeWi } @Test - public void testGetDocumentElement() { + void testGetDocumentElement() { assertEquals(m_doc.getDocumentElement(), m_node.getFirstChild()); } @Test - public void testGetElementsByTagName() { + void testGetElementsByTagName() { //move node @ foo m_node = m_docNS; NodeList result = ((Document) m_node).getElementsByTagName("*"); @@ -333,24 +333,23 @@ public class DocumentTest extends NodeWi //elts need to come out in preorder order @Test - public void testGetElementsByTagNamePreorder() { + void testGetElementsByTagNamePreorder() { m_node = m_docNS; NodeList result = ((Document) m_node).getElementsByTagName("foo"); assertEquals(2, result.getLength()); assertEquals("txt0", result.item(0).getFirstChild().getNodeValue()); - assertEquals("nestedfoo", - result.item(1).getFirstChild().getNodeValue()); + assertEquals("nestedfoo", result.item(1).getFirstChild().getNodeValue()); } @Test - public void testGetElementsByTagNameDNE() { + void testGetElementsByTagNameDNE() { m_node = m_docNS; NodeList result = ((Document) m_node).getElementsByTagName("foobar"); assertEquals(0, result.getLength()); } @Test - public void testGetElementsByTagNameNS() { + void testGetElementsByTagNameNS() { m_node = m_docNS; NodeList result = ((Document) m_node).getElementsByTagNameNS("*", "*"); int nEltCount = 6; @@ -371,8 +370,7 @@ public class DocumentTest extends NodeWi */ result = ((Document) m_node).getElementsByTagNameNS(null, "foo"); assertEquals("txt0", result.item(0).getFirstChild().getNodeValue()); - assertEquals("nestedfoo", - result.item(1).getFirstChild().getNodeValue()); + assertEquals("nestedfoo", result.item(1).getFirstChild().getNodeValue()); NodeList result1 = ((Document) m_node).getElementsByTagNameNS("", "foo"); assertTrue(compareNodeList(result, result1)); @@ -384,7 +382,7 @@ public class DocumentTest extends NodeWi } @Test - public void testGetElementsByTagNameNS_DNE() { + void testGetElementsByTagNameNS_DNE() { m_node = m_docNS; NodeList result = ((Document) m_node).getElementsByTagNameNS("uri:foo", "zed"); assertEquals(0, result.getLength()); @@ -394,12 +392,12 @@ public class DocumentTest extends NodeWi } @Test - public void testGetImplementation() { + void testGetImplementation() { assertTrue(m_doc.getImplementation().toString().startsWith("org.apache.xmlbeans.impl.store")); } @Test - public void testImportNode() throws IOException, SAXException { + void testImportNode() throws IOException, SAXException { Node toImport = m_docNS.getFirstChild(); ((Document) m_node).importNode(toImport, true); @@ -435,7 +433,7 @@ public class DocumentTest extends NodeWi * they always carry their children with them when imported */ @Test - public void testImportAttrNode() { + void testImportAttrNode() { Node toImport = m_doc.getFirstChild().getAttributes().item(0); toImport.appendChild(m_doc.createTextNode("more text")); Node imported = m_docNS.importNode(toImport, false); @@ -455,7 +453,7 @@ public class DocumentTest extends NodeWi * Otherwise, this simply generates an empty DocumentFragment. */ @Test - public void testImportDocFrag() { + void testImportDocFrag() { Node toImport = m_doc.createDocumentFragment(); toImport.appendChild(m_doc.getFirstChild()); toImport.appendChild(m_doc.createTextNode("some text")); @@ -478,7 +476,7 @@ public class DocumentTest extends NodeWi * Document nodes cannot be imported. */ @Test - public void testImportDocument() { + void testImportDocument() { DOMException e1 = assertThrows(DOMException.class, () -> m_docNS.importNode(m_doc, false)); assertEquals(DOMException.NOT_SUPPORTED_ERR, e1.code); @@ -500,7 +498,7 @@ public class DocumentTest extends NodeWi */ //TODO: specified and default attributes @Test - public void testImportElement() { + void testImportElement() { Node toImport = m_doc.getFirstChild(); Node imported = m_docNS.importNode(toImport, false); @@ -544,7 +542,7 @@ public class DocumentTest extends NodeWi * values from those of the source node. */ @Test - public void testImportPI() { + void testImportPI() { Node pi = m_doc.createProcessingInstruction("xml-stylesheet", "do something"); m_doc.getFirstChild().appendChild(pi); @@ -552,10 +550,8 @@ public class DocumentTest extends NodeWi Node imported = m_docNS.importNode(pi, false); assertNull(imported.getParentNode()); assertEquals(Node.PROCESSING_INSTRUCTION_NODE, imported.getNodeType()); - assertEquals("do something", - ((ProcessingInstruction) imported).getData()); - assertEquals("xml-stylesheet", - ((ProcessingInstruction) imported).getTarget()); + assertEquals("do something", ((ProcessingInstruction) imported).getData()); + assertEquals("xml-stylesheet", ((ProcessingInstruction) imported).getTarget()); assertEquals(imported.getOwnerDocument(), m_docNS); } @@ -565,7 +561,7 @@ public class DocumentTest extends NodeWi * data and length attributes from those of the source node. */ @Test - public void testImportChars() { + void testImportChars() { //import CDATA--nothing to do--it's always text //import text @@ -598,7 +594,7 @@ public class DocumentTest extends NodeWi } @Test - public void testImportNodeNull() { + void testImportNodeNull() { ((Document) m_node).importNode(null, true); ((Document) m_node).importNode(null, false); }
Modified: xmlbeans/trunk/src/test/java/dom/checkin/DomImplementationSyncTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/DomImplementationSyncTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/DomImplementationSyncTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/DomImplementationSyncTest.java Sun Feb 6 01:51:55 2022 @@ -16,11 +16,10 @@ package dom.checkin; - -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class DomImplementationSyncTest extends DomImplementationTest { - @Before + @BeforeEach public void setUp() throws Exception { super.loadSync(); super.moveToNode(); Modified: xmlbeans/trunk/src/test/java/dom/checkin/DomImplementationTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/DomImplementationTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/DomImplementationTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/DomImplementationTest.java Sun Feb 6 01:51:55 2022 @@ -17,14 +17,14 @@ package dom.checkin; import dom.common.Loader; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class DomImplementationTest { @@ -42,7 +42,7 @@ public class DomImplementationTest { //$TODO: non null doctype @Test - public void testCreateDocument() { + void testCreateDocument() { String sUri = "http://foo.org"; String sQName = "qname"; result = m_imp.createDocument(sUri, sQName, m_docType); @@ -54,7 +54,7 @@ public class DomImplementationTest { //$TODO: implem. w/o "XML" feature; WRONG_DOCUMENT_ERR //NOT_SUPPORTED_ERR @Test - public void testCreateDocumentInvalid() { + void testCreateDocumentInvalid() { String sUri = "http://foo.org"; String sQName = "<qname"; try { @@ -85,7 +85,7 @@ public class DomImplementationTest { } @Test - public void testHasFeature() { + void testHasFeature() { String[] features = { "Core", "XML", "Events", "MutationEvents", "Range", "Traversal", "HTML", "Views", "StyleSheets", "CSS", "CSS2", "UIEvents", "HTMLEvents" }; @@ -101,7 +101,7 @@ public class DomImplementationTest { } @Test - public void testHasFeatureIlegal() { + void testHasFeatureIlegal() { assertFalse(m_imp.hasFeature(null, "2.0")); assertFalse(m_imp.hasFeature("foobar", "2.0")); assertFalse(m_imp.hasFeature("xml", "-2")); @@ -119,11 +119,11 @@ public class DomImplementationTest { if (sXmlNS.length() > 0) - m_docNS = (org.w3c.dom.Document) _loader.loadSync(sXmlNS); + m_docNS = _loader.loadSync(sXmlNS); } - @Before + @BeforeEach public void setUp() throws Exception { _loader = Loader.getLoader(); m_docNS = (org.w3c.dom.Document) _loader.load(sXmlNS); Modified: xmlbeans/trunk/src/test/java/dom/checkin/DomTests.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/DomTests.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/DomTests.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/DomTests.java Sun Feb 6 01:51:55 2022 @@ -18,7 +18,7 @@ package dom.checkin; import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlObject; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.xml.sax.InputSource; @@ -27,7 +27,7 @@ import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory; import java.io.StringReader; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class DomTests { @@ -76,7 +76,7 @@ public class DomTests { // } @Test - public void testDom() + void testDom() throws Exception { doTest("<foo xmlns=\"x\"/>"); doTest("<foo xmlns=\"x\" xmlns:e=\"v\"/>"); Modified: xmlbeans/trunk/src/test/java/dom/checkin/ElementSyncTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/ElementSyncTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/ElementSyncTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/ElementSyncTest.java Sun Feb 6 01:51:55 2022 @@ -15,12 +15,11 @@ package dom.checkin; - -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class ElementSyncTest extends ElementTest { - @Before + @BeforeEach public void setUp() throws Exception { super.loadSync(); super.moveToNode(); Modified: xmlbeans/trunk/src/test/java/dom/checkin/ElementTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/ElementTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/ElementTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/ElementTest.java Sun Feb 6 01:51:55 2022 @@ -18,12 +18,13 @@ package dom.checkin; import dom.common.NodeWithChildrenTest; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.w3c.dom.*; import xmlcursor.common.Common; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class ElementTest extends NodeWithChildrenTest { @@ -49,40 +50,40 @@ public class ElementTest extends NodeWit } @Test - public void testNodeName() { + void testNodeName() { assertEquals("zed", m_node.getNodeName()); } @Test - public void testNodeType() { + void testNodeType() { assertEquals(Node.ELEMENT_NODE, m_node.getNodeType()); } @Test - public void testNodeValue() { + void testNodeValue() { assertNull(m_node.getNodeValue()); } @Test - public void testNextSibling() { + void testNextSibling() { assertNull(m_node.getNextSibling()); } @Test - public void testPreviousSibling() { + void testPreviousSibling() { Node prSib = m_node.getPreviousSibling(); assertEquals("text0", prSib.getNodeValue()); } @Test - public void testParent() { + void testParent() { Node parent = m_node.getParentNode(); assertEquals("bar", parent.getLocalName()); assertEquals(m_doc.getFirstChild().getFirstChild(), parent); } @Test - public void testPrefix() { + protected void testPrefix() { assertEquals("", m_node.getPrefix()); m_node = m_docNS.getDocumentElement().getChildNodes().item(1); @@ -91,12 +92,12 @@ public class ElementTest extends NodeWit } @Test - public void testNamespaceUri() { + protected void testNamespaceUri() { assertEquals("", m_node.getNamespaceURI()); } @Test - public void testCloneNode() { + protected void testCloneNode() { super.testCloneNode(); } @@ -104,7 +105,7 @@ public class ElementTest extends NodeWit * Clone node with atts */ @Test - public void testCloneNodeAttrs() { + void testCloneNodeAttrs() { Node toClone = m_docNS.getFirstChild(); //the foo elt /* Node clone1=toClone.cloneNode(false); @@ -115,23 +116,22 @@ public class ElementTest extends NodeWit } @Test - public void testHasAttributes() { + protected void testHasAttributes() { super.testHasAttributes(); m_node = m_doc.getFirstChild(); assertTrue(m_node.hasAttributes()); } @Test - public void testGetAttribute() { + void testGetAttribute() { m_node = m_docNS.getFirstChild(); if (bDTD) assertEquals("0", ((Element) m_node).getAttribute("at_spec")); - assertEquals("val2", - ((Element) m_node.getFirstChild()).getAttribute("at2")); + assertEquals("val2", ((Element) m_node.getFirstChild()).getAttribute("at2")); } @Test - public void testGetAttributeDNE() { + void testGetAttributeDNE() { m_node = m_docNS.getFirstChild(); assertEquals("", ((Element) m_node).getAttribute("at3")); assertEquals("", ((Element) m_node).getAttribute("foobar")); @@ -140,20 +140,18 @@ public class ElementTest extends NodeWit } @Test - public void testGetAttributeNode() { + void testGetAttributeNode() { m_node = m_docNS.getFirstChild(); assertEquals("bar", ((Element) m_node).getTagName()); //assertEquals("uri:foo",((Attr)((Element)m_node).getAttributeNodeNS("xmlns","myns")).getNodeValue()); m_node = m_node.getFirstChild(); - assertEquals("val2", - ((Element) m_node).getAttributeNode("at2").getNodeValue()); + assertEquals("val2", ((Element) m_node).getAttributeNode("at2").getNodeValue()); if (bDTD) - assertEquals("0", - ((Element) m_node).getAttributeNode("at_spec").getNodeValue()); + assertEquals("0", ((Element) m_node).getAttributeNode("at_spec").getNodeValue()); } @Test - public void testGetAttributeNodeDNE() { + void testGetAttributeNodeDNE() { m_node = m_docNS.getFirstChild(); assertNull(((Element) m_node).getAttributeNode("at3")); assertNull(((Element) m_node).getAttributeNode("foobar")); @@ -162,22 +160,18 @@ public class ElementTest extends NodeWit } @Test - public void getAttributeNodeNS() { + void getAttributeNodeNS() { m_node = m_docNS.getFirstChild().getFirstChild(); if (bDTD) { - assertEquals("0", - ((Element) m_node).getAttributeNodeNS("", "at_spec").getNodeValue()); + assertEquals("0", ((Element) m_node).getAttributeNodeNS("", "at_spec").getNodeValue()); } - assertEquals("val01", - ((Element) m_node).getAttributeNodeNS("uri:foo", "at0").getNodeValue()); - assertEquals("val2", - ((Element) m_node).getAttributeNodeNS(null, "at2").getNodeValue()); - assertEquals("val3", - ((Element) m_node).getAttributeNodeNS("uri:foo", "at3").getNodeValue()); + assertEquals("val01", ((Element) m_node).getAttributeNodeNS("uri:foo", "at0").getNodeValue()); + assertEquals("val2", ((Element) m_node).getAttributeNodeNS(null, "at2").getNodeValue()); + assertEquals("val3", ((Element) m_node).getAttributeNodeNS("uri:foo", "at3").getNodeValue()); } @Test - public void testGetAttributeNodeNS_DNE() { + void testGetAttributeNodeNS_DNE() { m_node = m_docNS.getFirstChild(); assertNull(((Element) m_node).getAttributeNodeNS("", "at3")); assertNull(((Element) m_node).getAttributeNodeNS("uri:foo", "at1")); @@ -186,18 +180,16 @@ public class ElementTest extends NodeWit } @Test - public void testGetAttributeNS() { + void testGetAttributeNS() { m_node = m_docNS.getFirstChild().getFirstChild(); if (bDTD) - assertEquals("0", - ((Element) m_node).getAttributeNS(null, "at_spec")); - assertEquals("val01", - ((Element) m_node).getAttributeNS("uri:foo", "at0")); + assertEquals("0", ((Element) m_node).getAttributeNS(null, "at_spec")); + assertEquals("val01", ((Element) m_node).getAttributeNS("uri:foo", "at0")); assertEquals("val2", ((Element) m_node).getAttributeNS("", "at2")); } @Test - public void testGetAttributeNS_DNE() { + void testGetAttributeNS_DNE() { m_node = m_docNS.getFirstChild(); assertEquals("", ((Element) m_node).getAttributeNS("", "at3")); assertEquals("", ((Element) m_node).getAttributeNS("uri:foo", "at1")); @@ -206,7 +198,7 @@ public class ElementTest extends NodeWit } @Test - public void testGetElementsByTagName() { + void testGetElementsByTagName() { //move node @ foo m_node = m_node.getParentNode().getParentNode(); NodeList result = ((Element) m_node).getElementsByTagName("*"); @@ -220,7 +212,7 @@ public class ElementTest extends NodeWit } @Test - public void testGetElementsByTagNameDNE() { + void testGetElementsByTagNameDNE() { NodeList result = ((Element) m_node.getParentNode()).getElementsByTagName( "foobar"); assertEquals(0, result.getLength()); @@ -228,26 +220,24 @@ public class ElementTest extends NodeWit //elts need to come out in preorder order @Test - public void testGetElementsByTagNamePreorder() { + void testGetElementsByTagNamePreorder() { m_node = m_docNS.getFirstChild(); NodeList result = ((Element) m_node).getElementsByTagName("foo"); assertEquals(2, result.getLength()); assertEquals("txt0", result.item(0).getFirstChild().getNodeValue()); - assertEquals("nestedfoo", - result.item(1).getFirstChild().getNodeValue()); + assertEquals("nestedfoo", result.item(1).getFirstChild().getNodeValue()); } @Test - public void testGetElementsByTagNameDescendant() { + void testGetElementsByTagNameDescendant() { m_node = m_docNS.getFirstChild().getFirstChild(); NodeList result = ((Element) m_node).getElementsByTagName("foo");//self should not be selected assertEquals(1, result.getLength()); - assertEquals("nestedfoo", - result.item(0).getFirstChild().getNodeValue()); + assertEquals("nestedfoo", result.item(0).getFirstChild().getNodeValue()); } @Test - public void testGetElementsByTagNameNS() { + void testGetElementsByTagNameNS() { m_node = m_docNS.getFirstChild(); NodeList result = ((Element) m_node).getElementsByTagNameNS("*", "*"); int nEltCount = 6; @@ -257,8 +247,7 @@ public class ElementTest extends NodeWit nEltCount = 3; assertEquals(nEltCount, result.getLength()); assertEquals("txt0", result.item(0).getFirstChild().getNodeValue()); - assertEquals("nestedfoo", - result.item(1).getFirstChild().getNodeValue()); + assertEquals("nestedfoo", result.item(1).getFirstChild().getNodeValue()); assertEquals("nstext", result.item(2).getFirstChild().getNodeValue()); @@ -268,8 +257,7 @@ public class ElementTest extends NodeWit result = ((Element) m_node).getElementsByTagNameNS(null, "foo"); assertEquals("txt0", result.item(0).getFirstChild().getNodeValue()); - assertEquals("nestedfoo", - result.item(1).getFirstChild().getNodeValue()); + assertEquals("nestedfoo", result.item(1).getFirstChild().getNodeValue()); NodeList result1 = ((Element) m_node).getElementsByTagNameNS("", "foo"); assertTrue(compareNodeList(result, result1)); @@ -280,7 +268,7 @@ public class ElementTest extends NodeWit } @Test - public void testGetElementsByTagNameNS_DNE() { + void testGetElementsByTagNameNS_DNE() { m_node = m_docNS.getFirstChild(); NodeList result = ((Element) m_node).getElementsByTagNameNS("uri:foo", "zed"); @@ -292,7 +280,7 @@ public class ElementTest extends NodeWit } @Test - public void testGetTagName() { + void testGetTagName() { m_node = m_docNS.getFirstChild().getChildNodes().item(1).getChildNodes() .item(1); @@ -300,7 +288,7 @@ public class ElementTest extends NodeWit } @Test - public void testHasAttribute() { + void testHasAttribute() { m_node = m_docNS.getFirstChild(); if (bDTD) assertTrue(((Element) m_node).hasAttribute("at_spec")); @@ -311,7 +299,7 @@ public class ElementTest extends NodeWit } @Test - public void testHasAttributeNS() { + void testHasAttributeNS() { m_node = m_docNS.getFirstChild(); if (bDTD) assertTrue(((Element) m_node).hasAttributeNS(null, "at_spec")); @@ -323,7 +311,7 @@ public class ElementTest extends NodeWit } @Test - public void testRemoveAttribute() { + void testRemoveAttribute() { m_node = m_docNS.getFirstChild(); //remove default if (bDTD) { @@ -345,7 +333,7 @@ public class ElementTest extends NodeWit } @Test - public void testRemoveAttributeNode() { + void testRemoveAttributeNode() { Node removed; //remove default m_node = m_docNS.getFirstChild(); @@ -365,13 +353,13 @@ public class ElementTest extends NodeWit } @Test - public void testRemoveAttributeNode_DNE() { + void testRemoveAttributeNode_DNE() { //DNE Node removed; Attr remove = ((Element) m_node).getAttributeNode("at3"); try { removed = ((Element) m_node).removeAttributeNode(remove); - fail("removing Non existing attr"); + Assertions.fail("removing Non existing attr"); } catch (DOMException de) { assertEquals(DOMException.NOT_FOUND_ERR, de.code); } @@ -379,7 +367,7 @@ public class ElementTest extends NodeWit remove = null; try { removed = ((Element) m_node).removeAttributeNode(remove); - fail("removing Non existing attr"); + Assertions.fail("removing Non existing attr"); } catch (DOMException de) { assertEquals(DOMException.NOT_FOUND_ERR, de.code); } @@ -388,14 +376,14 @@ public class ElementTest extends NodeWit remove = m_doc.getDocumentElement().getAttributeNode("attr0"); try { removed = ((Element) m_node).removeAttributeNode(remove); - fail("removing Non existing attr"); + Assertions.fail("removing Non existing attr"); } catch (DOMException de) { assertEquals(DOMException.NOT_FOUND_ERR, de.code); } } @Test - public void testRemoveAttributeNS() { + void testRemoveAttributeNS() { //remove default m_node = m_docNS.getFirstChild(); if (bDTD) { @@ -415,12 +403,12 @@ public class ElementTest extends NodeWit } @Test - public void testSetAttribute() { + void testSetAttribute() { m_node = m_doc.getDocumentElement(); try { ((Element) m_node).setAttribute("invalid<", "0"); - fail("Invalid attr name"); + Assertions.fail("Invalid attr name"); } catch (DOMException de) { assertEquals(DOMException.INVALID_CHARACTER_ERR, de.code); } @@ -435,15 +423,14 @@ public class ElementTest extends NodeWit } @Test - public void testSetAttributeNode() { + void testSetAttributeNode() { Attr result; Attr newAttr = m_doc.createAttribute("attr0"); Attr oldAttr = ((Element) m_node).getAttributeNode("attr0"); newAttr.setValue("newval"); result = ((Element) m_node).setAttributeNode(newAttr); assertEquals(oldAttr, result); - assertEquals("newval", - ((Element) m_node).getAttributeNode("attr0").getNodeValue()); + assertEquals("newval", ((Element) m_node).getAttributeNode("attr0").getNodeValue()); //insert self try { @@ -460,39 +447,38 @@ public class ElementTest extends NodeWit newAttr.setValue("newval"); result = ((Element) m_node).setAttributeNode(newAttr); assertNull(result); - assertEquals("newval", - ((Element) m_node).getAttributeNode("attr1").getNodeValue()); + assertEquals("newval", ((Element) m_node).getAttributeNode("attr1").getNodeValue()); assertEquals(2, m_node.getAttributes().getLength()); } @Test - public void testSetAttributeNodeDiffDoc() { + void testSetAttributeNodeDiffDoc() { Attr result; Attr newAttr = m_docNS.createAttribute("attr0"); try { result = ((Element) m_node).setAttributeNode(newAttr); - fail("Attr Node diff doc in use"); + Assertions.fail("Attr Node diff doc in use"); } catch (DOMException de) { assertEquals(DOMException.WRONG_DOCUMENT_ERR, de.code); } } @Test - public void testSetAttributeNodeInUse() { + void testSetAttributeNodeInUse() { //insert new m_node = m_node.getParentNode().getParentNode(); Attr newAttr = ((Element) m_node).getAttributeNode("attr0"); m_node = m_node.getFirstChild(); try { ((Element) m_node).setAttributeNode(newAttr); - fail("Attr Node in use"); + Assertions.fail("Attr Node in use"); } catch (DOMException de) { assertEquals(DOMException.INUSE_ATTRIBUTE_ERR, de.code); } } @Test - public void testSetAttributeNodeNS() { + void testSetAttributeNodeNS() { m_node = m_docNS.getFirstChild().getFirstChild(); Attr result; Attr newAttr = m_docNS.createAttributeNS("uri:foo", "at0"); @@ -512,8 +498,7 @@ public class ElementTest extends NodeWit newAttr.setValue("newval"); result = ((Element) m_node).setAttributeNode(newAttr); assertNull(result); - assertEquals("newval", - ((Element) m_node).getAttributeNS("uri:foo", "attr1")); + assertEquals("newval", ((Element) m_node).getAttributeNS("uri:foo", "attr1")); assertEquals(nAttrCnt + 1, m_node.getAttributes().getLength()); //insert new @@ -522,32 +507,29 @@ public class ElementTest extends NodeWit result = ((Element) m_node).setAttributeNodeNS(newAttr); assertNull(result); - assertEquals("newURIval", - ((Element) m_node).getAttributeNS("uri:foo:org", "attr1")); + assertEquals("newURIval", ((Element) m_node).getAttributeNS("uri:foo:org", "attr1")); assertEquals(nAttrCnt + 2, m_node.getAttributes().getLength()); } @Test - public void testSetAttributeNS() { + void testSetAttributeNS() { m_node = m_docNS.getFirstChild().getFirstChild(); //overwrite ((Element) m_node).setAttributeNS("uri:foo", "at0", "newval"); - assertEquals("newval", - ((Element) m_node).getAttributeNS("uri:foo", "at0")); + assertEquals("newval", ((Element) m_node).getAttributeNS("uri:foo", "at0")); ((Element) m_node).setAttributeNS("uri:foo:org", "attr1", "newval"); - assertEquals("newval", - ((Element) m_node).getAttributeNS("uri:foo:org", "attr1")); + assertEquals("newval", ((Element) m_node).getAttributeNS("uri:foo:org", "attr1")); assertEquals(6, m_node.getAttributes().getLength()); } @Test - public void testSetAttributeNSBadNS() { + void testSetAttributeNSBadNS() { //qualifiedName is malformed try { ((Element) m_node).setAttributeNS("foo:org", "invalid<", "0"); - fail("Invalid attr name"); + Assertions.fail("Invalid attr name"); } catch (DOMException de) { assertEquals(DOMException.INVALID_CHARACTER_ERR, de.code); } @@ -556,78 +538,78 @@ public class ElementTest extends NodeWit try { String sNull = null; ((Element) m_node).setAttributeNS(sNull, "myfoo:at", "0"); - fail("Invalid attr name"); + Assertions.fail("Invalid attr name"); } catch (DOMException de) { assertEquals(DOMException.NAMESPACE_ERR, de.code); } } @Test - public void testSetAttributeNSBadNS_xmlns() { + void testSetAttributeNSBadNS_xmlns() { //the qualifiedName, or its prefix, is "xmlns" and the namespaceURI is different from " http://www.w3.org/2000/xmlns/". try { ((Element) m_node).setAttributeNS("foo:org:uri", "xmlns", "0"); - fail("Invalid attr name"); + Assertions.fail("Invalid attr name"); } catch (DOMException de) { assertEquals(DOMException.NAMESPACE_ERR, de.code); } try { ((Element) m_node).setAttributeNS("foo:org:uri", "xmlns:foo", "0"); - fail("Invalid attr name"); + Assertions.fail("Invalid attr name"); } catch (DOMException de) { assertEquals(DOMException.NAMESPACE_ERR, de.code); } } @Test - public void testSetAttributeNSBadNS_xml() { + void testSetAttributeNSBadNS_xml() { //if the qualifiedName has a prefix that is "xml" // and the namespaceURI is different from " http://www.w3.org/XML/1998/namespace" try { ((Element) m_node).setAttributeNS("foo:org:uri", "xml:foo", "0"); - fail("Invalid attr name"); + Assertions.fail("Invalid attr name"); } catch (DOMException de) { assertEquals(DOMException.NAMESPACE_ERR, de.code); } } @Test - public void testGetChildNodes() { + protected void testGetChildNodes() { m_node = m_node.getParentNode(); assertEquals(2, m_node.getChildNodes().getLength()); } @Test - public void testFirstChild() { + protected void testFirstChild() { assertEquals("nested0", m_node.getFirstChild().getNodeValue()); } @Test - public void testLastChild() { + protected void testLastChild() { assertEquals("nested0", m_node.getLastChild().getNodeValue()); } //code coverage: need a node with penultimate elt and last text @Test - public void testLastChildMixedContent() { + void testLastChildMixedContent() { Node prevSibling = m_doc.createElement("penultimateNode"); m_node.insertBefore(prevSibling, m_node.getFirstChild()); assertEquals("nested0", m_node.getLastChild().getNodeValue()); } @Test - public void testGetAttributes() { + protected void testGetAttributes() { assertEquals(0, m_node.getAttributes().getLength()); } @Test - public void testLocalName() { + protected void testLocalName() { assertEquals("zed", m_node.getLocalName()); } @Test - public void testSetPrefix() { + protected void testSetPrefix() { //set a null prefix m_node = m_docNS.getFirstChild().getFirstChild().getChildNodes().item(2);//<myns:yana/> @@ -640,14 +622,13 @@ public class ElementTest extends NodeWit assertEquals("other:yana", m_node.getNodeName()); assertEquals("other:yana", ((Element) m_node).getTagName()); // assertEquals("uri:other",m_node.getNamespaceURI());--this is the URI @ creation--never changes - assertEquals(1, - ((Element) m_docNS.getDocumentElement()).getElementsByTagName( - "other:yana") - .getLength()); + assertEquals(1, ((Element) m_docNS.getDocumentElement()).getElementsByTagName( + "other:yana") + .getLength()); } @Test - public void testNormalizeNode() throws Exception { + void testNormalizeNode() throws Exception { m_node = m_node.getParentNode(); m_node.replaceChild(m_doc.createTextNode("txt1"), m_node.getLastChild()); @@ -658,7 +639,7 @@ public class ElementTest extends NodeWit } @Test - public void testNormalizeNodeNoChildren() throws Exception { + void testNormalizeNodeNoChildren() throws Exception { m_node = m_doc.createElement("foobar"); assertEquals(0, m_node.getChildNodes().getLength()); m_node.normalize(); @@ -666,7 +647,7 @@ public class ElementTest extends NodeWit } @Test - public void testNormalizeNodeOneChild() throws Exception { + void testNormalizeNodeOneChild() throws Exception { m_node = m_doc.createElement("foobar"); m_node.appendChild(m_doc.createElement("foobar")); assertEquals(1, m_node.getChildNodes().getLength()); @@ -675,28 +656,28 @@ public class ElementTest extends NodeWit } @Test - public void testAppendChildExisting() { + void testAppendChildExisting() { m_node = m_docNS.getFirstChild().getLastChild(); Node child = m_docNS.getFirstChild().getFirstChild(); super.testAppendChildExisting(child); } @Test - public void testInsertExisitingNode() { + void testInsertExisitingNode() { m_node = m_docNS.getFirstChild().getLastChild(); Node child = m_docNS.getFirstChild().getFirstChild(); super.testAppendChildExisting(child); } @Test - public void testDomLevel1() { + void testDomLevel1() { Element elt = m_doc.createElement("foobar"); - assertNull("L1 prefix null", elt.getPrefix()); - assertNull("L1 LocalName null", elt.getLocalName()); - assertNull("L1 Uri null", elt.getNamespaceURI()); + assertNull(elt.getPrefix(), "L1 prefix null"); + assertNull(elt.getLocalName(), "L1 LocalName null"); + assertNull(elt.getNamespaceURI(), "L1 Uri null"); try { elt.setPrefix("foo"); - fail("L1 prefix null"); + Assertions.fail("L1 prefix null"); } catch (DOMException de) { assertEquals(DOMException.NAMESPACE_ERR, de.code); } @@ -707,7 +688,7 @@ public class ElementTest extends NodeWit assertNotNull(m_node); } - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); moveToNode(); Modified: xmlbeans/trunk/src/test/java/dom/checkin/NamedNodeMapSyncTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/NamedNodeMapSyncTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/NamedNodeMapSyncTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/NamedNodeMapSyncTest.java Sun Feb 6 01:51:55 2022 @@ -16,11 +16,10 @@ package dom.checkin; - -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class NamedNodeMapSyncTest extends NamedNodeMapTest { - @Before + @BeforeEach public void setUp() throws Exception { super.loadSync(); super.moveToNode(); Modified: xmlbeans/trunk/src/test/java/dom/checkin/NamedNodeMapTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/NamedNodeMapTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/NamedNodeMapTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/NamedNodeMapTest.java Sun Feb 6 01:51:55 2022 @@ -19,33 +19,42 @@ package dom.checkin; import dom.common.Loader; import dom.common.NodeTest; import dom.common.TestSetup; -import org.junit.Before; -import org.junit.Test; -import org.w3c.dom.*; - import org.apache.xmlbeans.XmlObject; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.w3c.dom.*; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class NamedNodeMapTest implements TestSetup { - Document m_doc; - Document m_docNS; - Node m_node; - NamedNodeMap m_nodeMap; - String sXml = "<foo at0=\"val0\" at1=\"val1\" at2=\"val2\" at3=\"val3\" at4=\"val4\"><bar bat0=\"val0\">abc</bar></foo>"; - String sXmlNS = "<foo xmlns:myns=\"uri:foo\" at0=\"val0\" myns:at0=\"val01\" at2=\"val2\" at3=\"val3\" myns:at4=\"val4\"> <bar>abc</bar></foo>"; - Node result; - int nCount = 5; + private Document m_doc; + private Document m_docNS; + private Node m_node; + private NamedNodeMap m_nodeMap; + private final String sXml = "<foo at0=\"val0\" at1=\"val1\" at2=\"val2\" at3=\"val3\" at4=\"val4\"><bar bat0=\"val0\">abc</bar></foo>"; + private final String sXmlNS = "<foo xmlns:myns=\"uri:foo\" at0=\"val0\" myns:at0=\"val01\" at2=\"val2\" at3=\"val3\" myns:at4=\"val4\"> <bar>abc</bar></foo>"; + private Node result; + private int nCount = 5; + private Loader _loader; + + + @BeforeEach + public void setUp() throws Exception { + m_doc = (org.w3c.dom.Document) XmlObject.Factory.parse( sXml ).getDomNode(); + m_docNS = (org.w3c.dom.Document) XmlObject.Factory.parse( sXmlNS ).getDomNode(); + moveToNode(); + } @Test - public void testLength() { + void testLength() { //assertEquals(m_nodeMap.length,nCount); assertEquals(m_nodeMap.getLength(), nCount); } @Test - public void testGetNamedItem() { + void testGetNamedItem() { result = m_nodeMap.getNamedItem("at0"); assertEquals("val0", result.getNodeValue()); @@ -54,13 +63,13 @@ public class NamedNodeMapTest implements } @Test - public void testGetNamedItemDNE() { + void testGetNamedItemDNE() { result = m_nodeMap.getNamedItem("attt4"); - assertEquals(null, result); + assertNull(result); } @Test - public void testGetNamedItemNS() { + void testGetNamedItemNS() { m_nodeMap = m_docNS.getFirstChild().getAttributes(); result = m_nodeMap.getNamedItemNS("uri:foo", "at0"); @@ -79,17 +88,17 @@ public class NamedNodeMapTest implements } @Test - public void testGetNamedItemNS_DNE() { + void testGetNamedItemNS_DNE() { m_nodeMap = m_docNS.getFirstChild().getAttributes(); result = m_nodeMap.getNamedItemNS("uri:fol", "at0"); - assertEquals(null, result); + assertNull(result); result = m_nodeMap.getNamedItemNS("uri:foo", "at1"); - assertEquals(null, result); + assertNull(result); result = m_nodeMap.getNamedItemNS("uri:foo", null); - assertEquals(null, result); + assertNull(result); /* This test is only possible if "" neq null result=m_nodeMap.getNamedItemNS("","at4"); @@ -98,7 +107,7 @@ public class NamedNodeMapTest implements } @Test - public void testItem() { + void testItem() { result = m_nodeMap.item(0); assertEquals("val0", result.getNodeValue()); result = m_nodeMap.item(3); @@ -106,13 +115,13 @@ public class NamedNodeMapTest implements } @Test - public void testItemNeg() { + void testItemNeg() { assertNotNull(m_nodeMap); assertNull(m_nodeMap.item(-1)); } @Test - public void testItemLarge() { + void testItemLarge() { assertNotNull(m_nodeMap); assertNull(m_nodeMap.item(m_nodeMap.getLength() + 1)); } @@ -123,10 +132,10 @@ public class NamedNodeMapTest implements * attr w/ default val */ @Test - public void testRemoveNamedItemNull() { + void testRemoveNamedItemNull() { try { m_nodeMap.removeNamedItem(null); - fail("removing a non-existing value"); + Assertions.fail("removing a non-existing value"); } catch (DOMException de) { assertEquals(de.code, DOMException.NOT_FOUND_ERR); @@ -134,10 +143,10 @@ public class NamedNodeMapTest implements } @Test - public void testRemoveNamedItem() { + void testRemoveNamedItem() { try { m_nodeMap.removeNamedItem("at7"); - fail("removing a non-existing value"); + Assertions.fail("removing a non-existing value"); } catch (DOMException de) { assertEquals(de.code, DOMException.NOT_FOUND_ERR); @@ -152,7 +161,7 @@ public class NamedNodeMapTest implements } @Test - public void testRemoveNamedItemNS() { + void testRemoveNamedItemNS() { m_node = m_docNS.getDocumentElement(); m_nodeMap = m_node.getAttributes(); result = m_nodeMap.getNamedItemNS("uri:foo", "at0"); @@ -160,8 +169,9 @@ public class NamedNodeMapTest implements nCount = m_node.getAttributes().getLength(); - if (bDTD) + if (bDTD) { assertEquals(m_nodeMap.getNamedItem("at0").getNodeValue(), "val0"); //default ns attr still here + } result = m_nodeMap.getNamedItemNS("uri:foo", "at4"); assertEquals(result, m_nodeMap.removeNamedItemNS("uri:foo", "at4")); @@ -175,19 +185,18 @@ public class NamedNodeMapTest implements assertEquals(m_node.getAttributes().getLength(), nCount - 2); //liveness test - assertEquals(nCount - 2, - m_docNS.getFirstChild().getAttributes().getLength()); + assertEquals(nCount - 2, m_docNS.getFirstChild().getAttributes().getLength()); assertNull(m_docNS.getFirstChild().getAttributes().getNamedItem("at3")); } @Test - public void testRemoveNamedItemNS_DNE() { + void testRemoveNamedItemNS_DNE() { m_nodeMap = m_docNS.getFirstChild().getAttributes(); int nLen = m_node.getAttributes().getLength(); try { result = m_nodeMap.removeNamedItemNS("uri:fo1", "at0"); if (m_node.getAttributes().getLength() != nLen) - fail("removing a non-existing attr"); + Assertions.fail("removing a non-existing attr"); } catch (DOMException de) { assertEquals(de.code, DOMException.NOT_FOUND_ERR); @@ -196,7 +205,7 @@ public class NamedNodeMapTest implements try { result = m_nodeMap.getNamedItemNS("uri:fo1", null); if (result != null) - fail("removing a non-existing attr"); + Assertions.fail("removing a non-existing attr"); } catch (DOMException de) { assertEquals(de.code, DOMException.NOT_FOUND_ERR); @@ -210,7 +219,7 @@ public class NamedNodeMapTest implements * node not an attr */ @Test - public void testSetNamedItem() { + void testSetNamedItem() { Node newAt = m_doc.createAttribute("newAt"); ((Attr) newAt).setValue("newval"); m_nodeMap.setNamedItem(newAt); @@ -223,7 +232,7 @@ public class NamedNodeMapTest implements ((Attr) newAt).setValue("newval"); try { m_nodeMap.setNamedItem(newAt); - fail("Inserting node created from a different doc"); + Assertions.fail("Inserting node created from a different doc"); } catch (DOMException de) { assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR); @@ -233,7 +242,7 @@ public class NamedNodeMapTest implements newAt = m_node.getFirstChild().getAttributes().getNamedItem("bat0"); try { m_nodeMap.setNamedItem(newAt); - fail("Inserting node in use"); + Assertions.fail("Inserting node in use"); } catch (DOMException de) { assertEquals(de.code, DOMException.INUSE_ATTRIBUTE_ERR); @@ -243,7 +252,7 @@ public class NamedNodeMapTest implements newAt = m_doc.createElement("newElt"); try { m_nodeMap.setNamedItem(newAt); - fail("Inserting node different doc"); + Assertions.fail("Inserting node different doc"); } catch (DOMException de) { assertEquals(de.code, DOMException.HIERARCHY_REQUEST_ERR); @@ -251,17 +260,17 @@ public class NamedNodeMapTest implements } - @Test(expected = IllegalArgumentException.class) - public void testSetNamedItemNull() { - m_nodeMap.setNamedItem(null); + @Test + void testSetNamedItemNull() { + assertThrows(IllegalArgumentException.class, () -> m_nodeMap.setNamedItem(null)); } @Test - public void testSetNamedItemDiffImpl() throws Exception { + void testSetNamedItemDiffImpl() throws Exception { Node toSet = NodeTest.getApacheNode(sXml, false, 'A'); try { m_nodeMap.setNamedItem(toSet); - fail("Inserting node different impl"); + Assertions.fail("Inserting node different impl"); } catch (DOMException de) { assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR); @@ -269,7 +278,7 @@ public class NamedNodeMapTest implements } @Test - public void testSetNamedItemNS() { + void testSetNamedItemNS() { Attr newAt = m_doc.createAttributeNS("uri:foo", "newAt"); newAt.setValue("newval"); m_nodeMap.setNamedItemNS(newAt); @@ -293,17 +302,17 @@ public class NamedNodeMapTest implements //the path cases are the same as in SetNamedItem } - @Test(expected = IllegalArgumentException.class) - public void testSetNamedItemNSNull() { - m_nodeMap.setNamedItemNS(null); + @Test + void testSetNamedItemNSNull() { + assertThrows(IllegalArgumentException.class, () -> m_nodeMap.setNamedItemNS(null)); } @Test - public void testSetNamedItemNSDiffImpl() throws Exception { + void testSetNamedItemNSDiffImpl() throws Exception { Node toSet = NodeTest.getApacheNode(sXml, true, 'A'); try { m_nodeMap.setNamedItemNS(toSet); - fail("Inserting node different impl"); + Assertions.fail("Inserting node different impl"); } catch (DOMException de) { assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR); @@ -312,11 +321,11 @@ public class NamedNodeMapTest implements //try to set a node of a diff type than the current collection @Test - public void testSetNamedItemDiffType() throws Exception { + void testSetNamedItemDiffType() throws Exception { Node toSet = m_doc.createElement("foobar"); try { m_nodeMap.setNamedItem(toSet); - fail("Inserting node different impl"); + Assertions.fail("Inserting node different impl"); } catch (DOMException de) { assertEquals(de.code, DOMException.HIERARCHY_REQUEST_ERR); @@ -324,11 +333,11 @@ public class NamedNodeMapTest implements } @Test - public void testSetNamedItemNSDiffType() throws Exception { + void testSetNamedItemNSDiffType() throws Exception { Node toSet = m_doc.createElementNS("foo:org", "com:foobar"); try { m_nodeMap.setNamedItemNS(toSet); - fail("Inserting node different impl"); + Assertions.fail("Inserting node different impl"); } catch (DOMException de) { assertEquals(de.code, DOMException.HIERARCHY_REQUEST_ERR); @@ -344,22 +353,9 @@ public class NamedNodeMapTest implements public void loadSync() throws Exception { _loader = Loader.getLoader(); - - if (sXml == null && sXmlNS == null) throw new IllegalArgumentException( - "Test bug : Initialize xml strings"); - m_doc = (org.w3c.dom.Document) _loader.loadSync(sXml); - if (sXmlNS != null && sXmlNS.length() > 0) - m_docNS = (org.w3c.dom.Document) _loader.loadSync(sXmlNS); + m_doc = _loader.loadSync(sXml); + m_docNS = _loader.loadSync(sXmlNS); } - - @Before - public void setUp() throws Exception { - m_doc = (org.w3c.dom.Document) XmlObject.Factory.parse( sXml ).getDomNode(); - m_docNS = (org.w3c.dom.Document) XmlObject.Factory.parse( sXmlNS ).getDomNode(); - moveToNode(); - } - - private Loader _loader; } Modified: xmlbeans/trunk/src/test/java/dom/checkin/NodeListSyncTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/NodeListSyncTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/NodeListSyncTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/NodeListSyncTest.java Sun Feb 6 01:51:55 2022 @@ -16,11 +16,10 @@ package dom.checkin; - -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class NodeListSyncTest extends NodeListTest { - @Before + @BeforeEach public void setUp() throws Exception { super.loadSync(); super.moveToNode(); Modified: xmlbeans/trunk/src/test/java/dom/checkin/NodeListTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/NodeListTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/NodeListTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/NodeListTest.java Sun Feb 6 01:51:55 2022 @@ -19,14 +19,14 @@ package dom.checkin; import dom.common.Loader; import dom.common.TestSetup; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class NodeListTest implements TestSetup { @@ -38,35 +38,35 @@ public class NodeListTest implements Tes int nCount = 5; @Test - public void testLength() { + void testLength() { assertEquals(m_nodeList.getLength(), nCount); } @Test - public void testItem() { + void testItem() { for (int i = 0; i < m_nodeList.getLength(); i++) assertEquals("ch" + i, m_nodeList.item(i).getNodeName()); } @Test - public void testItemNeg() { + void testItemNeg() { assertNull(m_nodeList.item(-1)); } @Test - public void testItemLarge() { + void testItemLarge() { assertNull(m_nodeList.item(nCount + 1)); } @Test - public void voidTestLive() { + void voidTestLive() { m_node.removeChild(m_nodeList.item(1));//"ch1" assertEquals(m_nodeList.getLength(), nCount - 1); assertEquals("ch2", m_nodeList.item(1).getNodeName()); } @Test - public void moveToNode() { + void moveToNode() { m_node = m_doc.getFirstChild(); m_nodeList = m_node.getChildNodes(); } @@ -77,7 +77,7 @@ public class NodeListTest implements Tes } - @Before + @BeforeEach public void setUp() throws Exception { _loader = Loader.getLoader(); m_doc = (org.w3c.dom.Document) _loader.load(sXml); Modified: xmlbeans/trunk/src/test/java/dom/checkin/PISyncTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/PISyncTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/PISyncTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/PISyncTest.java Sun Feb 6 01:51:55 2022 @@ -16,12 +16,11 @@ package dom.checkin; - -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class PISyncTest extends PITest { - @Before + @BeforeEach public void setUp() throws Exception { super.loadSync(); super.moveToNode(); Modified: xmlbeans/trunk/src/test/java/dom/checkin/PITest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/PITest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/PITest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/PITest.java Sun Feb 6 01:51:55 2022 @@ -17,13 +17,14 @@ package dom.checkin; import dom.common.NodeTest; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.ProcessingInstruction; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class PITest extends NodeTest { @@ -34,36 +35,34 @@ public class PITest extends NodeTest { } @Test - public void testNodeName() { + void testNodeName() { assertEquals("xml-stylesheet", m_node.getNodeName()); } @Test - public void testLocalName() { + protected void testLocalName() { assertEquals("xml-stylesheet", m_node.getNodeName()); } @Test - public void testNodeType() { + void testNodeType() { assertEquals(Node.PROCESSING_INSTRUCTION_NODE, m_node.getNodeType()); } @Test - public void testNodeValue() { - assertEquals( - "type=\"text/xsl\" xmlns=\"http://openuri.org/shipping/\"", - m_node.getNodeValue()); + void testNodeValue() { + assertEquals("type=\"text/xsl\" xmlns=\"http://openuri.org/shipping/\"", m_node.getNodeValue()); } @Test - public void testNextSibling() { + void testNextSibling() { Node nxtSibling = m_node.getNextSibling(); assertEquals("foo", nxtSibling.getNodeName()); } @Test - public void testSetNodeValue() { + void testSetNodeValue() { String sNewVal = "type=\"text/xsl\" xmlns=\"http://xbean.foo.org\""; m_node.setNodeValue(sNewVal); assertEquals(sNewVal, m_node.getNodeValue()); @@ -71,29 +70,26 @@ public class PITest extends NodeTest { } @Test - public void testPreviousSibling() { + void testPreviousSibling() { Node prSibling = m_node.getPreviousSibling(); assertNull(prSibling); } @Test - public void testParent() { + void testParent() { Node parent = m_node.getParentNode(); assertEquals(m_doc.getFirstChild(), parent); assertEquals("bar", parent.getLocalName()); } @Test - public void testGetData() { - assertEquals( - "type=\"text/xsl\" xmlns=\"http://openuri.org/shipping/\"", - ((ProcessingInstruction) m_node).getData()); + void testGetData() { + assertEquals("type=\"text/xsl\" xmlns=\"http://openuri.org/shipping/\"", ((ProcessingInstruction) m_node).getData()); } @Test - public void testGetTarget() { - assertEquals("xml-stylesheet", - ((ProcessingInstruction) m_node).getTarget()); + void testGetTarget() { + assertEquals("xml-stylesheet", ((ProcessingInstruction) m_node).getTarget()); } public void moveToNode() { @@ -103,7 +99,7 @@ public class PITest extends NodeTest { //TODO: Test PI with funky but legal chatacters in the name, eg. : @Test - public void testPiTargetChars() { + void testPiTargetChars() { ProcessingInstruction node = m_doc.createProcessingInstruction( "foo:123-_", "some body"); m_node.getParentNode().appendChild(node); @@ -113,13 +109,13 @@ public class PITest extends NodeTest { //TODO: Test Illegal PI Targets: xml target, starting with a digit @Test - public void testPiTargetIllegalChars() { + void testPiTargetIllegalChars() { ProcessingInstruction node; try { node = m_doc.createProcessingInstruction("7foo:?123-&", "some body"); - fail("Can't start w/ a digit"); + Assertions.fail("Can't start w/ a digit"); } catch (DOMException e) { assertEquals(DOMException.INVALID_CHARACTER_ERR, e.code); @@ -127,14 +123,14 @@ public class PITest extends NodeTest { try { node = m_doc.createProcessingInstruction("xml", "foo"); - fail("Can't be xml"); + Assertions.fail("Can't be xml"); } catch (DOMException e) { assertEquals(DOMException.INVALID_CHARACTER_ERR, e.code); } } - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); moveToNode(); Modified: xmlbeans/trunk/src/test/java/dom/checkin/ParserTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/ParserTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/ParserTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/ParserTest.java Sun Feb 6 01:51:55 2022 @@ -21,16 +21,17 @@ import org.apache.xmlbeans.impl.common.D import org.apache.xmlbeans.impl.common.SAXHelper; import org.apache.xmlbeans.impl.common.StaxHelper; import org.apache.xmlbeans.impl.common.XMLBeansConstants; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; -import java.io.ByteArrayInputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.stream.XMLInputFactory; +import java.io.ByteArrayInputStream; -import static org.junit.Assert.*; +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.junit.jupiter.api.Assertions.*; /** * Tests for XML Parser settings @@ -39,7 +40,7 @@ import static org.junit.Assert.*; public class ParserTest { @Test - public void testXmlOptionsDefaults() { + void testXmlOptionsDefaults() { XmlOptions options = new XmlOptions(); assertEquals(2048, options.getEntityExpansionLimit()); assertFalse(options.isLoadDTDGrammar()); @@ -48,7 +49,7 @@ public class ParserTest { } @Test - public void testXMLBeansConstantsOverrides() { + void testXMLBeansConstantsOverrides() { XmlOptions options = new XmlOptions(); options.setEntityExpansionLimit(1); options.setLoadDTDGrammar(true); @@ -61,7 +62,7 @@ public class ParserTest { } @Test - public void testXmlInputFactoryPropertyDefaults() { + void testXmlInputFactoryPropertyDefaults() { XmlOptions options = new XmlOptions(); XMLInputFactory factory = StaxHelper.newXMLInputFactory(options); assertEquals(true, factory.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)); @@ -71,7 +72,7 @@ public class ParserTest { } @Test - public void testXmlInputFactoryPropertyOverrides() { + void testXmlInputFactoryPropertyOverrides() { XmlOptions options = new XmlOptions(); options.setEntityExpansionLimit(1); options.setLoadDTDGrammar(true); @@ -82,7 +83,7 @@ public class ParserTest { } @Test - public void testXMLReader() throws Exception { + void testXMLReader() throws Exception { XmlOptions options = new XmlOptions(); XMLReader reader = SAXHelper.newXMLReader(options); assertNotSame(reader, SAXHelper.newXMLReader(options)); @@ -93,11 +94,11 @@ public class ParserTest { assertNotNull(reader.getProperty(XMLBeansConstants.SECURITY_MANAGER)); String xmlWithDtd = "<!DOCTYPE foo [<!ELEMENT t ANY><!ENTITY xe \"TEST XXE\"> ]>\n<xml>&xe;</xml>"; - reader.parse(new InputSource(new ByteArrayInputStream(xmlWithDtd.getBytes("UTF-8")))); + reader.parse(new InputSource(new ByteArrayInputStream(xmlWithDtd.getBytes(UTF_8)))); } - @Test(expected = SAXException.class) - public void testXMLReaderOverrides() throws Exception { + @Test + void testXMLReaderOverrides() throws Exception { XmlOptions options = new XmlOptions(); options.setEntityExpansionLimit(1); options.setLoadDTDGrammar(true); @@ -112,21 +113,22 @@ public class ParserTest { assertNotNull(reader.getProperty(XMLBeansConstants.SECURITY_MANAGER)); String xmlWithDtd = "<!DOCTYPE foo [<!ELEMENT t ANY><!ENTITY xe \"TEST XXE\"> ]>\n<xml>&xe;</xml>"; - reader.parse(new InputSource(new ByteArrayInputStream(xmlWithDtd.getBytes("UTF-8")))); + InputSource is = new InputSource(new ByteArrayInputStream(xmlWithDtd.getBytes(UTF_8))); + assertThrows(SAXException.class, () -> reader.parse(is)); } @Test - public void testDocumentBuilder() throws Exception { + void testDocumentBuilder() throws Exception { XmlOptions options = new XmlOptions(); DocumentBuilder builder = DocumentHelper.newDocumentBuilder(options); assertNotSame(builder, DocumentHelper.newDocumentBuilder(options)); String xmlWithDtd = "<!DOCTYPE foo [<!ELEMENT t ANY><!ENTITY xe \"TEST XXE\"> ]>\n<xml>&xe;</xml>"; - builder.parse(new InputSource(new ByteArrayInputStream(xmlWithDtd.getBytes("UTF-8")))); + builder.parse(new InputSource(new ByteArrayInputStream(xmlWithDtd.getBytes(UTF_8)))); } - @Test(expected = SAXException.class) - public void testDocumentBuilderOverrides() throws Exception { + @Test + void testDocumentBuilderOverrides() { XmlOptions options = new XmlOptions(); options.setEntityExpansionLimit(1); options.setLoadDTDGrammar(true); @@ -136,6 +138,7 @@ public class ParserTest { assertNotSame(builder, DocumentHelper.newDocumentBuilder(options)); String xmlWithDtd = "<!DOCTYPE foo [<!ELEMENT t ANY><!ENTITY xe \"TEST XXE\"> ]>\n<xml>&xe;</xml>"; - builder.parse(new InputSource(new ByteArrayInputStream(xmlWithDtd.getBytes("UTF-8")))); + InputSource is = new InputSource(new ByteArrayInputStream(xmlWithDtd.getBytes(UTF_8))); + assertThrows(SAXException.class, () -> builder.parse(is)); } } Modified: xmlbeans/trunk/src/test/java/dom/checkin/TextSyncTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/TextSyncTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/TextSyncTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/TextSyncTest.java Sun Feb 6 01:51:55 2022 @@ -16,12 +16,11 @@ package dom.checkin; - -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class TextSyncTest extends TextTest { - @Before + @BeforeEach public void setUp() throws Exception { super.loadSync(); super.moveToNode(); Modified: xmlbeans/trunk/src/test/java/dom/checkin/TextTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/checkin/TextTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/dom/checkin/TextTest.java (original) +++ xmlbeans/trunk/src/test/java/dom/checkin/TextTest.java Sun Feb 6 01:51:55 2022 @@ -18,15 +18,15 @@ package dom.checkin; import dom.common.CharacterDataTest; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.Text; import xmlcursor.common.Common; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; public class TextTest extends CharacterDataTest { @@ -36,45 +36,45 @@ public class TextTest extends CharacterD } @Test - public void testNodeName() { + void testNodeName() { assertEquals("#text", m_node.getNodeName()); } @Test - public void testNodeType() { + void testNodeType() { assertEquals(Node.TEXT_NODE, m_node.getNodeType()); } @Test - public void testNodeValue() { + void testNodeValue() { assertEquals("extended", m_node.getNodeValue()); } @Test - public void testNextSibling() { + void testNextSibling() { Node nxtSibling = m_node.getNextSibling(); assertEquals(null, nxtSibling); } @Test - public void testPreviousSibling() { + void testPreviousSibling() { Node prSibling = m_node.getPreviousSibling(); assertEquals("bar", prSibling.getLocalName()); assertEquals("text", ((Text) prSibling.getFirstChild()).getData()); } @Test - public void testParent() { + void testParent() { Node parent = m_node.getParentNode(); assertEquals(m_doc.getFirstChild(), parent); assertEquals("foo", parent.getLocalName()); } @Test - public void testSplitTextNegative() { + void testSplitTextNegative() { try { ((Text) m_node).splitText(-1); - fail("Deleting OOB chars"); + Assertions.fail("Deleting OOB chars"); } catch (DOMException de) { assertEquals(de.code, DOMException.INDEX_SIZE_ERR); @@ -82,10 +82,10 @@ public class TextTest extends CharacterD } @Test - public void testSplitTextLarge() { + void testSplitTextLarge() { try { ((Text) m_node).splitText(((Text) m_node).getLength() + 1); - fail("Deleting OOB chars"); + Assertions.fail("Deleting OOB chars"); } catch (DOMException de) { assertEquals(de.code, DOMException.INDEX_SIZE_ERR); @@ -93,7 +93,7 @@ public class TextTest extends CharacterD } @Test - public void testSplitText() { + void testSplitText() { Node parent = m_node.getParentNode(); int nChildCount = parent.getChildNodes().getLength(); ((Text) m_node).splitText(2); @@ -101,7 +101,7 @@ public class TextTest extends CharacterD } @Test - public void testSplitTextBorder() { + void testSplitTextBorder() { Node parent = m_node.getParentNode(); int nChildCount = parent.getChildNodes().getLength(); ((Text) m_node).splitText(((Text) m_node).getLength()); @@ -112,14 +112,14 @@ public class TextTest extends CharacterD //code coverage case; not sure why it's important @Test - public void testSplitTextNoParent() { + void testSplitTextNoParent() { m_node = m_doc.createTextNode("foobar"); ((Text) m_node).splitText(3); assertEquals("foo", m_node.getNodeValue()); } @Test - public void testSetNodeValue() { + void testSetNodeValue() { m_node.setNodeValue("new text value"); assertEquals("new text value", m_node.getNodeValue()); } @@ -128,16 +128,16 @@ public class TextTest extends CharacterD m_node = m_doc.getFirstChild().getChildNodes().item(1);//"extended" } - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); moveToNode(); } @Test - public void testDelete()throws Exception{ + void testDelete()throws Exception{ org.apache.xmlbeans.XmlObject o= org.apache.xmlbeans.XmlObject.Factory.parse("<foo/>"); Node d = o.newDomNode(); - assertEquals("foo",d.getFirstChild().getLocalName()); + assertEquals("foo", d.getFirstChild().getLocalName()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
