You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2022/02/07 22:20:51 UTC

svn commit: r1897830 - in /xmlbeans/trunk/src/test/java: compile/scomp/checkin/ dom/checkin/ dom/common/ dom/detailed/ misc/detailed/ scomp/contentType/simple/detailed/ xmlcursor/checkin/ xmlcursor/common/

Author: kiwiwings
Date: Mon Feb  7 22:20:51 2022
New Revision: 1897830

URL: http://svn.apache.org/viewvc?rev=1897830&view=rev
Log:
XMLBEANS-596 - replace a few more try, fail, catch constructs with assertThrows

Modified:
    xmlbeans/trunk/src/test/java/compile/scomp/checkin/XmlBeansCompCheckinTests.java
    xmlbeans/trunk/src/test/java/dom/checkin/ElementTest.java
    xmlbeans/trunk/src/test/java/dom/checkin/NamedNodeMapTest.java
    xmlbeans/trunk/src/test/java/dom/checkin/PITest.java
    xmlbeans/trunk/src/test/java/dom/common/CharacterDataTest.java
    xmlbeans/trunk/src/test/java/dom/detailed/AttrNamespaceTest.java
    xmlbeans/trunk/src/test/java/dom/detailed/InsertDeleteNodesTest.java
    xmlbeans/trunk/src/test/java/dom/detailed/MoveImportNodeTest.java
    xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression151_200Test.java
    xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression1_50Test.java
    xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression50_100Test.java
    xmlbeans/trunk/src/test/java/misc/detailed/JiraRegressionTest101_150.java
    xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/ListType.java
    xmlbeans/trunk/src/test/java/xmlcursor/checkin/StoreTests.java
    xmlbeans/trunk/src/test/java/xmlcursor/common/BasicCursorTestCase.java

Modified: xmlbeans/trunk/src/test/java/compile/scomp/checkin/XmlBeansCompCheckinTests.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/compile/scomp/checkin/XmlBeansCompCheckinTests.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/compile/scomp/checkin/XmlBeansCompCheckinTests.java (original)
+++ xmlbeans/trunk/src/test/java/compile/scomp/checkin/XmlBeansCompCheckinTests.java Mon Feb  7 22:20:51 2022
@@ -19,7 +19,6 @@ import org.apache.xmlbeans.*;
 import org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl;
 import org.hamcrest.MatcherAssert;
 import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 import java.io.File;
@@ -66,8 +65,9 @@ public class XmlBeansCompCheckinTests {
 
     @AfterEach
     public void tearDown() throws Exception {
-        if (xm_errors.size() > 0)
+        if (xm_errors.size() > 0) {
             xm_errors.clear();
+        }
     }
 
     @Test
@@ -92,66 +92,33 @@ public class XmlBeansCompCheckinTests {
      * Verify Partial SOM cannot be saved to file system
      */
     @Test
-    void test_sts_noSave() throws Exception
-    {
+    void test_sts_noSave() throws Exception {
         XmlObject obj3 = XmlObject.Factory.parse(ERR_XSD);
-        XmlObject[] schemas3 = new XmlObject[]{obj3};
+        XmlObject[] schemas3 = {obj3};
 
-        SchemaTypeSystem sts;
-        ArrayList<XmlError> err = new ArrayList<>();
+        List<XmlError> err = new ArrayList<>();
         XmlOptions opt = new XmlOptions().setErrorListener(err);
         opt.setCompilePartialTypesystem();
 
-        try {
-            // since you can't save a partial SOM, don't bother passing in a Filer
-            sts = XmlBeans.compileXmlBeans(null,
-                    null, schemas3, null,
-                    XmlBeans.getBuiltinTypeSystem(), null, opt);
-            boolean psom_expError = false;
-            // print out the recovered xm_errors
-            if (!err.isEmpty()) {
-                System.out.println("Schema invalid: partial schema type system recovered");
-                for (XmlError xErr : err) {
-                    System.out.println(xErr);
-
-                    if ((xErr.getErrorCode().compareTo("src-resolve") == 0) &&
-                        (xErr.getMessage().compareTo("type 'bType@http://baz' not found.") == 0))
-                        psom_expError = true;
-                }
-            }
-            if (!psom_expError)
-                throw new Exception("Error Code was not as Expected");
-
-        } catch (XmlException e) {
-            //The above case should be recoverable so
-            // spit out debug statement and throw the error
-            System.out.println("Schema invalid: couldn't recover from xm_errors");
-            if (err.isEmpty())
-                System.err.println(e.getMessage());
-            else
-                for (Object o : err) System.err.println(o);
-            throw e;
-        }
-
-        assertTrue(((SchemaTypeSystemImpl)sts).isIncomplete(), "Expected partial schema type system");
+        // since you can't save a partial SOM, don't bother passing in a Filer
+        SchemaTypeSystem sts = XmlBeans.compileXmlBeans(null, null, schemas3, null,
+            XmlBeans.getBuiltinTypeSystem(), null, opt);
+        assertEquals(1, err.size());
+        XmlError xErr = err.get(0);
+        assertEquals(XmlErrorCodes.SCHEMA_QNAME_RESOLVE, xErr.getErrorCode());
+        assertEquals("type 'bType@http://baz' not found.", xErr.getMessage());
+        assertTrue(((SchemaTypeSystemImpl) sts).isIncomplete(), "Expected partial schema type system");
 
 
         // Check using saveToDirectory on Partial SOM
-        File tempDir = null;
-        try {
-            //setUp outputDirectory
-            tempDir = new File(OUTPUTROOT, "psom_save");
-            tempDir.mkdirs();
-            tempDir.deleteOnExit();
-            assertEquals(0, tempDir.listFiles().length, "Output Directory Init needed to be empty");
-
-            //This should not Work
-            sts.saveToDirectory(tempDir);
-            Assertions.fail("Expected IllegalStateException");
-        } catch (IllegalStateException e) {
-            // ok
-            System.out.println("sts.saveToDirectory() threw IllegalStateException as expected");
-        }
+        //setUp outputDirectory
+        File tempDir = new File(OUTPUTROOT, "psom_save");
+        tempDir.mkdirs();
+        tempDir.deleteOnExit();
+        assertEquals(0, tempDir.listFiles().length, "Output Directory Init needed to be empty");
+
+        //This should not Work
+        assertThrows(IllegalStateException.class, () -> sts.saveToDirectory(tempDir));
 
         //make sure nothing was written
         assertEquals(0, tempDir.listFiles().length, "Partial SOM output dir needed to be empty");

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=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/dom/checkin/ElementTest.java (original)
+++ xmlbeans/trunk/src/test/java/dom/checkin/ElementTest.java Mon Feb  7 22:20:51 2022
@@ -18,7 +18,6 @@ package dom.checkin;
 
 
 import dom.common.NodeWithChildrenTest;
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.w3c.dom.*;
@@ -395,13 +394,8 @@ public class ElementTest extends NodeWit
     @Test
     void testSetAttribute() {
         m_node = m_doc.getDocumentElement();
-
-        try {
-            ((Element) m_node).setAttribute("invalid<", "0");
-            Assertions.fail("Invalid attr name");
-        } catch (DOMException de) {
-            assertEquals(DOMException.INVALID_CHARACTER_ERR, de.code);
-        }
+        DOMException de = assertThrows(DOMException.class, () -> ((Element) m_node).setAttribute("invalid<", "0"), "Invalid attr name");
+        assertEquals(DOMException.INVALID_CHARACTER_ERR, de.code);
 
         ((Element) m_node).setAttribute("attr0", "newval");
         assertEquals("newval", ((Element) m_node).getAttribute("attr0"));
@@ -445,12 +439,9 @@ public class ElementTest extends NodeWit
     void testSetAttributeNodeDiffDoc() {
         Attr result;
         Attr newAttr = m_docNS.createAttribute("attr0");
-        try {
-            result = ((Element) m_node).setAttributeNode(newAttr);
-            Assertions.fail("Attr Node diff doc in use");
-        } catch (DOMException de) {
-            assertEquals(DOMException.WRONG_DOCUMENT_ERR, de.code);
-        }
+        DOMException de = assertThrows(DOMException.class, () -> ((Element) m_node).setAttributeNode(newAttr),
+            "Attr Node diff doc in use");
+        assertEquals(DOMException.WRONG_DOCUMENT_ERR, de.code);
     }
 
     @Test
@@ -459,12 +450,8 @@ public class ElementTest extends NodeWit
         m_node = m_node.getParentNode().getParentNode();
         Attr newAttr = ((Element) m_node).getAttributeNode("attr0");
         m_node = m_node.getFirstChild();
-        try {
-            ((Element) m_node).setAttributeNode(newAttr);
-            Assertions.fail("Attr Node in use");
-        } catch (DOMException de) {
-            assertEquals(DOMException.INUSE_ATTRIBUTE_ERR, de.code);
-        }
+        DOMException de = assertThrows(DOMException.class, () -> ((Element) m_node).setAttributeNode(newAttr));
+        assertEquals(DOMException.INUSE_ATTRIBUTE_ERR, de.code);
     }
 
     @Test
@@ -517,51 +504,35 @@ public class ElementTest extends NodeWit
     @Test
     void testSetAttributeNSBadNS() {
         //qualifiedName is malformed
-        try {
-            ((Element) m_node).setAttributeNS("foo:org", "invalid<", "0");
-            Assertions.fail("Invalid attr name");
-        } catch (DOMException de) {
-            assertEquals(DOMException.INVALID_CHARACTER_ERR, de.code);
-        }
+        DOMException de1 = assertThrows(DOMException.class, () ->
+            ((Element) m_node).setAttributeNS("foo:org", "invalid<", "0"), "Invalid attr name");
+        assertEquals(DOMException.INVALID_CHARACTER_ERR, de1.code);
 
         //the qualifiedName has a prefix and the namespaceURI is null
-        try {
-            String sNull = null;
-            ((Element) m_node).setAttributeNS(sNull, "myfoo:at", "0");
-            Assertions.fail("Invalid attr name");
-        } catch (DOMException de) {
-            assertEquals(DOMException.NAMESPACE_ERR, de.code);
-        }
+        DOMException de2 = assertThrows(DOMException.class, () ->
+            ((Element) m_node).setAttributeNS(null, "myfoo:at", "0"), "Invalid attr name");
+        assertEquals(DOMException.NAMESPACE_ERR, de2.code);
     }
 
     @Test
     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");
-            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");
-            Assertions.fail("Invalid attr name");
-        } catch (DOMException de) {
-            assertEquals(DOMException.NAMESPACE_ERR, de.code);
-        }
+        DOMException de1 = assertThrows(DOMException.class, () ->
+            ((Element) m_node).setAttributeNS("foo:org:uri", "xmlns", "0"), "Invalid attr name");
+        assertEquals(DOMException.NAMESPACE_ERR, de1.code);
+
+        DOMException de2 = assertThrows(DOMException.class, () ->
+            ((Element) m_node).setAttributeNS("foo:org:uri", "xmlns:foo", "0"), "Invalid attr name");
+        assertEquals(DOMException.NAMESPACE_ERR, de2.code);
     }
 
     @Test
     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");
-            Assertions.fail("Invalid attr name");
-        } catch (DOMException de) {
-            assertEquals(DOMException.NAMESPACE_ERR, de.code);
-        }
+        DOMException de = assertThrows(DOMException.class, () ->
+            ((Element) m_node).setAttributeNS("foo:org:uri", "xml:foo", "0"), "Invalid attr name");
+        assertEquals(DOMException.NAMESPACE_ERR, de.code);
     }
 
     @Test
@@ -601,8 +572,7 @@ public class ElementTest extends NodeWit
     @Test
     protected void testSetPrefix() {
         //set a null prefix
-        m_node =
-            m_docNS.getFirstChild().getFirstChild().getChildNodes().item(2);//<myns:yana/>
+        m_node = m_docNS.getFirstChild().getFirstChild().getChildNodes().item(2);//<myns:yana/>
         assertNotNull(m_node);
         m_node.setPrefix(null);
         assertEquals("", m_node.getPrefix());
@@ -612,16 +582,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
     void testNormalizeNode() throws Exception {
         m_node = m_node.getParentNode();
-        m_node.replaceChild(m_doc.createTextNode("txt1"),
-            m_node.getLastChild());
+        m_node.replaceChild(m_doc.createTextNode("txt1"), m_node.getLastChild());
         assertEquals(2, m_node.getChildNodes().getLength());
 
         m_node.normalize();
@@ -665,12 +632,8 @@ public class ElementTest extends NodeWit
         assertNull(elt.getPrefix(), "L1 prefix null");
         assertNull(elt.getLocalName(), "L1 LocalName null");
         assertNull(elt.getNamespaceURI(), "L1 Uri null");
-        try {
-            elt.setPrefix("foo");
-            Assertions.fail("L1 prefix null");
-        } catch (DOMException de) {
-            assertEquals(DOMException.NAMESPACE_ERR, de.code);
-        }
+        DOMException de = assertThrows(DOMException.class, () -> elt.setPrefix("foo"), "L1 prefix null");
+        assertEquals(DOMException.NAMESPACE_ERR, de.code);
     }
 
     public void 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=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/dom/checkin/NamedNodeMapTest.java (original)
+++ xmlbeans/trunk/src/test/java/dom/checkin/NamedNodeMapTest.java Mon Feb  7 22:20:51 2022
@@ -20,7 +20,6 @@ import dom.common.Loader;
 import dom.common.NodeTest;
 import dom.common.TestSetup;
 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.*;
@@ -133,24 +132,16 @@ public class NamedNodeMapTest implements
      */
     @Test
     void testRemoveNamedItemNull() {
-        try {
-            m_nodeMap.removeNamedItem(null);
-            Assertions.fail("removing a non-existing value");
-        }
-        catch (DOMException de) {
-            assertEquals(de.code, DOMException.NOT_FOUND_ERR);
-        }
+        DOMException de = assertThrows(DOMException.class, () -> m_nodeMap.removeNamedItem(null),
+            "removing a non-existing value");
+        assertEquals(de.code, DOMException.NOT_FOUND_ERR);
     }
 
     @Test
     void testRemoveNamedItem() {
-        try {
-            m_nodeMap.removeNamedItem("at7");
-            Assertions.fail("removing a non-existing value");
-        }
-        catch (DOMException de) {
-            assertEquals(de.code, DOMException.NOT_FOUND_ERR);
-        }
+        DOMException de = assertThrows(DOMException.class, () -> m_nodeMap.removeNamedItem("at7"),
+            "removing a non-existing value");
+        assertEquals(de.code, DOMException.NOT_FOUND_ERR);
 
         result = m_nodeMap.removeNamedItem("at3");
         assertEquals("val3", result.getNodeValue());
@@ -193,23 +184,12 @@ public class NamedNodeMapTest implements
     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)
-                Assertions.fail("removing a non-existing attr");
-        }
-        catch (DOMException de) {
-            assertEquals(de.code, DOMException.NOT_FOUND_ERR);
-        }
+        DOMException de = assertThrows(DOMException.class, () ->
+            m_nodeMap.removeNamedItemNS("uri:fo1", "at0"), "removing a non-existing attr");
+        assertEquals(de.code, DOMException.NOT_FOUND_ERR);
 
-        try {
-            result = m_nodeMap.getNamedItemNS("uri:fo1", null);
-            if (result != null)
-                Assertions.fail("removing a non-existing attr");
-        }
-        catch (DOMException de) {
-            assertEquals(de.code, DOMException.NOT_FOUND_ERR);
-        }
+        result = m_nodeMap.getNamedItemNS("uri:fo1", null);
+        assertNull(result, "removing a non-existing attr");
     }
 
     /**
@@ -220,44 +200,31 @@ public class NamedNodeMapTest implements
      */
     @Test
     void testSetNamedItem() {
-        Node newAt = m_doc.createAttribute("newAt");
-        ((Attr) newAt).setValue("newval");
-        m_nodeMap.setNamedItem(newAt);
+        Attr newAt1 = m_doc.createAttribute("newAt");
+        newAt1.setValue("newval");
+        m_nodeMap.setNamedItem(newAt1);
         assertEquals(nCount + 1, m_nodeMap.getLength());
         result = m_nodeMap.getNamedItem("newAt");
         assertEquals("newval", result.getNodeValue());
 
         //node cr. diff doc
-        newAt = m_docNS.createAttribute("newAt");
-        ((Attr) newAt).setValue("newval");
-        try {
-            m_nodeMap.setNamedItem(newAt);
-            Assertions.fail("Inserting node created from a different doc");
-        }
-        catch (DOMException de) {
-            assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR);
-        }
+        Attr newAt2 = m_docNS.createAttribute("newAt");
+        newAt2.setValue("newval");
+        DOMException de1 = assertThrows(DOMException.class, () -> m_nodeMap.setNamedItem(newAt2),
+            "Inserting node created from a different doc");
+        assertEquals(de1.code, DOMException.WRONG_DOCUMENT_ERR);
 
         //node in diff elt
-        newAt = m_node.getFirstChild().getAttributes().getNamedItem("bat0");
-        try {
-            m_nodeMap.setNamedItem(newAt);
-            Assertions.fail("Inserting node in use");
-        }
-        catch (DOMException de) {
-            assertEquals(de.code, DOMException.INUSE_ATTRIBUTE_ERR);
-        }
+        Node newAt3 = m_node.getFirstChild().getAttributes().getNamedItem("bat0");
+        DOMException de2 = assertThrows(DOMException.class, () -> m_nodeMap.setNamedItem(newAt3),
+            "Inserting node in use");
+        assertEquals(de2.code, DOMException.INUSE_ATTRIBUTE_ERR);
 
         //not an attr
-        newAt = m_doc.createElement("newElt");
-        try {
-            m_nodeMap.setNamedItem(newAt);
-            Assertions.fail("Inserting node  different doc");
-        }
-        catch (DOMException de) {
-            assertEquals(de.code, DOMException.HIERARCHY_REQUEST_ERR);
-        }
-
+        Node newAt4 = m_doc.createElement("newElt");
+        DOMException de3 = assertThrows(DOMException.class, () -> m_nodeMap.setNamedItem(newAt4),
+            "Inserting node different doc");
+        assertEquals(de3.code, DOMException.HIERARCHY_REQUEST_ERR);
     }
 
     @Test
@@ -268,13 +235,9 @@ public class NamedNodeMapTest implements
     @Test
     void testSetNamedItemDiffImpl() throws Exception {
         Node toSet = NodeTest.getApacheNode(sXml, false, 'A');
-        try {
-            m_nodeMap.setNamedItem(toSet);
-            Assertions.fail("Inserting node  different impl");
-        }
-        catch (DOMException de) {
-            assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR);
-        }
+        DOMException de = assertThrows(DOMException.class, () -> m_nodeMap.setNamedItem(toSet),
+            "Inserting node different impl");
+        assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR);
     }
 
     @Test
@@ -310,38 +273,26 @@ public class NamedNodeMapTest implements
     @Test
     void testSetNamedItemNSDiffImpl() throws Exception {
         Node toSet = NodeTest.getApacheNode(sXml, true, 'A');
-        try {
-            m_nodeMap.setNamedItemNS(toSet);
-            Assertions.fail("Inserting node  different impl");
-        }
-        catch (DOMException de) {
-            assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR);
-        }
+        DOMException de = assertThrows(DOMException.class, () -> m_nodeMap.setNamedItemNS(toSet),
+            "Inserting node  different impl");
+        assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR);
     }
 
     //try to set a node of a diff type than the current collection
     @Test
-    void testSetNamedItemDiffType() throws Exception {
+    void testSetNamedItemDiffType() {
         Node toSet = m_doc.createElement("foobar");
-        try {
-            m_nodeMap.setNamedItem(toSet);
-            Assertions.fail("Inserting node  different impl");
-        }
-        catch (DOMException de) {
-            assertEquals(de.code, DOMException.HIERARCHY_REQUEST_ERR);
-        }
+        DOMException de = assertThrows(DOMException.class, () -> m_nodeMap.setNamedItem(toSet),
+            "Inserting node different impl");
+        assertEquals(de.code, DOMException.HIERARCHY_REQUEST_ERR);
     }
 
     @Test
-    void testSetNamedItemNSDiffType() throws Exception {
+    void testSetNamedItemNSDiffType() {
         Node toSet = m_doc.createElementNS("foo:org", "com:foobar");
-        try {
-            m_nodeMap.setNamedItemNS(toSet);
-            Assertions.fail("Inserting node  different impl");
-        }
-        catch (DOMException de) {
-            assertEquals(de.code, DOMException.HIERARCHY_REQUEST_ERR);
-        }
+        DOMException de = assertThrows(DOMException.class, () -> m_nodeMap.setNamedItemNS(toSet),
+            "Inserting node different impl");
+        assertEquals(de.code, DOMException.HIERARCHY_REQUEST_ERR);
     }
 
 

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=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/dom/checkin/PITest.java (original)
+++ xmlbeans/trunk/src/test/java/dom/checkin/PITest.java Mon Feb  7 22:20:51 2022
@@ -17,7 +17,6 @@
 package dom.checkin;
 
 import dom.common.NodeTest;
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.w3c.dom.DOMException;
@@ -110,24 +109,13 @@ public class PITest extends NodeTest {
     //TODO: Test Illegal PI Targets: xml target, starting with a digit
     @Test
     void testPiTargetIllegalChars() {
-        ProcessingInstruction node;
-        try {
-            node =
-                    m_doc.createProcessingInstruction("7foo:?123-&",
-                            "some body");
-            Assertions.fail("Can't start w/ a digit");
-        }
-        catch (DOMException e) {
-            assertEquals(DOMException.INVALID_CHARACTER_ERR, e.code);
-        }
-
-        try {
-            node = m_doc.createProcessingInstruction("xml", "foo");
-            Assertions.fail("Can't be xml");
-        }
-        catch (DOMException e) {
-            assertEquals(DOMException.INVALID_CHARACTER_ERR, e.code);
-        }
+        DOMException e1 = assertThrows(DOMException.class, () ->
+            m_doc.createProcessingInstruction("7foo:?123-&", "some body"), "Can't start w/ a digit");
+        assertEquals(DOMException.INVALID_CHARACTER_ERR, e1.code);
+
+        DOMException e2 = assertThrows(DOMException.class, () ->
+            m_doc.createProcessingInstruction("xml", "foo"), "Can't be xml");
+        assertEquals(DOMException.INVALID_CHARACTER_ERR, e2.code);
     }
 
     @BeforeEach

Modified: xmlbeans/trunk/src/test/java/dom/common/CharacterDataTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/common/CharacterDataTest.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/dom/common/CharacterDataTest.java (original)
+++ xmlbeans/trunk/src/test/java/dom/common/CharacterDataTest.java Mon Feb  7 22:20:51 2022
@@ -16,7 +16,6 @@
 
 package dom.common;
 
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.w3c.dom.CharacterData;
@@ -76,8 +75,7 @@ public abstract class CharacterDataTest
         String sNewData = "some new data";
         ((CharacterData) m_node).appendData(sNewData);
         String sExpected = sOrig + sNewData;
-        if (!(sExpected.equals(((CharacterData) m_node).getData())))
-            Assertions.fail(" Expected " + sExpected + " but got " + ((CharacterData) m_node).getData());
+        assertEquals(sExpected, ((CharacterData) m_node).getData());
     }
 
     @Test
@@ -187,23 +185,16 @@ public abstract class CharacterDataTest
     private void _testInsertData(int offset, String toInsert) {
         String sData = ((CharacterData) m_node).getData();
         int nDataLen = sData.length();
-        if (offset < 0 || offset > nDataLen)
-            try {
-                ((CharacterData) m_node).insertData(offset, toInsert);
-                Assertions.fail("Inserting OOB chars");
-            } catch (DOMException de) {
-                assertEquals(de.code, DOMException.INDEX_SIZE_ERR);
-            }
-        else {
+        if (offset < 0 || offset > nDataLen) {
+            DOMException de = assertThrows(DOMException.class, () -> ((CharacterData) m_node).insertData(offset, toInsert), "Inserting OOB chars");
+            assertEquals(de.code, DOMException.INDEX_SIZE_ERR);
+        } else {
             ((CharacterData) m_node).insertData(offset, toInsert);
-            if (toInsert == null)
+            if (toInsert == null) {
                 assertEquals(sData, ((CharacterData) m_node).getData());
-            else if (offset == nDataLen)
+            } else if (offset == nDataLen) {
                 assertEquals(sData + toInsert, ((CharacterData) m_node).getData());
-            else {
-                System.out.println(nDataLen - offset);
-                System.out.println(offset);
-                System.out.println(offset + toInsert.length());
+            } else {
                 String s1 = sData.substring(0, offset);
                 String s2 = sData.substring(offset, nDataLen);
                 assertEquals(s1 + toInsert + s2, ((CharacterData) m_node).getData());
@@ -327,21 +318,18 @@ public abstract class CharacterDataTest
         String sData = ((CharacterData) m_node).getData();
         int nDataLen = sData.length();
         String result;
-        if (offset < 0 || offset > nDataLen || count < 0)
-            try {
-                ((CharacterData) m_node).substringData(offset, count);
-                Assertions.fail("Deleting OOB chars");
-            } catch (DOMException de) {
-                assertEquals(de.code, DOMException.INDEX_SIZE_ERR);
-            }
-        else {
+        if (offset < 0 || offset > nDataLen || count < 0) {
+            DOMException de = assertThrows(DOMException.class, () -> ((CharacterData) m_node).substringData(offset, count), "Deleting OOB chars");
+            assertEquals(de.code, DOMException.INDEX_SIZE_ERR);
+        } else {
             result = ((CharacterData) m_node).substringData(offset, count);
-            if (count == 0)
+            if (count == 0) {
                 assertEquals("", result);
-            else if (offset + count == nDataLen || (offset + count) > nDataLen)
+            } else if (offset + count == nDataLen || (offset + count) > nDataLen) {
                 assertEquals(sData, result);
-            else
+            } else {
                 assertEquals(sData.substring(offset, count), result);
+            }
         }
     }
 

Modified: xmlbeans/trunk/src/test/java/dom/detailed/AttrNamespaceTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/detailed/AttrNamespaceTest.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/dom/detailed/AttrNamespaceTest.java (original)
+++ xmlbeans/trunk/src/test/java/dom/detailed/AttrNamespaceTest.java Mon Feb  7 22:20:51 2022
@@ -80,18 +80,6 @@ public class AttrNamespaceTest {
 
         assertEquals("reg_attr_val", at.getValue());
         assertEquals("myns:bar", m_node.getFirstChild().getNodeName());
-
-        /*
-
-        if(!(m_node instanceof DomImpl))
-            fail(m_node.getClass().toString());
-
-        org.apache.xmlbeans.XmlCursor  cur=Public2.getCursor(m_node);
-
-        assertFalse(cur.isNamespace());
-        assertTrue(cur.isAnyAttr());
-        assertTrue(cur.isAttr());
-        */
     }
 
     /**

Modified: xmlbeans/trunk/src/test/java/dom/detailed/InsertDeleteNodesTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/detailed/InsertDeleteNodesTest.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/dom/detailed/InsertDeleteNodesTest.java (original)
+++ xmlbeans/trunk/src/test/java/dom/detailed/InsertDeleteNodesTest.java Mon Feb  7 22:20:51 2022
@@ -16,12 +16,12 @@
 package dom.detailed;
 
 import dom.common.Loader;
-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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 
 /**
@@ -142,12 +142,8 @@ public class InsertDeleteNodesTest {
 		//m_doc.insertBefore(pi,root);
 		//m_doc.insertBefore(cdata,root);
 
-		try {
-			m_doc.insertBefore(root, doc_frag.getLastChild());
-			Assertions.fail("Should except here");
-		} catch (DOMException de) {
-			assertEquals(de.code, DOMException.HIERARCHY_REQUEST_ERR);
-		}
+		DOMException de = assertThrows(DOMException.class, () -> m_doc.insertBefore(root, doc_frag.getLastChild()));
+		assertEquals(de.code, DOMException.HIERARCHY_REQUEST_ERR);
     }
     //TODO: insert nodes at all illegal places:
 

Modified: xmlbeans/trunk/src/test/java/dom/detailed/MoveImportNodeTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/dom/detailed/MoveImportNodeTest.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/dom/detailed/MoveImportNodeTest.java (original)
+++ xmlbeans/trunk/src/test/java/dom/detailed/MoveImportNodeTest.java Mon Feb  7 22:20:51 2022
@@ -17,7 +17,6 @@
 package dom.detailed;
 
 import dom.common.Loader;
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.w3c.dom.DOMException;
@@ -74,13 +73,11 @@ public class MoveImportNodeTest {
     //import to a doc where the given ns DNE
 	@Test
     void testMoveDiffDoc(){
-		Node toMove=m_docNS.getFirstChild().getFirstChild().getFirstChild(); //bar
-		try{
-			m_node.insertBefore(toMove,m_node.getFirstChild());
-			Assertions.fail(" Cannot move nodes across docs");
-		}catch(DOMException de){
-			assertEquals(DOMException.WRONG_DOCUMENT_ERR, de.code);
-		}
+		//bar
+		Node toMove=m_docNS.getFirstChild().getFirstChild().getFirstChild();
+		DOMException de = assertThrows(DOMException.class, () ->
+			m_node.insertBefore(toMove,m_node.getFirstChild()), " Cannot move nodes across docs");
+		assertEquals(DOMException.WRONG_DOCUMENT_ERR, de.code);
     }
 
 	@Test
@@ -94,15 +91,10 @@ public class MoveImportNodeTest {
 		Document xercesDocument = parser.getDocument();
 		assertNotNull(xercesDocument);
 		Node toMove = xercesDocument.getFirstChild().getFirstChild().getFirstChild(); //bar
-		System.out.println("=======Source Impl " + xercesDocument.getImplementation());
-		System.out.println("=======Dest Impl " + m_doc.getImplementation());
 
-		try {
-			m_node.insertBefore(toMove, m_node.getFirstChild());
-			Assertions.fail(" Cannot move nodes across implementations");
-		} catch (DOMException de) {
-			assertEquals(DOMException.WRONG_DOCUMENT_ERR, de.code);
-		}
+		DOMException de = assertThrows(DOMException.class, () -> m_node.insertBefore(toMove, m_node.getFirstChild()),
+			"Cannot move nodes across implementations");
+		assertEquals(DOMException.WRONG_DOCUMENT_ERR, de.code);
 
 		Node imported = m_doc.importNode(toMove, true);//deep would be the same here
 		m_node.appendChild(imported);

Modified: xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression151_200Test.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression151_200Test.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression151_200Test.java (original)
+++ xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression151_200Test.java Mon Feb  7 22:20:51 2022
@@ -22,7 +22,6 @@ import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.impl.tool.Parameters;
 import org.apache.xmlbeans.impl.tool.SchemaCompiler;
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 import java.io.File;
@@ -30,8 +29,7 @@ import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  *
@@ -101,30 +99,14 @@ public class JiraRegression151_200Test e
         params.setClassesDir(schemaCompClassesDir);
         params.setNoPvr(true);
 
-        try {
-            SchemaCompiler.compile(params);
-        } catch (NullPointerException npe) {
-            npe.printStackTrace();
-            Assertions.fail("NPE when executing scomp");
-        }
-
-        if (hasSevereError(errors)) {
-            Assertions.fail("test_jira_xmlbeans184() : Errors found when executing scomp");
-        }
+        SchemaCompiler.compile(params);
+        assertFalse(hasSevereError(errors));
 
         // now compile without the pvr option and NPE is thrown
         params.setNoPvr(false);
-        try {
-            SchemaCompiler.compile(params);
-        } catch (NullPointerException npe) {
-            npe.printStackTrace();
-            Assertions.fail("NPE when executing scomp");
-        }
-
-        if (hasSevereError(errors)) {
-            Assertions.fail("test_jira_xmlbeans184() : Errors found when executing scomp ");
-        }
+        SchemaCompiler.compile(params);
 
+        assertFalse(hasSevereError(errors));
     }
 
 

Modified: xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression1_50Test.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression1_50Test.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression1_50Test.java (original)
+++ xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression1_50Test.java Mon Feb  7 22:20:51 2022
@@ -19,7 +19,6 @@ import org.apache.xmlbeans.*;
 import org.apache.xmlbeans.impl.tool.Parameters;
 import org.apache.xmlbeans.impl.tool.SchemaCompiler;
 import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.w3c.dom.Element;
@@ -27,7 +26,10 @@ import org.w3c.dom.NamedNodeMap;
 import xmlbeans48.FeedInfoType;
 
 import javax.xml.namespace.QName;
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -47,11 +49,10 @@ public class JiraRegression1_50Test exte
         xmlstringbuf.append("<testchild attr=\"abcd\"> Jira02 </testchild>");
         xmlstringbuf.append("</test>");
 
-        XmlObject myxmlobj = null;
         List<XmlError> errors = new ArrayList<>();
         XmlOptions options = new XmlOptions().setErrorListener(errors);
         try {
-            myxmlobj = XmlObject.Factory.parse(xmlstringbuf.toString(), options);
+            XmlObject myxmlobj = XmlObject.Factory.parse(xmlstringbuf.toString(), options);
             try (XmlCursor cur = myxmlobj.newCursor()) {
                 XmlError xmlerr = XmlError.forObject("This is my custom error message", XmlError.SEVERITY_ERROR, myxmlobj);
 
@@ -59,8 +60,6 @@ public class JiraRegression1_50Test exte
                 System.out.println("Cursor Text Value: " + cur.getTextValue());
             }
         } catch (XmlException ignored) {
-        } catch (NullPointerException npe) {
-            Assertions.fail("test_jira_xmlbeans02() : Null Pointer Exception thrown !");
         }
 
         hasSevereError(errors);
@@ -80,9 +79,7 @@ public class JiraRegression1_50Test exte
         params.setClassesDir(schemaCompClassesDir);
 
         SchemaCompiler.compile(params);
-        if (hasSevereError(errors)) {
-            Assertions.fail("test_jira_xmlbeans04() : Errors found when executing scomp");
-        }
+        assertFalse(hasSevereError(errors));
     }
 
 
@@ -97,27 +94,16 @@ public class JiraRegression1_50Test exte
         StringBuilder sb = new StringBuilder(" ");
         sb.append(System.getProperty("xbean.rootdir") + P + "bin" + P + "validate.cmd ");
         sb.append(scompTestFilesRoot + "xmlbeans_09.xsd_" + " " + scompTestFilesRoot + "xmlbeans_09.xml");
-        Process validator_proc = null;
-        try {
-            validator_proc = Runtime.getRuntime().exec(sb.toString());
-        } catch (NullPointerException npe) {
-            Assertions.fail("test_jira_xmlbeans09() : Null Pointer Exception when running validate for schema");
-        }
+        Process validator_proc = Runtime.getRuntime().exec(sb.toString());
 
         System.out.println("cmd:" + sb);
         BufferedInputStream inbuf = new BufferedInputStream(validator_proc.getInputStream());
         BufferedReader reader = new BufferedReader(new InputStreamReader(inbuf));
         String eachline = reader.readLine();
-        try {
 
-            while (reader.readLine() != null) {
-                System.out.println("output: " + eachline);
-            }
-        } catch (IOException ioe) {
-            ioe.getMessage();
-            ioe.printStackTrace();
+        while (reader.readLine() != null) {
+            System.out.println("output: " + eachline);
         }
-
     }
 
     /*
@@ -151,15 +137,10 @@ public class JiraRegression1_50Test exte
 
         System.out.println("NUMBER OF GLOBAL TYPES: " + st.length);
 
-        try {
-            // check if it is union type
-            for (SchemaType schemaType : st) {
-                System.out.println("IS UNION TYPE: " + (schemaType.getUnionMemberTypes() != null));
-            }
-        } catch (NullPointerException npe) {
-            Assertions.fail("test_jira_xmlbeans11(): Null Pointer Exception thrown !");
+        // check if it is union type
+        for (SchemaType schemaType : st) {
+            System.out.println("IS UNION TYPE: " + (schemaType.getUnionMemberTypes() != null));
         }
-
     }
 
     /*
@@ -262,10 +243,7 @@ public class JiraRegression1_50Test exte
         params.setNoPvr(true);
 
         SchemaCompiler.compile(params);
-        if (hasSevereError(errors)) {
-            Assertions.fail("test_jira_xmlbeans34() : Errors found when executing scomp");
-        }
-
+        assertFalse(hasSevereError(errors));
     }
 
 
@@ -452,16 +430,10 @@ public class JiraRegression1_50Test exte
         // needs network downloads enabled
         params.setDownload(true);
 
-        try {
-            SchemaCompiler.compile(params);
-        } catch (Exception ex) {
-            Assertions.fail("test_jira_xmlbeans49() :Exception thrown with above errors!");
-        }
+        SchemaCompiler.compile(params);
 
         // view errors
-        if (hasSevereError(errors)) {
-            Assertions.fail("test_jira_xmlbeans49() : Errors found when executing scomp");
-        }
+        assertFalse(hasSevereError(errors));
     }
 
     /**

Modified: xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression50_100Test.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression50_100Test.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression50_100Test.java (original)
+++ xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression50_100Test.java Mon Feb  7 22:20:51 2022
@@ -49,8 +49,7 @@ import java.util.*;
 import static org.junit.jupiter.api.Assertions.*;
 
 
-public class JiraRegression50_100Test extends JiraTestBase
-{
+public class JiraRegression50_100Test extends JiraTestBase {
 
 
     ///**
@@ -62,31 +61,29 @@ public class JiraRegression50_100Test ex
     //}
 
 
-
-
     /**
      * [XMLBEANS-52]   Validator loops when schema has certain conditions
      */
     @Test
     void test_jira_XmlBeans52() {
-     //reusing code from method test_jira_XmlBeans48()
-     String correctXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" +
-             "<!--Sample XML file generated by XMLSPY v5 rel. 4 U (http://www.xmlspy.com)--/> \n" +
-             "<aList xmlns=\"http://pfa.dk/dummy/errorInXmlBeansValidation.xsd\" " +
-             "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
-             "xsi:schemaLocation=\"http://pfa.dk/dummy/errorInXmlBeansValidation.xsd \n" +
-             "C:\\pfa\\techr3\\TransformationWorkbench\\schema\\errorInXmlBeansValidation.xsd\"> \n" +
-             "<myListEntry> \n" +
-             "<HelloWorld>Hello World</HelloWorld> \n" +
-             "</myListEntry> \n" +
-             "</aList> ";
+        //reusing code from method test_jira_XmlBeans48()
+        String correctXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" +
+                            "<!--Sample XML file generated by XMLSPY v5 rel. 4 U (http://www.xmlspy.com)--/> \n" +
+                            "<aList xmlns=\"http://pfa.dk/dummy/errorInXmlBeansValidation.xsd\" " +
+                            "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
+                            "xsi:schemaLocation=\"http://pfa.dk/dummy/errorInXmlBeansValidation.xsd \n" +
+                            "C:\\pfa\\techr3\\TransformationWorkbench\\schema\\errorInXmlBeansValidation.xsd\"> \n" +
+                            "<myListEntry> \n" +
+                            "<HelloWorld>Hello World</HelloWorld> \n" +
+                            "</myListEntry> \n" +
+                            "</aList> ";
 
 
-     }
+    }
 
     /*
-    * [XMLBEANS-54]: problem with default value
-    */
+     * [XMLBEANS-54]: problem with default value
+     */
     @Test
     void test_jira_xmlbeans54() {
         List<XmlError> errors = new ArrayList<>();
@@ -103,11 +100,7 @@ public class JiraRegression50_100Test ex
         params.setMemoryMaximumSize("1024m");
         params.setMemoryInitialSize("512m");
 
-        try {
-            SchemaCompiler.compile(params);
-        } catch (OutOfMemoryError ome) {
-            Assertions.fail("test_jira_xmlbeans54() - out of Heap Memory");
-        }
+        SchemaCompiler.compile(params);
     }
 
     /**
@@ -116,27 +109,25 @@ public class JiraRegression50_100Test ex
     @Test
     void test_jira_XmlBeans56() throws Exception {
         String xsdConfig = "<xb:config " +
-                " xmlns:xb=\"http://xml.apache.org/xmlbeans/2004/02/xbean/config\"\n" +
-                "    xmlns:ep=\"http://openuri.org/easypo\">\n" +
-                "    <xb:namespace uri=\"http://openuri.org/easypo\">\n" +
-                "        <xb:package>com.easypo</xb:package>\n" +
-                "    </xb:namespace>\n" +
-                "    <xb:namespace uri=\"##any\">\n" +
-                "        <xb:prefix>Xml</xb:prefix>\n" +
-                "        <xb:suffix>Bean</xb:suffix>\n" +
-                "    </xb:namespace>\n" +
-                "    <xb:extension for=\"com.easypo.XmlCustomerBean\">\n" +
-                "        <xb:interface name=\"myPackage.Foo\">\n" +
-                "            <xb:staticHandler>myPackage.FooHandler</xb:staticHandler>\n" +
-                "        </xb:interface>\n" +
-                "    </xb:extension>\n" +
-                "    <xb:qname name=\"ep:purchase-order\" javaname=\"purchaseOrderXXX\"/>\n" +
-                "</xb:config> ";
+                           " xmlns:xb=\"http://xml.apache.org/xmlbeans/2004/02/xbean/config\"\n" +
+                           "    xmlns:ep=\"http://openuri.org/easypo\">\n" +
+                           "    <xb:namespace uri=\"http://openuri.org/easypo\">\n" +
+                           "        <xb:package>com.easypo</xb:package>\n" +
+                           "    </xb:namespace>\n" +
+                           "    <xb:namespace uri=\"##any\">\n" +
+                           "        <xb:prefix>Xml</xb:prefix>\n" +
+                           "        <xb:suffix>Bean</xb:suffix>\n" +
+                           "    </xb:namespace>\n" +
+                           "    <xb:extension for=\"com.easypo.XmlCustomerBean\">\n" +
+                           "        <xb:interface name=\"myPackage.Foo\">\n" +
+                           "            <xb:staticHandler>myPackage.FooHandler</xb:staticHandler>\n" +
+                           "        </xb:interface>\n" +
+                           "    </xb:extension>\n" +
+                           "    <xb:qname name=\"ep:purchase-order\" javaname=\"purchaseOrderXXX\"/>\n" +
+                           "</xb:config> ";
         ConfigDocument config = ConfigDocument.Factory.parse(xsdConfig);
         xmOpts.setErrorListener(errorList);
-        if (!config.validate(xmOpts)) {
-            Assertions.fail("Config File did not validate - Error: " + errorList);
-        }
+        assertTrue(config.validate(xmOpts), "Config File did not validate");
     }
 
     /**
@@ -164,26 +155,28 @@ public class JiraRegression50_100Test ex
         for (XmlError o : errs) {
             String out = o.toString();
             System.out.println("Dav: " + out);
-            if (out.startsWith("Compiled types to"))
+            if (out.startsWith("Compiled types to")) {
                 outTextPresent = false;
+            }
         }
 
         //cleanup gen'd dirs
         srcDir.deleteOnExit();
         classDir.deleteOnExit();
 
-        if (outTextPresent)
+        if (outTextPresent) {
             System.out.println("No errors when running schemacompiler with DAV namespace");
-        else
+        } else {
             throw new Exception("There were errors while compiling XSD with DAV " +
-                    "namespace. See sys.out for more info");
+                                "namespace. See sys.out for more info");
+        }
     }
 
     /*
-    * [XMLBEANS-58]:resolving transitive <redefine>'d types...
-    * This is realted to xmlbeans36 - its the same case but the schemas seem to have been updated at the w3c site.
-    * Hence adding a new testcase with the new schemas
-    */
+     * [XMLBEANS-58]:resolving transitive <redefine>'d types...
+     * This is realted to xmlbeans36 - its the same case but the schemas seem to have been updated at the w3c site.
+     * Hence adding a new testcase with the new schemas
+     */
     @Test
     @Disabled("the url doesn't exist anymore ...")
     public void test_jira_xmlbeans58() throws Exception {
@@ -200,10 +193,7 @@ public class JiraRegression50_100Test ex
         params.setDownload(true);
 
         SchemaCompiler.compile(params);
-        if (hasSevereError(errors)) {
-            Assertions.fail("test_jira_xmlbeans55() : Errors found when executing scomp");
-        }
-
+        assertFalse(hasSevereError(errors));
     }
 
 
@@ -256,8 +246,9 @@ public class JiraRegression50_100Test ex
         validateOptions.setErrorListener(errorList);
         boolean isValid = doc.validate(validateOptions);
 
-        if (!isValid)
+        if (!isValid) {
             throw new Exception("Errors: " + errorList);
+        }
     }
 
     /**
@@ -266,33 +257,33 @@ public class JiraRegression50_100Test ex
     @Test
     void test_jira_XmlBeans66() throws Exception {
         String reproXsd = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" +
-                "<xsd:schema targetNamespace=\"http://www.w3.org/2003/12/XQueryX\" \n" +
-                "      xmlns=\"http://www.w3.org/2003/12/XQueryX\" \n" +
-                "      xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n" +
-                "      elementFormDefault=\"qualified\" \n" +
-                "      attributeFormDefault=\"qualified\"> \n" +
-                "  <!-- Kludge for anySimpleType --> \n" +
-                "  <xsd:simpleType name=\"constantValueType\"> \n" +
-                "    <xsd:union memberTypes=\"xsd:integer xsd:decimal xsd:string xsd:double\"/> \n" +
-                "  </xsd:simpleType> \n" +
-                "  <!-- constant expressions. We have 4 different subclasses for this --> \n" +
-                "  <xsd:complexType name=\"constantExpr\"> \n" +
-                "        <xsd:sequence> \n" +
-                "          <xsd:element name=\"value\" type=\"constantValueType\"/> \n" +
-                "        </xsd:sequence> \n" +
-                "  </xsd:complexType> \n" +
-                "  <xsd:complexType name=\"integerConstantExpr\"> \n" +
-                "    <xsd:complexContent> \n" +
-                "      <xsd:restriction base=\"constantExpr\"> \n" +
-                "        <xsd:sequence> \n" +
-                "          <xsd:element name=\"value\" type=\"xsd:integer\"/> \n" +
-                "        </xsd:sequence> \n" +
-                "      </xsd:restriction> \n" +
-                "    </xsd:complexContent> \n" +
-                "  </xsd:complexType>" +
-                "<!-- added for element validation -->" +
-                "<xsd:element name=\"Kludge\" type=\"integerConstantExpr\" />\n" +
-                "</xsd:schema> ";
+                          "<xsd:schema targetNamespace=\"http://www.w3.org/2003/12/XQueryX\" \n" +
+                          "      xmlns=\"http://www.w3.org/2003/12/XQueryX\" \n" +
+                          "      xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n" +
+                          "      elementFormDefault=\"qualified\" \n" +
+                          "      attributeFormDefault=\"qualified\"> \n" +
+                          "  <!-- Kludge for anySimpleType --> \n" +
+                          "  <xsd:simpleType name=\"constantValueType\"> \n" +
+                          "    <xsd:union memberTypes=\"xsd:integer xsd:decimal xsd:string xsd:double\"/> \n" +
+                          "  </xsd:simpleType> \n" +
+                          "  <!-- constant expressions. We have 4 different subclasses for this --> \n" +
+                          "  <xsd:complexType name=\"constantExpr\"> \n" +
+                          "        <xsd:sequence> \n" +
+                          "          <xsd:element name=\"value\" type=\"constantValueType\"/> \n" +
+                          "        </xsd:sequence> \n" +
+                          "  </xsd:complexType> \n" +
+                          "  <xsd:complexType name=\"integerConstantExpr\"> \n" +
+                          "    <xsd:complexContent> \n" +
+                          "      <xsd:restriction base=\"constantExpr\"> \n" +
+                          "        <xsd:sequence> \n" +
+                          "          <xsd:element name=\"value\" type=\"xsd:integer\"/> \n" +
+                          "        </xsd:sequence> \n" +
+                          "      </xsd:restriction> \n" +
+                          "    </xsd:complexContent> \n" +
+                          "  </xsd:complexType>" +
+                          "<!-- added for element validation -->" +
+                          "<xsd:element name=\"Kludge\" type=\"integerConstantExpr\" />\n" +
+                          "</xsd:schema> ";
 
         SchemaTypeLoader stl = makeSchemaTypeLoader(new String[]{reproXsd});
         QName reproQName = new QName("http://www.w3.org/2003/12/XQueryX", "Kludge");
@@ -316,19 +307,21 @@ public class JiraRegression50_100Test ex
         TestDatewTZone xdate = TestDatewTZone.Factory.newInstance();
         xdate.setGDateValue(gdate);
         TestElementWithDateAttributeDocument doc =
-                TestElementWithDateAttributeDocument.Factory.newInstance();
+            TestElementWithDateAttributeDocument.Factory.newInstance();
         TestElementWithDateAttributeDocument.TestElementWithDateAttribute root =
-                doc.addNewTestElementWithDateAttribute();
+            doc.addNewTestElementWithDateAttribute();
 
         root.xsetSomeDate(xdate);
         System.out.println("Doc: " + doc);
         System.out.println("Date: " + xdate.getStringValue());
 
         if (xdate.getStringValue().compareTo("") == 0 ||
-                xdate.getStringValue().length() <= 1)
+            xdate.getStringValue().length() <= 1) {
             throw new Exception("Date without TimeZone should not be empty");
-        if (root.getSomeDate().getTimeInMillis() != gdate.getCalendar().getTimeInMillis())
+        }
+        if (root.getSomeDate().getTimeInMillis() != gdate.getCalendar().getTimeInMillis()) {
             throw new Exception("Set Dates were not equal");
+        }
     }
 
     /**
@@ -342,24 +335,28 @@ public class JiraRegression50_100Test ex
         xmOpts.setErrorListener(errorList);
         abc.BazResponseDocument.BazResponse baz = doc.getBazResponse();
 
-        if (!doc.validate(xmOpts))
+        if (!doc.validate(xmOpts)) {
             System.out.println("DOC-ERRORS: " + errorList + "\n" + doc.xmlText());
-        else
+        } else {
             System.out.println("DOC-XML:\n" + doc.xmlText());
+        }
 
         errorList.clear();
         xmOpts.setErrorListener(errorList);
 
-        if (!baz.validate(xmOpts))
+        if (!baz.validate(xmOpts)) {
             System.out.println("BAZ-ERRORS: " + errorList + "\n" + baz.xmlText());
+        }
         //throw new Exception("Response Document did not validate\n"+errorList);
-        else
+        else {
             System.out.println("BAZ-XML:\n" + baz.xmlText());
+        }
 
-        if (baz.getStatus().compareTo("SUCCESS") != 0)
+        if (baz.getStatus().compareTo("SUCCESS") != 0) {
             throw new Exception("Status was not loaded properly");
-        else
+        } else {
             System.out.println("Sucess was received correctly");
+        }
     }
 
 
@@ -406,19 +403,22 @@ public class JiraRegression50_100Test ex
         //check values - compare to expected and DOM
         if (doc2Props != null) {
             if (doc2Props.getDoctypeName() == null ||
-                    doc2Props.getDoctypeName().compareTo(docTypeName) != 0 ||
-                    doc2Props.getDoctypeName().compareTo(docType.getName()) != 0)
+                doc2Props.getDoctypeName().compareTo(docTypeName) != 0 ||
+                doc2Props.getDoctypeName().compareTo(docType.getName()) != 0) {
                 compareText.append("docTypeName was not as expected in the document properties ").append(doc2Props.getDoctypeName()).append("\n");
+            }
 
             if (doc2Props.getDoctypePublicId() == null ||
-                    doc2Props.getDoctypePublicId().compareTo(docTypePublicID) != 0 ||
-                    doc2Props.getDoctypePublicId().compareTo(docType.getPublicId()) != 0)
+                doc2Props.getDoctypePublicId().compareTo(docTypePublicID) != 0 ||
+                doc2Props.getDoctypePublicId().compareTo(docType.getPublicId()) != 0) {
                 compareText.append("docTypePublicID was not as expected in the document properties ").append(doc2Props.getDoctypePublicId()).append("\n");
+            }
 
             if (doc2Props.getDoctypeSystemId() == null ||
-                    doc2Props.getDoctypeSystemId().compareTo(docTypeSystemID) != 0 ||
-                    doc2Props.getDoctypeSystemId().compareTo(docType.getSystemId()) != 0)
+                doc2Props.getDoctypeSystemId().compareTo(docTypeSystemID) != 0 ||
+                doc2Props.getDoctypeSystemId().compareTo(docType.getSystemId()) != 0) {
                 compareText.append("docTypeSystemID was not as expected in the document properties ").append(doc2Props.getDoctypeSystemId()).append("\n");
+            }
         } else {
             compareText.append("Document Properties were null, should have been set");
         }
@@ -426,8 +426,9 @@ public class JiraRegression50_100Test ex
         //cleanup
         new File(fileName).deleteOnExit();
 
-        if (compareText.toString().length() > 1)
+        if (compareText.toString().length() > 1) {
             throw new Exception("Doc properties were not saved or read correctly\n" + compareText);
+        }
     }
 
     /**
@@ -470,21 +471,21 @@ public class JiraRegression50_100Test ex
     @Test
     void test_jira_xmlbeans80() throws Exception {
         String xpathDoc = "<?xml version=\"1.0\"?> \n" +
-                "<doc xmlns:ext=\"http://somebody.elses.extension\"> \n" +
-                "  <ext:a test=\"test\" /> \n" +
-                "  <b attr1=\"a1\" attr2=\"a2\" \n" +
-                "  xmlns:java=\"http://xml.apache.org/xslt/java\"> \n" +
-                "    <a> \n" +
-                "    </a> \n" +
-                "  </b> \n" +
-                "</doc> ";
+                          "<doc xmlns:ext=\"http://somebody.elses.extension\"> \n" +
+                          "  <ext:a test=\"test\" /> \n" +
+                          "  <b attr1=\"a1\" attr2=\"a2\" \n" +
+                          "  xmlns:java=\"http://xml.apache.org/xslt/java\"> \n" +
+                          "    <a> \n" +
+                          "    </a> \n" +
+                          "  </b> \n" +
+                          "</doc> ";
         XmlObject xb80 = XmlObject.Factory.parse(xpathDoc);
         // change $this to '.' to avoid XQuery syntax error for $this not being declared
         //XmlObject[] resSet = xb80.selectPath("declare namespace " +
         //        "ext='http://somebody.elses.extension'; $this//ext:a[@test='test']");
 
         XmlObject[] resSet = xb80.selectPath("declare namespace " +
-                "ext='http://somebody.elses.extension'; .//ext:a[@test='test']");
+                                             "ext='http://somebody.elses.extension'; .//ext:a[@test='test']");
 
 
         assertEquals(1, resSet.length);
@@ -498,17 +499,17 @@ public class JiraRegression50_100Test ex
     @Test
     void test_jira_xmlbeans81() throws Exception {
         String xpathDoc = "<MatchedRecords>" +
-                "  <MatchedRecord>" +
-                "     <TableName>" +
-                "ABC" +
-                "</TableName>" +
-                "  </MatchedRecord>" +
-                "  <MatchedRecord>" +
-                "     <TableName>\n" +
-                "       BCD \n" +
-                "     </TableName> \n" +
-                "  </MatchedRecord> \n" +
-                "</MatchedRecords> ";
+                          "  <MatchedRecord>" +
+                          "     <TableName>" +
+                          "ABC" +
+                          "</TableName>" +
+                          "  </MatchedRecord>" +
+                          "  <MatchedRecord>" +
+                          "     <TableName>\n" +
+                          "       BCD \n" +
+                          "     </TableName> \n" +
+                          "  </MatchedRecord> \n" +
+                          "</MatchedRecords> ";
         XmlObject xb81 = XmlObject.Factory.parse(xpathDoc);
         // change $this to '.' to avoid XQuery syntax error for $this not being declared
         //XmlObject[] resSet = xb81.selectPath("$this//MatchedRecord[TableName=\"ABC\"]/TableName");
@@ -543,8 +544,8 @@ public class JiraRegression50_100Test ex
     }
 
     /*
-    * [XMLBEANS-88]:Cannot compile eBay schema
-    */
+     * [XMLBEANS-88]:Cannot compile eBay schema
+     */
     @Disabled
     @Test
     void test_jira_xmlbeans88() throws Exception {
@@ -575,14 +576,12 @@ public class JiraRegression50_100Test ex
             System.out.println("Ok Some Exception is caught here");
         }
 
-        if (hasSevereError(errors)) {
-            Assertions.fail("test_jira_xmlbeans88() : Errors found when executing scomp");
-        }
+        assertFalse(hasSevereError(errors));
     }
 
     /**
-    * [XMLBEANS-96]:XmlDocumentProperties missing version and encoding
-    */
+     * [XMLBEANS-96]:XmlDocumentProperties missing version and encoding
+     */
     @Test
     @Disabled
     public void test_jira_xmlbeans96() throws Exception {
@@ -616,7 +615,7 @@ public class JiraRegression50_100Test ex
         XmlOptions options = new XmlOptions();
 
         // associate namespaces with prefixes
-        Map<String,String> prefixes = new HashMap<>();
+        Map<String, String> prefixes = new HashMap<>();
         prefixes.put(structnamespace, "s");
         prefixes.put(datanamespace, "d");
         prefixes.put(xsinamespace, "v");
@@ -634,7 +633,7 @@ public class JiraRegression50_100Test ex
         try (XmlCursor c = root.newCursor()) {
             c.toNextToken();
             c.insertAttributeWithValue("schemaLocation", xsinamespace,
-                    structnamespace + " " + schemaloc);
+                structnamespace + " " + schemaloc);
         }
 
         //String expXML = doc.xmlText(options.setSavePrettyPrint())
@@ -674,75 +673,65 @@ public class JiraRegression50_100Test ex
         System.out.println("node = " + node);
         //UnTyped Verification
         XmlObject xObj = XmlObject.Factory.parse(new File(JIRA_CASES +
-                "xmlbeans_99.xml"));
+                                                          "xmlbeans_99.xml"));
         org.w3c.dom.Node xNode = xObj.newDomNode();
         System.out.println("xNode: " + xNode);
     }
 
     /*
-    * [XMLBEANS-99]: NPE/AssertionFailure in newDomNode()
-    * refer to [XMLBEANS-14]
-    */
-    @Test
-    void test_jira_xmlbeans99_b() {
-        StringBuilder xmlstringbuf = new StringBuilder("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> \n");
-        xmlstringbuf.append("                <x:dummy xmlns:x=\"http://dufourrault\" xmlns:xsi=\"http://www.w3.org/2000/10/XMLSchema-instance\" xsi:SchemaLocation=\"dummy.xsd\">\n");
-        xmlstringbuf.append("                    <x:father>\n");
-        xmlstringbuf.append("                     <x:son>toto</x:son> \n");
-        xmlstringbuf.append("                    </x:father>\n");
-        xmlstringbuf.append("              </x:dummy>");
-
-        try {
-            //From empty instance
-            DummyDocument newDoc = DummyDocument.Factory.newInstance();
-            DummyDocument.Dummy newDummy = newDoc.addNewDummy();
-            Node newNode = newDummy.newDomNode();
-            System.out.println("New Node = " + newNode);
-
-            //set Item
-            DummyDocument new2Doc = DummyDocument.Factory.newInstance();
-            DummyDocument.Dummy new2Dummy = new2Doc.addNewDummy();
-            Father newFather= Father.Factory.newInstance();
-            newFather.setSon("son");
-            new2Dummy.setFather(newFather);
-            Node new2Node = new2Dummy.newDomNode();
-            System.out.println("SetFather Node = " + new2Node);
-
-            //With Loaded instance Document
-            DummyDocument doc = DummyDocument.Factory.parse(xmlstringbuf.toString());
-            Node node = doc.newDomNode();
-            System.out.println("node = " + node);
-            //Just Element Type Node
-            dufourrault.DummyDocument.Dummy dummy = doc.addNewDummy();
-            Node typeNode = dummy.newDomNode();
-            System.out.println("TypeNode = "+typeNode);
-
-            dufourrault.Father fatherType = Father.Factory.newInstance();
-            fatherType.setSon("son");
-            Node fatherTypeNode = fatherType.newDomNode();
-            System.out.println("New Father Type Node: "+ fatherTypeNode);
-
-        } catch (NullPointerException npe) {
-            Assertions.fail("test_jira_xmlbeans99() : Null Pointer Exception when create Dom Node");
-        } catch (Exception e) {
-            Assertions.fail("test_jira_xmlbeans99() : Exception when create Dom Node");
-        }
+     * [XMLBEANS-99]: NPE/AssertionFailure in newDomNode()
+     * refer to [XMLBEANS-14]
+     */
+    @Test
+    void test_jira_xmlbeans99_b() throws XmlException {
+        String xmlstringbuf =
+            "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> \n" +
+            "<x:dummy xmlns:x=\"http://dufourrault\" xmlns:xsi=\"http://www.w3.org/2000/10/XMLSchema-instance\" xsi:SchemaLocation=\"dummy.xsd\">\n" +
+            "    <x:father>\n" +
+            "        <x:son>toto</x:son> \n" +
+            "    </x:father>\n" +
+            "</x:dummy>";
+
+        //From empty instance
+        DummyDocument newDoc = DummyDocument.Factory.newInstance();
+        DummyDocument.Dummy newDummy = newDoc.addNewDummy();
+        Node newNode = newDummy.newDomNode();
+        assertNotNull(newNode);
+
+        //set Item
+        DummyDocument new2Doc = DummyDocument.Factory.newInstance();
+        DummyDocument.Dummy new2Dummy = new2Doc.addNewDummy();
+        Father newFather = Father.Factory.newInstance();
+        newFather.setSon("son");
+        new2Dummy.setFather(newFather);
+        Node new2Node = new2Dummy.newDomNode();
+        assertNotNull(new2Node);
+
+        //With Loaded instance Document
+        DummyDocument doc = DummyDocument.Factory.parse(xmlstringbuf);
+        Node node = doc.newDomNode();
+        assertNotNull(node);
+        //Just Element Type Node
+        dufourrault.DummyDocument.Dummy dummy = doc.addNewDummy();
+        Node typeNode = dummy.newDomNode();
+        assertNotNull(typeNode);
+
+        dufourrault.Father fatherType = Father.Factory.newInstance();
+        fatherType.setSon("son");
+        Node fatherTypeNode = fatherType.newDomNode();
+        assertNotNull(fatherTypeNode);
     }
 
 
-
     /**
      * For Testing jira issue 84
      */
-    public static class XPathThread extends TestThread
-    {
-        public XPathThread()
-        {
+    public static class XPathThread extends TestThread {
+        public XPathThread() {
             super();
         }
 
-        public void run()
-        {
+        public void run() {
 
             try {
                 for (int i = 0; i < ITERATION_COUNT; i++) {
@@ -767,16 +756,15 @@ public class JiraRegression50_100Test ex
             }
         }
 
-        public void runStatusXPath()
-        {
+        public void runStatusXPath() {
             try {
                 System.out.println("Testing Status");
                 String statusDoc = "<statusreport xmlns=\"http://openuri.org/enumtest\">\n" +
-                        "  <status name=\"first\" target=\"all\">all</status>\n" +
-                        "  <status name=\"second\" target=\"all\">few</status>\n" +
-                        "  <status name=\"third\" target=\"none\">most</status>\n" +
-                        "  <status name=\"first\" target=\"none\">none</status>\n" +
-                        "</statusreport>";
+                                   "  <status name=\"first\" target=\"all\">all</status>\n" +
+                                   "  <status name=\"second\" target=\"all\">few</status>\n" +
+                                   "  <status name=\"third\" target=\"none\">most</status>\n" +
+                                   "  <status name=\"first\" target=\"none\">none</status>\n" +
+                                   "</statusreport>";
                 XmlObject path = XmlObject.Factory.parse(statusDoc, xm);
                 XmlObject[] resSet = path.selectPath("//*:status");
                 assertEquals(4, resSet.length, resSet.length + "");
@@ -789,19 +777,18 @@ public class JiraRegression50_100Test ex
             }
         }
 
-        public void runDocXPath()
-        {
+        public void runDocXPath() {
             try {
                 System.out.println("Testing Doc");
                 String docDoc = "<?xml version=\"1.0\"?>\n" +
-                        "<doc xmlns:ext=\"http://somebody.elses.extension\">\n" +
-                        "  <a test=\"test\" />\n" +
-                        "  <b attr1=\"a1\" attr2=\"a2\"   \n" +
-                        "  xmlns:java=\"http://xml.apache.org/xslt/java\">\n" +
-                        "    <a>\n" +
-                        "    </a> \n" +
-                        "  </b>\n" +
-                        "</doc><!-- -->  ";
+                                "<doc xmlns:ext=\"http://somebody.elses.extension\">\n" +
+                                "  <a test=\"test\" />\n" +
+                                "  <b attr1=\"a1\" attr2=\"a2\"   \n" +
+                                "  xmlns:java=\"http://xml.apache.org/xslt/java\">\n" +
+                                "    <a>\n" +
+                                "    </a> \n" +
+                                "  </b>\n" +
+                                "</doc><!-- -->  ";
                 XmlObject path = XmlObject.Factory.parse(docDoc, xm);
                 XmlObject[] resSet = path.selectPath("//a");
                 assertEquals(2, resSet.length);

Modified: xmlbeans/trunk/src/test/java/misc/detailed/JiraRegressionTest101_150.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/misc/detailed/JiraRegressionTest101_150.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/misc/detailed/JiraRegressionTest101_150.java (original)
+++ xmlbeans/trunk/src/test/java/misc/detailed/JiraRegressionTest101_150.java Mon Feb  7 22:20:51 2022
@@ -20,7 +20,6 @@ import org.apache.xmlbeans.XmlError;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.impl.tool.Parameters;
 import org.apache.xmlbeans.impl.tool.SchemaCompiler;
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 import java.io.File;
@@ -28,6 +27,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 
 /**
  *
@@ -61,8 +61,6 @@ public class JiraRegressionTest101_150 e
     */
     @Test
     void test_jira_xmlbeans102b() {
-        //Assert.fail("test_jira_xmlbeans102: Infinite loop after completion of parsing" );
-
         Parameters params = new Parameters();
         params.setOutputJar(new File(schemaCompOutputDirPath + "jira102.jar"));
         params.setClassesDir(schemaCompClassesDir);
@@ -74,10 +72,7 @@ public class JiraRegressionTest101_150 e
         params.setClassesDir(schemaCompClassesDir);
 
         SchemaCompiler.compile(params);
-        if (hasSevereError(errors)) {
-            Assertions.fail("test_jira_xmlbeans102() : Errors found when executing scomp");
-        }
-
+        assertFalse(hasSevereError(errors));
     }
 
     /**

Modified: xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/ListType.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/ListType.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/ListType.java (original)
+++ xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/ListType.java Mon Feb  7 22:20:51 2022
@@ -20,7 +20,6 @@ import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.XmlSimpleList;
 import org.apache.xmlbeans.impl.values.XmlValueNotSupportedException;
 import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import xbean.scomp.contentType.list.*;
@@ -79,7 +78,6 @@ public class ListType {
     @Disabled
     public void testListofLists() {
         //also,a list of union that contains a list is not OK
-        Assertions.fail("Compile Time eror");
     }
 
     /**

Modified: xmlbeans/trunk/src/test/java/xmlcursor/checkin/StoreTests.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlcursor/checkin/StoreTests.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlcursor/checkin/StoreTests.java (original)
+++ xmlbeans/trunk/src/test/java/xmlcursor/checkin/StoreTests.java Mon Feb  7 22:20:51 2022
@@ -1880,13 +1880,7 @@ public class StoreTests {
     }
 
     private void dotestParserErrors(String xml) {
-        try {
-            XmlObject.Factory.parse(xml);
-        } catch (Throwable t) {
-            return;
-        }
-
-        Assertions.fail();
+        assertThrows(Throwable.class, () -> XmlObject.Factory.parse(xml));
     }
 
     @Test

Modified: xmlbeans/trunk/src/test/java/xmlcursor/common/BasicCursorTestCase.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlcursor/common/BasicCursorTestCase.java?rev=1897830&r1=1897829&r2=1897830&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlcursor/common/BasicCursorTestCase.java (original)
+++ xmlbeans/trunk/src/test/java/xmlcursor/common/BasicCursorTestCase.java Mon Feb  7 22:20:51 2022
@@ -27,7 +27,7 @@ import tools.util.JarUtil;
 import java.io.IOException;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
 
 public final class BasicCursorTestCase {
 
@@ -39,8 +39,7 @@ public final class BasicCursorTestCase {
         }
 
         while (xc.toNextToken() != tt) {
-            if (xc.currentTokenType() == TokenType.ENDDOC)
-                fail("Expected Token not found! " + tt.toString());
+            assertNotEquals(TokenType.ENDDOC, xc.currentTokenType(), "Expected Token not found!");
         }
         assertEquals(tt, xc.currentTokenType());
     }
@@ -59,8 +58,7 @@ public final class BasicCursorTestCase {
         }
 
         while (xc.toPrevToken() != tt) {
-            if (xc.currentTokenType() == TokenType.STARTDOC)
-                fail("Expected Token not found! " + tt.toString());
+            assertNotEquals(TokenType.STARTDOC, xc.currentTokenType());
         }
         assertEquals(tt, xc.currentTokenType());
     }
@@ -79,12 +77,7 @@ public final class BasicCursorTestCase {
         while (a.hasNextToken() && b.hasNextToken()) {
             TokenType ttOrig = a.currentTokenType();
             TokenType ttRoundTrip = b.currentTokenType();
-            if (ttOrig != ttRoundTrip) {
-                fail("Round trip failed.  Original Cursor TokenType = "
-                     + ttOrig + " Roundtrip Cursor TokenType = "
-                     + ttRoundTrip);
-
-            }
+            assertEquals(ttOrig, ttRoundTrip);
             a.toNextToken();
             b.toNextToken();
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org