Modified: xmlbeans/trunk/src/test/java/xmlobject/checkin/XPathTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/checkin/XPathTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/checkin/XPathTest.java (original)
+++ xmlbeans/trunk/src/test/java/xmlobject/checkin/XPathTest.java Sun Feb  6 
01:51:55 2022
@@ -18,14 +18,14 @@ package xmlobject.checkin;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class XPathTest {
     @Test
-    public void testPath() throws XmlException {
+    void testPath() throws XmlException {
         final XmlObject obj = XmlObject.Factory.parse(
             "<a>" +
                 "<b>" +
@@ -38,20 +38,19 @@ public class XPathTest {
             c.selectPath(".//b/c");
 
             int selCount = c.getSelectionCount();
-            assertEquals("SelectionCount", 1, selCount);
+            assertEquals(1, selCount, "SelectionCount");
 
             while (c.hasNextSelection()) {
                 c.toNextSelection();
 
-                assertTrue("OnStartElement", c.isStart());
-                assertEquals("TextValue", "val1", c.getTextValue());
-                System.out.println(" -> " + c.getObject());
+                assertTrue(c.isStart(), "OnStartElement");
+                assertEquals("val1", c.getTextValue(), "TextValue");
             }
         }
     }
 
     @Test
-    public void testPath2() throws XmlException {
+    void testPath2() throws XmlException {
         final XmlObject obj = XmlObject.Factory.parse(
             "<a>" +
                 "<b>" +
@@ -67,27 +66,25 @@ public class XPathTest {
             c.selectPath(".//b/c");
 
             int selCount = c.getSelectionCount();
-            assertEquals("SelectionCount", 2, selCount);
+            assertEquals(2, selCount, "SelectionCount");
 
-            assertTrue("hasNextSelection", c.hasNextSelection());
+            assertTrue(c.hasNextSelection(), "hasNextSelection");
             c.toNextSelection();
 
-            System.out.println(" -> " + c.getObject());
-            assertTrue("OnStartElement", c.isStart());
-            assertEquals("TextValue", "val1", c.getTextValue());
+            assertTrue(c.isStart(), "OnStartElement");
+            assertEquals("val1", c.getTextValue(), "TextValue");
 
 
-            assertTrue("hasNextSelection2", c.hasNextSelection());
+            assertTrue(c.hasNextSelection(), "hasNextSelection2");
             c.toNextSelection();
 
-            System.out.println(" -> " + c.getObject());
-            assertTrue("OnStartElement2", c.isStart());
-            assertEquals("TextValue2", "val3", c.getTextValue());
+            assertTrue(c.isStart(), "OnStartElement2");
+            assertEquals("val3", c.getTextValue(), "TextValue2");
         }
     }
 
     @Test
-    public void testPath3() throws XmlException {
+    void testPath3() throws XmlException {
         final XmlObject obj = XmlObject.Factory.parse(
             "<a>" +
                 "<b>" +
@@ -108,14 +105,14 @@ public class XPathTest {
             c.selectPath(".//b/c//c");
 
             int selCount = c.getSelectionCount();
-            assertEquals("SelectionCount", 1, selCount);
+            assertEquals(1, selCount, "SelectionCount");
 
             while (c.hasNextSelection()) {
                 c.toNextSelection();
 
                 System.out.println(" -> " + c.getObject());
-                assertTrue("OnStartElement", c.isStart());
-                assertEquals("TextValue", "val5", c.getTextValue());
+                assertTrue(c.isStart(), "OnStartElement");
+                assertEquals("val5", c.getTextValue(), "TextValue");
             }
         }
     }

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/CompareToTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/CompareToTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/CompareToTest.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/CompareToTest.java Sun Feb  
6 01:51:55 2022
@@ -18,91 +18,73 @@ package xmlobject.detailed;
 
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument;
 import org.tranxml.tranXML.version40.CityNameDocument.CityName;
 import org.tranxml.tranXML.version40.ETADocument.ETA;
 import org.tranxml.tranXML.version40.EventStatusDocument.EventStatus;
 import 
org.tranxml.tranXML.version40.GeographicLocationDocument.GeographicLocation;
 import test.xbean.xmlcursor.purchaseOrder.PurchaseOrderDocument;
-import tools.util.JarUtil;
 import xmlcursor.common.Common;
 
 import java.math.BigDecimal;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
+import static xmlcursor.common.BasicCursorTestCase.jobj;
 
 public class CompareToTest {
-    @Test(expected = ClassCastException.class)
-    public void testCompareToEquals() throws Exception {
-        CarLocationMessageDocument clmDoc = (CarLocationMessageDocument) 
XmlObject.Factory.parse(
-            JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
+    @Test
+    void testCompareToEquals() throws Exception {
+        CarLocationMessageDocument clmDoc = (CarLocationMessageDocument) 
jobj(Common.TRANXML_FILE_CLM);
         EventStatus[] aEventStatus = 
clmDoc.getCarLocationMessage().getEventStatusArray();
 
-        assertTrue("Unexpected: Missing EventStatus element.  Test harness 
failure.", aEventStatus.length > 0);
+        assertTrue(aEventStatus.length > 0, "Unexpected: Missing EventStatus 
element.  Test harness failure.");
 
         GeographicLocation gl = aEventStatus[0].getGeographicLocation();
         CityName cname0 = gl.getCityName();
         ETA eta = aEventStatus[0].getETA();
         CityName cname1 = eta.getGeographicLocation().getCityName();
         assertTrue(cname0.valueEquals(cname1));
-        assertEquals(XmlObject.EQUAL, cname0.compareTo(cname1));
+        assertThrows(ClassCastException.class, () -> cname0.compareTo(cname1));
     }
 
-    @Test(expected = ClassCastException.class)
-    public void testCompareToNull() throws Exception {
-        m_xo = XmlObject.Factory.parse(
-            JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
-        assertEquals(XmlObject.NOT_EQUAL, m_xo.compareTo(null));
+    @Test
+    void testCompareToNull() throws Exception {
+        XmlObject m_xo = jobj(Common.TRANXML_FILE_CLM);
+        assertThrows(ClassCastException.class, () -> m_xo.compareTo(null));
     }
 
     @Test
-    public void testCompareToLessThan() throws Exception {
-        PurchaseOrderDocument poDoc = (PurchaseOrderDocument) 
XmlObject.Factory.parse(
-            JarUtil.getResourceFromJar("xbean/xmlcursor/po.xml"));
+    void testCompareToLessThan() throws Exception {
+        PurchaseOrderDocument poDoc = (PurchaseOrderDocument) 
jobj("xbean/xmlcursor/po.xml");
 
-        BigDecimal bdUSPrice0 = poDoc.getPurchaseOrder().getItems()
-            .getItemArray(0)
-            .getUSPrice();
-        BigDecimal bdUSPrice1 = poDoc.getPurchaseOrder().getItems()
-            .getItemArray(1)
-            .getUSPrice();
+        BigDecimal bdUSPrice0 = 
poDoc.getPurchaseOrder().getItems().getItemArray(0).getUSPrice();
+        BigDecimal bdUSPrice1 = 
poDoc.getPurchaseOrder().getItems().getItemArray(1).getUSPrice();
         assertEquals(XmlObject.LESS_THAN, bdUSPrice1.compareTo(bdUSPrice0));
     }
 
     @Test
-    public void testCompareToGreaterThan() throws Exception {
-        PurchaseOrderDocument poDoc = (PurchaseOrderDocument)
-            XmlObject.Factory.parse(
-                JarUtil.getResourceFromJar("xbean/xmlcursor/po.xml"));
-        BigDecimal bdUSPrice0 = poDoc.getPurchaseOrder().getItems()
-            .getItemArray(0)
-            .getUSPrice();
-        BigDecimal bdUSPrice1 = poDoc.getPurchaseOrder().getItems()
-            .getItemArray(1)
-            .getUSPrice();
+    void testCompareToGreaterThan() throws Exception {
+        PurchaseOrderDocument poDoc = (PurchaseOrderDocument) 
jobj("xbean/xmlcursor/po.xml");
+        BigDecimal bdUSPrice0 = 
poDoc.getPurchaseOrder().getItems().getItemArray(0).getUSPrice();
+        BigDecimal bdUSPrice1 = 
poDoc.getPurchaseOrder().getItems().getItemArray(1).getUSPrice();
         assertEquals(XmlObject.GREATER_THAN, bdUSPrice0.compareTo(bdUSPrice1));
     }
 
-    @Test(expected = ClassCastException.class)
-    public void testCompareToString() throws Exception {
-        m_xo = XmlObject.Factory.parse(
-            JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
-        assertEquals(0, m_xo.compareTo(""));
+    @Test
+    void testCompareToString() throws Exception {
+        XmlObject m_xo = jobj(Common.TRANXML_FILE_CLM);
+        assertThrows(ClassCastException.class, () -> m_xo.compareTo(""));
     }
 
     @Test
-    public void testCompareValue() throws Exception {
-        m_xo = XmlObject.Factory.parse(
-            JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
+    void testCompareValue() throws Exception {
+        XmlObject m_xo = jobj(Common.TRANXML_FILE_CLM);
         try (XmlCursor m_xc = m_xo.newCursor()) {
             m_xc.toFirstChild();
             XmlObject xo = m_xc.getObject();
             assertEquals(XmlObject.NOT_EQUAL, m_xo.compareValue(xo));
         }
     }
-
-    private XmlObject m_xo;
 }
 

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/CopyTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/CopyTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/CopyTest.java (original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/CopyTest.java Sun Feb  6 
01:51:55 2022
@@ -15,38 +15,38 @@
 package xmlobject.detailed;
 
 import org.apache.xmlbeans.XmlObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class CopyTest {
     // Test for a Document object being copied as DocFrag if the type of the
     // source of the copy is not a document type (as is the case with NO_TYPE).
     @Test
-    public void testXobjTypeOnDomNodeCopy() throws Exception {
+    void testXobjTypeOnDomNodeCopy() throws Exception {
         XmlObject o = XmlObject.Factory.parse("<foo><a/></foo>");
         String xobjOrgClassName = 
"org.apache.xmlbeans.impl.store.DocumentXobj";
-        assertEquals("Invalid Type!", o.getDomNode().getClass().getName(), 
xobjOrgClassName);
+        assertEquals(o.getDomNode().getClass().getName(), xobjOrgClassName, 
"Invalid Type!");
 
         XmlObject o2 = o.copy();
         String xobjCopyClassName = o2.getDomNode().getClass().getName();
         System.out.println("DocXobj:" + xobjCopyClassName);
 
         // check for the expected type
-        assertEquals("Invalid Type!", 
"org.apache.xmlbeans.impl.store.DocumentXobj", xobjOrgClassName);
-        assertEquals("Invalid Type!", 
"org.apache.xmlbeans.impl.store.DocumentXobj", xobjCopyClassName);
+        assertEquals("org.apache.xmlbeans.impl.store.DocumentXobj", 
xobjOrgClassName, "Invalid Type!");
+        assertEquals("org.apache.xmlbeans.impl.store.DocumentXobj", 
xobjCopyClassName, "Invalid Type!");
     }
 
     // Test the same for a simple untyped XmlObject copy
     @Test
-    public void testXobjTypeOnCopy() throws Exception {
+    void testXobjTypeOnCopy() throws Exception {
         String untypedXobjClass = 
"org.apache.xmlbeans.impl.values.XmlAnyTypeImpl";
 
         XmlObject o = XmlObject.Factory.parse("<foo><a/></foo>");
-        assertEquals("Invalid Type!", untypedXobjClass, 
o.getClass().getName());
+        assertEquals(untypedXobjClass, o.getClass().getName(), "Invalid 
Type!");
 
         XmlObject o2 = o.copy();
         // type should be unchanged after the copy
-        assertEquals("Invalid Type!", untypedXobjClass, 
o2.getClass().getName());
+        assertEquals(untypedXobjClass, o2.getClass().getName(), "Invalid 
Type!");
     }
 }

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/IsImmutableTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/IsImmutableTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/IsImmutableTest.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/IsImmutableTest.java Sun 
Feb  6 01:51:55 2022
@@ -17,37 +17,34 @@
 package xmlobject.detailed;
 
 import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument;
-import tools.util.JarUtil;
-import xmlcursor.common.BasicCursorTestCase;
 import xmlcursor.common.Common;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import static xmlcursor.common.BasicCursorTestCase.jcur;
+import static xmlcursor.common.BasicCursorTestCase.jobj;
 
 
-public class IsImmutableTest extends BasicCursorTestCase {
+public class IsImmutableTest {
     @Test
-    public void testIsImmutableFalse() throws Exception {
-        CarLocationMessageDocument clmDoc =
-                (CarLocationMessageDocument) XmlObject.Factory
-                .parse(   JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
+    void testIsImmutableFalse() throws Exception {
+        CarLocationMessageDocument clmDoc = (CarLocationMessageDocument) 
jobj(Common.TRANXML_FILE_CLM);
         assertFalse(clmDoc.isImmutable());
     }
 
     @Test
-    public void testIsImmutableTrue() throws Exception {
-        m_xo = XmlObject.Factory.parse(
-                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
-        m_xc = m_xo.newCursor();
-        m_xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT +
-                        "$this//Initial");
-        m_xc.toNextSelection();
-        SchemaType st = m_xc.getObject().schemaType();
-        XmlObject xoNew = st.newValue("ZZZZ");
-        assertTrue(xoNew.isImmutable());
-        // verify it's not in main store
-        assertEquals("GATX", m_xc.getTextValue());
+    void testIsImmutableTrue() throws Exception {
+        try (XmlCursor m_xc = jcur(Common.TRANXML_FILE_CLM)) {
+            m_xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT + "$this//Initial");
+            m_xc.toNextSelection();
+            SchemaType st = m_xc.getObject().schemaType();
+            XmlObject xoNew = st.newValue("ZZZZ");
+            assertTrue(xoNew.isImmutable());
+            // verify it's not in main store
+            assertEquals("GATX", m_xc.getTextValue());
+        }
     }
 }

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/NilTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/NilTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/NilTest.java (original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/NilTest.java Sun Feb  6 
01:51:55 2022
@@ -17,53 +17,48 @@
 package xmlobject.detailed;
 
 import knextest.bug38361.TestDocument;
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlString;
 import org.apache.xmlbeans.impl.values.XmlValueNotNillableException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument;
 import 
org.tranxml.tranXML.version40.CarLocationMessageDocument.CarLocationMessage;
 import test.xbean.xmlcursor.purchaseOrder.PurchaseOrderDocument;
-import tools.util.JarUtil;
-import xmlcursor.common.BasicCursorTestCase;
 import xmlcursor.common.Common;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
+import static xmlcursor.common.BasicCursorTestCase.jobj;
 
 
-public class NilTest extends BasicCursorTestCase {
+public class NilTest {
     @Test
-    public void testIsNilFalse() throws Exception {
-        CarLocationMessageDocument clmDoc = (CarLocationMessageDocument) 
XmlObject.Factory.parse(
-                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
+    void testIsNilFalse() throws Exception {
+        CarLocationMessageDocument clmDoc = (CarLocationMessageDocument) 
jobj(Common.TRANXML_FILE_CLM);
         CarLocationMessage clm = clmDoc.getCarLocationMessage();
         assertFalse(clm.isNil());
     }
 
     @Test
-    public void testSetNilNillable() throws Exception {
-        PurchaseOrderDocument pod = (PurchaseOrderDocument) 
XmlObject.Factory.parse(
-                JarUtil.getResourceFromJar("xbean/xmlcursor/po.xml"));
-        m_xo = pod.getPurchaseOrder().getShipTo().xgetName();
+    void testSetNilNillable() throws Exception {
+        PurchaseOrderDocument pod = (PurchaseOrderDocument) 
jobj("xbean/xmlcursor/po.xml");
+        XmlString m_xo = pod.getPurchaseOrder().getShipTo().xgetName();
         m_xo.setNil();
         assertTrue(m_xo.isNil());
     }
 
-    @Test(expected = XmlValueNotNillableException.class)
-    public void testSetNilNotNillable() throws Exception {
+    @Test
+    void testSetNilNotNillable() throws Exception {
         XmlOptions xo = new XmlOptions();
         xo.setValidateOnSet();
-        CarLocationMessageDocument clmDoc = (CarLocationMessageDocument) 
XmlObject.Factory.parse(
-                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM), xo);
-        clmDoc.setNil();
+        CarLocationMessageDocument clmDoc = (CarLocationMessageDocument) 
jobj(Common.TRANXML_FILE_CLM, xo);
+        assertThrows(XmlValueNotNillableException.class, clmDoc::setNil);
     }
 
     /**
      * Test case for Radar bug: #38361
      */
     @Test
-    public void nillableTest() throws Exception {
+    void nillableTest() throws Exception {
         //Generates a xml document programatically
         TestDocument generated = TestDocument.Factory.newInstance();
         generated.addNewTest();
@@ -71,23 +66,21 @@ public class NilTest extends BasicCursor
         generated.getTest().setNilDate();
 
         // Generate a xml document by parsing a string
-        TestDocument parsed = TestDocument.Factory.parse("<tns:Test 
xmlns:tns='http://bug38361.knextest'>" +
-                "<tns:Simple xsi:nil='true' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'/>" +
-                "<tns:Date xsi:nil='true' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'/>" +
-                "</tns:Test>");
+        TestDocument parsed = TestDocument.Factory.parse(
+            "<tns:Test xmlns:tns='http://bug38361.knextest'>" +
+            "<tns:Simple xsi:nil='true' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'/>" +
+            "<tns:Date xsi:nil='true' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'/>" +
+            "</tns:Test>");
 
         // Test generated xml doc properties
-        assertTrue("Generated XML document is not valid", 
generated.validate());
-        assertTrue("Generated: isNilSimple() failed",
-                generated.getTest().isNilSimple());
-        assertTrue("Generated: isNilDate() failed",
-                generated.getTest().isNilDate());
+        assertTrue(generated.validate(), "Generated XML document is not 
valid");
+        assertTrue(generated.getTest().isNilSimple(), "Generated: 
isNilSimple() failed");
+        assertTrue(generated.getTest().isNilDate(), "Generated: isNilDate() 
failed");
 
         // Test parsed xml doc properties
-        assertTrue("Parsed XML document is not valid", parsed.validate());
-        assertTrue("Parsed: isNilSimple() failed",
-                parsed.getTest().isNilSimple());
-        assertTrue("Parsed: isNilDate() failed", parsed.getTest().isNilDate());
+        assertTrue(parsed.validate(), "Parsed XML document is not valid");
+        assertTrue(parsed.getTest().isNilSimple(), "Parsed: isNilSimple() 
failed");
+        assertTrue(parsed.getTest().isNilDate(), "Parsed: isNilDate() failed");
     }
 
 }

Modified: 
xmlbeans/trunk/src/test/java/xmlobject/detailed/SelectAttributeTests.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/SelectAttributeTests.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/SelectAttributeTests.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/SelectAttributeTests.java 
Sun Feb  6 01:51:55 2022
@@ -15,46 +15,37 @@
 
 package xmlobject.detailed;
 
+import org.apache.xmlbeans.XmlError;
 import org.apache.xmlbeans.XmlObject;
-import org.junit.Test;
+import org.apache.xmlbeans.XmlOptions;
+import org.junit.jupiter.api.Test;
 import org.openuri.test.selectAttribute.DocDocument;
-import xmlobject.common.SelectChildrenAttribCommon;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-public class SelectAttributeTests extends SelectChildrenAttribCommon {
-
-    private static String saUri = "http://openuri.org/test/selectAttribute";;
-    private static String saStartFrag = "<xm xmlns:sa=\"" + saUri + "\">";
-
-    private static String abcUri = "http://abc";;
-    private static String defUri = "http://def";;
-
-    static String anyStartFrag = "<xm xmlns:sa=\"" + saUri + "\"" +
-        " xmlns:abc=\"" + abcUri + "\"" +
-        " xmlns:def=\"" + defUri + "\"" + ">";
-
-    private static String endFrag = "</xm>";
-    // To speed up tests when running multiple test methods in the same run
-    private DocDocument.Doc doc = null;
+import static org.junit.jupiter.api.Assertions.*;
+import static xmlcursor.common.BasicCursorTestCase.jobj;
+import static xmlobject.detailed.SelectChildrenTests.validateTest;
+
+public class SelectAttributeTests {
+
+    private static final String saUri = 
"http://openuri.org/test/selectAttribute";;
+    private static final String saStartFrag = "<xm xmlns:sa=\"" + saUri + 
"\">";
+    private static final String abcUri = "http://abc";;
+    private static final String endFrag = "</xm>";
 
     ///////////////////////////////////////////////////////////////////
     // Tests for non-wildcard attributes
     @Test
-    public void testSelectWithQName()
-        throws Exception {
-        if (doc == null)
-            doc = (DocDocument.Doc) getTestObject();
+    void testSelectWithQName() throws Exception {
+        DocDocument.Doc doc = getTestObject();
         QName qn = new QName("", "att1");
         XmlObject x = doc.getNormal().selectAttribute(qn);
         String exp = saStartFrag + "Attribute 1" + endFrag;
 
-        validateTest("testSelectWithQName", exp, x);
+        validateTest("testSelectWithQName", new String[]{exp}, new 
XmlObject[]{x});
         // Check Select with QName that is not present.. should get null back.
         x = doc.getWithOther().selectAttribute(qn);
         assertNull(x);
@@ -62,55 +53,46 @@ public class SelectAttributeTests extend
 
 
     @Test
-    public void testSelectWithURI()
-        throws Exception {
-        if (doc == null)
-            doc = (DocDocument.Doc) getTestObject();
+    void testSelectWithURI() throws Exception {
+        DocDocument.Doc doc = getTestObject();
 
         XmlObject x = doc.getNormal().selectAttribute("", "att2");
         String exp = saStartFrag + "Attribute 2" + endFrag;
 
-        validateTest("testSelectWithURI", exp, x);
+        validateTest("testSelectWithURI", new String[]{exp}, new 
XmlObject[]{x});
         // Check Select with QName that is not present.. should get null back.
         x = doc.getWithAny().selectAttribute("", "att2");
         assertNull(x);
-
     }
 
     ////////////////////////////////////////////////////////////////////
     // Test for wild-card attributes
     @Test
-    public void testSelectWithQNameForAny()
-        throws Exception {
-        if (doc == null)
-            doc = (DocDocument.Doc) getTestObject();
+    void testSelectWithQNameForAny() throws Exception {
+        DocDocument.Doc doc = getTestObject();
 
         QName qn = new QName(abcUri, "att3");
         String exp = saStartFrag + "Attribute 3" + endFrag;
         XmlObject x = doc.getWithOther().selectAttribute(qn);
 
-        validateTest("testSelectWithQNameForAny", exp, x);
-
-
+        validateTest("testSelectWithQNameForAny", new String[]{exp}, new 
XmlObject[]{x});
         x = doc.getWithAny();
-        System.out.println(x.xmlText());
-
+        assertNotNull(x.xmlText());
     }
 
     ////////////////////////////////////////////////////////////////////
     // Helper
-    private XmlObject getTestObject()
-        throws Exception {
-        String xml = getXml("xbean/xmlobject/SelectAttribute-Doc.xml");
-        DocDocument xmlObj = DocDocument.Factory.parse(xml);
+    private DocDocument.Doc getTestObject() throws Exception {
+        DocDocument xmlObj = (DocDocument) 
jobj("xbean/xmlobject/SelectAttribute-Doc.xml");
         DocDocument.Doc doc = xmlObj.getDoc();
 
-        Collection errors = new ArrayList();
+        XmlOptions opts = new 
XmlOptions().setSavePrettyPrint().setSavePrettyPrintIndent(2);
+
+        Collection<XmlError> errors = new ArrayList<>();
         opts.setErrorListener(errors);
         boolean valid = doc.validate(opts);
-        tools.xml.Utils.printXMLErrors(errors);
 
-        assertTrue("Test Xml is not valid!!", valid);
+        assertTrue(valid, "Test Xml is not valid!!");
         return doc;
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/xmlobject/detailed/SelectChildrenTests.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/SelectChildrenTests.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/SelectChildrenTests.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/SelectChildrenTests.java 
Sun Feb  6 01:51:55 2022
@@ -19,97 +19,91 @@ package xmlobject.detailed;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.QNameSetBuilder;
 import org.apache.xmlbeans.XmlObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.openuri.test.selectChildren.ElemWithAnyDocument;
 import org.openuri.test.selectChildren.NormalDocument;
 import org.openuri.test.selectChildren.NormalType;
 import org.openuri.test.selectChildren.WithAnyType;
-import xmlobject.common.SelectChildrenAttribCommon;
+import tools.xml.XmlComparator;
 
 import javax.xml.namespace.QName;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
+import static xmlcursor.common.BasicCursorTestCase.jobj;
 
-public class SelectChildrenTests extends SelectChildrenAttribCommon {
-    private static String scUri = "http://openuri.org/test/selectChildren";;
-    private static String scStartFrag = "<xm xmlns:sc=\"" + scUri + "\">";
+public class SelectChildrenTests {
+    private static final String scUri = 
"http://openuri.org/test/selectChildren";;
+    private static final String scStartFrag = "<xm xmlns:sc=\"" + scUri + 
"\">";
+
+    private static final String abcUri = "http://abc";;
+    private static final String defUri = "http://def";;
+    private static final String xyzUri = "http://xyz";;
 
-    private static String abcUri = "http://abc";;
-    private static String defUri = "http://def";;
-    private static String xyzUri = "http://xyz";;
-
-    private static String anyStartFrag = "<xm xmlns:sc=\"" + scUri + "\"" +
+    private static final String anyStartFrag =
+        "<xm xmlns:sc=\"" + scUri + "\"" +
         " xmlns:abc=\"" + abcUri + "\"" +
         " xmlns:def=\"" + defUri + "\"" +
         " xmlns:xyz=\"" + xyzUri + "\"" + ">";
 
-    private static String endFrag = "</xm>";
+    private static final String endFrag = "</xm>";
 
     //////////////////////////////////////////////////////////////////
     // Tests
     @Test
-    public void testSelectWithQName()
-        throws Exception {
-        String xml = getXml("xbean/xmlobject/SelectChildren-NormalDoc.xml");
-
-        XmlObject[] xos; // For the return from selectChildren
-        String[] exps;   // For the expected xml strings
-
-        NormalDocument doc = NormalDocument.Factory.parse(xml);
+    void testSelectWithQName() throws Exception {
+        NormalDocument doc = (NormalDocument) 
jobj("xbean/xmlobject/SelectChildren-NormalDoc.xml");
         assertTrue(doc.validate());
         NormalType norm = doc.getNormal();
 
-        exps = new String[]{scStartFrag + "first element" + endFrag};
-        xos = norm.selectChildren(new QName(scUri, "first"));
+        // For the expected xml strings
+        String[] exps = new String[]{scStartFrag + "first element" + endFrag};
+        // For the return from selectChildren
+        XmlObject[] xos = norm.selectChildren(new QName(scUri, "first"));
 
         this.validateTest("testSelectWithQName", exps, xos);
     }
 
     @Test
-    public void testSelectWithURI()
-        throws Exception {
-        String xml = getXml("xbean/xmlobject/SelectChildren-NormalDoc.xml");
-
-        XmlObject[] xos; // For the return from selectChildren
-        String[] exps;   // For the expected xml strings
-
-        NormalDocument doc = NormalDocument.Factory.parse(xml);
+    void testSelectWithURI() throws Exception {
+        NormalDocument doc = (NormalDocument) 
jobj("xbean/xmlobject/SelectChildren-NormalDoc.xml");
         assertTrue(doc.validate());
         NormalType norm = doc.getNormal();
 
-        exps = new String[]{scStartFrag + "second element" + endFrag};
-        xos = norm.selectChildren(scUri, "second");
+        // For the expected xml strings
+        String[] exps = new String[]{scStartFrag + "second element" + endFrag};
+        // For the return from selectChildren
+        XmlObject[] xos = norm.selectChildren(scUri, "second");
 
         this.validateTest("testSelectWithURI", exps, xos);
     }
 
     @Test
-    public void testSelectWithQNameSet()
-        throws Exception {
-        String xml = getXml("xbean/xmlobject/SelectChildren-NormalDoc.xml");
-
-        XmlObject[] xos; // For the return from selectChildren
-        String[] exps;   // For the expected xml strings
-
-        NormalDocument doc = NormalDocument.Factory.parse(xml);
+    void testSelectWithQNameSet() throws Exception {
+        NormalDocument doc = (NormalDocument) 
jobj("xbean/xmlobject/SelectChildren-NormalDoc.xml");
         assertTrue(doc.validate());
         NormalType norm = doc.getNormal();
 
-        QName[] qArr = new QName[]{new QName(scUri, "first"),
+        QName[] qArr = new QName[]{
+            new QName(scUri, "first"),
             new QName(scUri, "numbers"),
             new QName(scUri, "second")};
 
         QNameSet qSet = QNameSet.forArray(qArr);
 
-        exps = new String[]{scStartFrag + "first element" + endFrag,
+        // For the expected xml strings
+        String[] exps = new String[]{
+            scStartFrag + "first element" + endFrag,
             scStartFrag + "second element" + endFrag,
             scStartFrag + "10" + endFrag,
             scStartFrag + "11" + endFrag,
             scStartFrag + "12" + endFrag};
 
-        xos = norm.selectChildren(qSet);
+        // For the return from selectChildren
+        XmlObject[] xos = norm.selectChildren(qSet);
 
         this.validateTest("testSelectWithQNameSet", exps, xos);
     }
@@ -117,55 +111,48 @@ public class SelectChildrenTests extends
     //////////////////////////////////////////////////////////////////////
     // Tests with 'any' Element
     @Test
-    public void testSelectWithQNameForAny()
-        throws Exception {
-        XmlObject[] xos; // For the return from selectChildren
-        String[] exps;   // For the expected xml strings
-
-        String xml = getXml("xbean/xmlobject/SelectChildren-AnyTypeDoc.xml");
-        ElemWithAnyDocument doc = ElemWithAnyDocument.Factory.parse(xml);
+    void testSelectWithQNameForAny() throws Exception {
+        ElemWithAnyDocument doc = (ElemWithAnyDocument) 
jobj("xbean/xmlobject/SelectChildren-AnyTypeDoc.xml");
         assertTrue(doc.validate());
 
         WithAnyType any = doc.getElemWithAny();
         // Select children from a known namespace
-        xos = any.selectChildren(new QName(defUri, "someElem2"));
-        exps = new String[]{anyStartFrag + "DEF Namespace" + endFrag};
+        // For the return from selectChildren
+        XmlObject[] xos = any.selectChildren(new QName(defUri, "someElem2"));
+        // For the expected xml strings
+        String[] exps = new String[]{anyStartFrag + "DEF Namespace" + endFrag};
 
         validateTest("testSelectWithQNameForAny", exps, xos);
     }
 
     @Test
-    public void testSelectWithURIForAny()
-        throws Exception {
-        XmlObject[] xos; // For the return from selectChildren
-        String[] exps;   // For the expected xml strings
+    void testSelectWithURIForAny() throws Exception {
 
-        String xml = getXml("xbean/xmlobject/SelectChildren-AnyTypeDoc.xml");
-        ElemWithAnyDocument doc = ElemWithAnyDocument.Factory.parse(xml);
+        ElemWithAnyDocument doc = (ElemWithAnyDocument) 
jobj("xbean/xmlobject/SelectChildren-AnyTypeDoc.xml");
         assertTrue(doc.validate());
 
         WithAnyType any = doc.getElemWithAny();
         // Select children from a known namespace
-        xos = any.selectChildren(scUri, "simple");
-        exps = new String[]{anyStartFrag + "Simple String" + endFrag};
+        // For the return from selectChildren
+        XmlObject[] xos = any.selectChildren(scUri, "simple");
+        // For the expected xml strings
+        String[] exps = new String[]{anyStartFrag + "Simple String" + endFrag};
 
         validateTest("testSelectWithURIForAny", exps, xos);
     }
 
     @Test
-    public void testSelectWithWildcard()
-        throws Exception {
-        XmlObject[] xos; // For the return from selectChildren
-        String[] exps;   // For the expected xml strings
-        String xml = getXml("xbean/xmlobject/SelectChildren-AnyTypeDoc.xml");
-        ElemWithAnyDocument doc = ElemWithAnyDocument.Factory.parse(xml);
+    void testSelectWithWildcard() throws Exception {
+        ElemWithAnyDocument doc = (ElemWithAnyDocument) 
jobj("xbean/xmlobject/SelectChildren-AnyTypeDoc.xml");
         assertTrue(doc.validate());
 
         WithAnyType any = doc.getElemWithAny();
 
-        xos = any.selectChildren(QNameSet.forWildcardNamespaceString("##other",
-            scUri));
-        exps = new String[]{anyStartFrag + "ABC Namespace" + endFrag,
+        // For the return from selectChildren
+        XmlObject[] xos = 
any.selectChildren(QNameSet.forWildcardNamespaceString("##other", scUri));
+        // For the expected xml strings
+        String[] exps = new String[]{
+            anyStartFrag + "ABC Namespace" + endFrag,
             anyStartFrag + "DEF Namespace" + endFrag,
             anyStartFrag + "XYX Namespace" + endFrag,
             anyStartFrag + "ABC-SameElem" + endFrag,
@@ -176,12 +163,9 @@ public class SelectChildrenTests extends
     }
 
     @Test
-    public void testSelectWithQNameBuilder()
-        throws Exception {
-        XmlObject[] xos; // For the return from selectChildren
-        String[] exps;   // For the expected xml strings
-        String xml = getXml("xbean/xmlobject/SelectChildren-AnyTypeDoc.xml");
-        ElemWithAnyDocument doc = ElemWithAnyDocument.Factory.parse(xml);
+    void testSelectWithQNameBuilder() throws Exception {
+        // For the expected xml strings
+        ElemWithAnyDocument doc = (ElemWithAnyDocument) 
jobj("xbean/xmlobject/SelectChildren-AnyTypeDoc.xml");
         assertTrue(doc.validate());
 
         WithAnyType any = doc.getElemWithAny();
@@ -195,13 +179,53 @@ public class SelectChildrenTests extends
         Set<QName> incFromExcSet = new HashSet<QName>();
         incFromExcSet.add(new QName(xyzUri, "sameElem"));
 
-        QNameSet qset = new QNameSetBuilder(excSet,
-            null,
-            excFromIncSet,
-            incFromExcSet).toQNameSet();
-        xos = any.selectChildren(qset);
+        QNameSet qset = new QNameSetBuilder(excSet, null, excFromIncSet, 
incFromExcSet).toQNameSet();
+        // For the return from selectChildren
+        XmlObject[] xos = any.selectChildren(qset);
+
+        for (XmlObject xo : xos) {
+            assertNotNull(xo.xmlText());
+        }
+    }
+
+    //////////////////////////////////////////////////////////////////
+    // Helper methods
+    protected static void validateTest(String testName, String[] exps, 
XmlObject[] act) throws Exception {
+        assertEquals(act.length, exps.length,
+            testName + ": Return array has more/less elements than expected: " 
+ act.length);
+
+        for (int i = 0; i < act.length; i++) {
+            XmlComparator.Diagnostic diag = new XmlComparator.Diagnostic();
+            String actual = convertFragToDoc(act[i].xmlText());
+            boolean same = XmlComparator.lenientlyCompareTwoXmlStrings(actual, 
exps[i], diag);
+            assertTrue(same);
+        }
+    }
+
+
+    /**
+     * This is a workaround for using XmlComparator to compare XML that are 
just
+     * a single value like '7' wrapped in <xml-fragemnt> tags. Inside
+     * XmlComparator creates XmlObjects and <xml-fragment> tags are ignored. So
+     * this method will replace that with something like <xm> so that they look
+     * like Xml Docs...
+     */
+    private static String convertFragToDoc(String xmlFragment) {
+        String startFragStr = "<xml-fragment";
+        String endFragStr = "</xml-fragment>";
+        String startReplacementStr = "<xm";
+        String endReplacementStr = "</xm>";
+
+        Pattern pattern = Pattern.compile(startFragStr);
+        Matcher matcher = pattern.matcher(xmlFragment);
+
+        String xmlDoc = matcher.replaceAll(startReplacementStr);
+
+        pattern = Pattern.compile(endFragStr);
+        matcher = pattern.matcher(xmlDoc);
+
+        xmlDoc = matcher.replaceAll(endReplacementStr);
 
-        for (int i = 0; i < xos.length; i++)
-            System.out.println(xos[i].xmlText());
+        return xmlDoc;
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/xmlobject/detailed/SerializationDetailedTests.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/SerializationDetailedTests.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/xmlobject/detailed/SerializationDetailedTests.java 
(original)
+++ 
xmlbeans/trunk/src/test/java/xmlobject/detailed/SerializationDetailedTests.java 
Sun Feb  6 01:51:55 2022
@@ -17,7 +17,7 @@
 package xmlobject.detailed;
 
 import org.apache.xmlbeans.XmlInteger;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Node;
 
@@ -27,17 +27,17 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.math.BigInteger;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class SerializationDetailedTests {
 
     @Test
-    public void testDocFragmentSerialization() throws Exception {
+    void testDocFragmentSerialization() throws Exception {
         XmlInteger xmlInt = XmlInteger.Factory.newInstance();
         xmlInt.setBigIntegerValue(new BigInteger("10"));
 
         Node node = xmlInt.getDomNode();
-        assertTrue("DOM node from XmlObject not instance of DocumentFragment 
(it is a " + node + ")", node instanceof DocumentFragment);
+        assertTrue(node instanceof DocumentFragment, "DOM node from XmlObject 
not instance of DocumentFragment (it is a " + node + ")");
 
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         ObjectOutputStream oos = new ObjectOutputStream(out);
@@ -49,7 +49,7 @@ public class SerializationDetailedTests
         XmlInteger deserialized = (XmlInteger) ois.readObject();
 
         node = deserialized.getDomNode();
-        assertTrue("DOM node from deserialized XmlObject not instance of 
DocumentFragment (it is a " + node + ")", node instanceof DocumentFragment);
+        assertTrue(node instanceof DocumentFragment, "DOM node from 
deserialized XmlObject not instance of DocumentFragment (it is a " + node + 
")");
     }
 
 }

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/SetIdentityTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/SetIdentityTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/SetIdentityTest.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/SetIdentityTest.java Sun 
Feb  6 01:51:55 2022
@@ -17,25 +17,21 @@
 package xmlobject.detailed;
 
 import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument;
 import org.tranxml.tranXML.version40.CodeList309;
 import 
org.tranxml.tranXML.version40.GeographicLocationDocument.GeographicLocation;
 import 
org.tranxml.tranXML.version40.LocationIdentifierDocument.LocationIdentifier;
-import tools.util.JarUtil;
 import xmlcursor.common.Common;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static xmlcursor.common.BasicCursorTestCase.jobj;
 
 
 public class SetIdentityTest {
     @Test
-    public void testSetIdentity() throws Exception {
-        CarLocationMessageDocument clm =
-                (CarLocationMessageDocument) XmlObject.Factory.parse(
-                        JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
+    void testSetIdentity() throws Exception {
+        CarLocationMessageDocument clm = (CarLocationMessageDocument) 
jobj(Common.TRANXML_FILE_CLM);
 
         GeographicLocation gl;
         try (XmlCursor xc = clm.newCursor()) {

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/SoapFaultTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/SoapFaultTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/SoapFaultTest.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/SoapFaultTest.java Sun Feb  
6 01:51:55 2022
@@ -15,11 +15,12 @@
 
 package xmlobject.detailed;
 
+import org.apache.xmlbeans.XmlCalendar;
 import org.apache.xmlbeans.XmlError;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 import org.xmlsoap.schemas.soap.envelope.Detail;
 import org.xmlsoap.schemas.soap.envelope.Fault;
 import xmlobjecttest.soapfaults.FirstFaultType;
@@ -27,8 +28,8 @@ import xmlobjecttest.soapfaults.FirstFau
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class SoapFaultTest {
     private static final String soapenv = 
"http://schemas.xmlsoap.org/soap/envelope/";;
@@ -37,7 +38,7 @@ public class SoapFaultTest {
      * Regression test for Radar bug #25114
      */
     @Test
-    @Ignore
+    @Disabled
     public void testSetDetail() throws Exception {
         Fault fault = Fault.Factory.newInstance();
         
fault.setDetail(Detail.Factory.parse(XmlObject.Factory.parse("<foo/>").newXMLStreamReader()));
@@ -50,7 +51,7 @@ public class SoapFaultTest {
      * Regression test for Radar bug #25119
      */
     @Test
-    public void testAddNewDetail() throws Exception {
+    void testAddNewDetail() throws Exception {
         Fault fault = Fault.Factory.newInstance();
 
         fault.setFaultcode(new QName(soapenv, "foo"));
@@ -58,11 +59,12 @@ public class SoapFaultTest {
         fault.addNewDetail().set(
             XmlObject.Factory.parse("<foo/>").changeType(Detail.type));
 
-        String expect = "<xml-fragment>" +
-                        "<faultcode xmlns:soapenv=\"" + soapenv + 
"\">soapenv:foo</faultcode>" +
-                        "<faultstring>Undefined</faultstring>" +
-                        "<detail><foo/></detail>" +
-                        "</xml-fragment>";
+        String expect =
+            "<xml-fragment>" +
+            "<faultcode xmlns:soapenv=\"" + soapenv + 
"\">soapenv:foo</faultcode>" +
+            "<faultstring>Undefined</faultstring>" +
+            "<detail><foo/></detail>" +
+            "</xml-fragment>";
         assertEquals(expect, fault.xmlText());
         assertEquals(new QName(soapenv, "foo"), fault.getFaultcode());
         assertEquals("Undefined", fault.getFaultstring());
@@ -73,7 +75,7 @@ public class SoapFaultTest {
      * Regression test for Radar bug #25409
      */
     @Test
-    @Ignore
+    @Disabled
     public void testSetFaultDetail() throws Exception {
         String soapFault =
             "<soapenv:Fault xmlns:soapenv=\"" + soapenv + "\">" +
@@ -107,7 +109,6 @@ public class SoapFaultTest {
 
         assertEquals("The First Fault", firstFault.getAString().trim());
         assertEquals(1, firstFault.getAInt());
-        assertEquals(new org.apache.xmlbeans.XmlCalendar("2003-03-28"),
-            firstFault.getADate());
+        assertEquals(new XmlCalendar("2003-03-28"), firstFault.getADate());
     }
 }

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/SubstGroupTests.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/SubstGroupTests.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/SubstGroupTests.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/SubstGroupTests.java Sun 
Feb  6 01:51:55 2022
@@ -19,67 +19,44 @@ import org.apache.xmlbeans.XmlError;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.impl.values.XmlValueDisconnectedException;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import tools.xml.XmlComparator;
 import xmlobject.substgroup.*;
 
 import javax.xml.namespace.QName;
 import java.math.BigInteger;
 import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
 
 public class SubstGroupTests {
     /**
      * TODO: Determine what the proper Return value is
      */
     @Test
-    public void test_invalidSubstitute() {
+    void test_invalidSubstitute() {
         OrderItem order = OrderItem.Factory.newInstance();
         ItemType item = order.addNewItem();
         item.setName("ItemType");
         item.setSku(new BigInteger("42"));
 
-        //FootstoolDocument fsd;
-        try {
+        XmlObject xm = 
item.substitute(FootstoolDocument.type.getDocumentElementName(), 
FootstoolDocument.type);
+        assertFalse(xm instanceof FootstoolDocument);
 
-            //on invalid substitute orignal value is returned.
-            FootstoolDocument fsd = (FootstoolDocument) item.substitute(
-                FootstoolDocument.type.getDocumentElementName(),
-                FootstoolDocument.type);
-            fail("Class Cast Exception was thrown on invalid substitute ");
-        } catch (ClassCastException ccEx) {
-        }
-
-        XmlObject xm = item.substitute(
-            FootstoolDocument.type.getDocumentElementName(),
-            FootstoolDocument.type);
-
-        System.out.println("XM: " + xm.xmlText());
-        ArrayList err = new ArrayList();
+        List<XmlError> err = new ArrayList<>();
         XmlOptions xOpts = new XmlOptions().setErrorListener(err);
-        //no way this should happen
-        if (xm.validate(xOpts)) {
-            System.err.println("Invalid substitute validated");
-
-            for (Iterator iterator = err.iterator(); iterator.hasNext(); ) {
-                System.err.println("Error: " + iterator.next());
-            }
-        }
+        // no way this should happen ... TODO: ... but as of now it's 
validated ok
+        // assertFalse(xm.validate(xOpts), "Invalid substitute validated");
 
         //invalid substitute should leave good state
-        System.out.println("Item: " + item.xmlText());
-
         String exp = 
"<xml-fragment><sku>42</sku><name>ItemType</name></xml-fragment>";
 
-        assertEquals("text values should be the same", 0, 
exp.compareTo(xm.xmlText()));
+        assertEquals(exp, xm.xmlText(), "text values should be the same");
     }
 
-    @Test(expected = XmlValueDisconnectedException.class)
-    public void test_validSubstitute() {
+    @Test
+    void test_validSubstitute() {
         String URI = "http://xmlobject/substgroup";;
         QName name = new QName(URI, "beanBag");
         // get an item
@@ -88,33 +65,21 @@ public class SubstGroupTests {
         item.setName("ItemForTest");
         item.setSku(new BigInteger("12"));
 
-        // types and content before substitution
-        System.out.println("Before Substitution :\nQNAme Item doc    :" + 
ItemDocument.type.getName());
-        System.out.println("QNAme beanBag elem:" + name);
-        System.out.println("item type:" + item.getClass().getName());
-        System.out.println("item XMLText      : " + item.xmlText());
-
-        try {
-            XmlObject xObj = item.substitute(name, BeanBagType.type);
-            System.out.println("After Substitution :\nSubstituted XObj text: " 
+ xObj.xmlText());
-            System.out.println("Substituted XObj type: " + 
xObj.getClass().getName());
-            Assert.assertNotSame("Invalid Substitution. Xobj Types after 
substitution are the same.", xObj.getClass().getName(), 
item.getClass().getName());
-
-        } catch (NullPointerException npe) {
-            System.out.println("NPE Thrown: " + npe.getMessage());
-            npe.printStackTrace();
-        }
+        XmlObject xObj = item.substitute(name, BeanBagType.type);
+        assertNotSame(xObj.getClass().getName(), item.getClass().getName(),
+            "Invalid Substitution. Xobj Types after substitution are the 
same.");
 
         // invoke some operation on the original XmlObject, it should thrown 
an XmlValueDisconnectedException
-        item.xmlText();
+        assertThrows(XmlValueDisconnectedException.class, item::xmlText);
     }
 
     /**
      * Tests substition upcase, from item to Document, then ensure validation
      */
     @Test
-    public void test_valid_sub() throws Exception {
-        String expectedXML = "<sub:beanBag 
xmlns:sub=\"http://xmlobject/substgroup\";>" +
+    void test_valid_sub() throws Exception {
+        String expectedXML =
+            "<sub:beanBag xmlns:sub=\"http://xmlobject/substgroup\";>" +
             "  <sku>12</sku>" +
             "  <name>BeanBagType</name>" +
             "  <size color=\"Blue\">Blue</size>" +
@@ -128,19 +93,11 @@ public class SubstGroupTests {
         item.setName(itemName);
         item.setSku(bInt);
 
-        System.out.println("Order: " +
-            order.xmlText(new XmlOptions().setSavePrettyPrint()));
-        System.out.println("valid: " + order.validate());
-
-        BeanBagType b2Type = (BeanBagType) item.substitute(
-            BeanBagDocument.type.getDocumentElementName(),
-            BeanBagType.type);
-
-        assertEquals("Name Value was not as expected\nactual: " +
-            b2Type.getName() +
-            " exp: " +
-            itemName, 0, b2Type.getName().compareTo(itemName));
-        assertEquals("Integer Value was not as Excepted", 0, 
b2Type.getSku().compareTo(bInt));
+        BeanBagType b2Type = (BeanBagType) 
item.substitute(BeanBagDocument.type.getDocumentElementName(), 
BeanBagType.type);
+
+        assertEquals(0, b2Type.getName().compareTo(itemName),
+            "Name Value was not as expected\nactual: " + b2Type.getName() + " 
exp: " + itemName);
+        assertEquals(0, b2Type.getSku().compareTo(bInt), "Integer Value was 
not as Excepted");
 
         BeanBagSizeType bbSize = b2Type.addNewSize();
         bbSize.setColor("Blue");
@@ -148,56 +105,34 @@ public class SubstGroupTests {
         b2Type.setSize(bbSize);
         b2Type.setName("BeanBagType");
 
-        System.out.println("b2Type: " +
-            b2Type.xmlText(new XmlOptions().setSavePrettyPrint()));
-        System.out.println("b2Type: " + b2Type.validate());
-
-        System.out.println("Order: " +
-            order.xmlText(new XmlOptions().setSavePrettyPrint()));
-        System.out.println("ovalid: " + order.validate());
-
         tools.xml.XmlComparator.Diagnostic diag = new 
tools.xml.XmlComparator.Diagnostic();
 
-        if (!XmlComparator.lenientlyCompareTwoXmlStrings(order.xmlText(),
-            xm.xmlText(), diag))
-            throw new Exception("Compare Values Fails\n" + diag.toString());
+        
assertTrue(XmlComparator.lenientlyCompareTwoXmlStrings(order.xmlText(), 
xm.xmlText(), diag));
     }
 
-    @Test(expected = XmlValueDisconnectedException.class)
-    public void test_item_disconnect() {
-        String itemName = "item";
-        BigInteger bInt = new BigInteger("12");
-        boolean exThrown = false;
-
+    @Test
+    void test_item_disconnect() {
         xmlobject.substgroup.OrderItem order = OrderItem.Factory.newInstance();
         ItemType item = order.addNewItem();
-        item.setName(itemName);
-        item.setSku(bInt);
+        item.setName("item");
+        item.setSku(BigInteger.valueOf(12));
 
-        System.out.println("Order: " +
-            order.xmlText(new XmlOptions().setSavePrettyPrint()));
-        System.out.println("valid: " + order.validate());
-
-        BeanBagType b2Type = (BeanBagType) item.substitute(
-            BeanBagDocument.type.getDocumentElementName(),
-            BeanBagType.type);
+        XmlObject b2Type = 
item.substitute(BeanBagDocument.type.getDocumentElementName(), 
BeanBagType.type);
+        assertTrue(b2Type instanceof BeanBagType);
 
-        item.xmlText();
+        assertThrows(XmlValueDisconnectedException.class, item::xmlText);
     }
 
     @Test
-    public void test_item_downcasts_valid() throws Exception {
+    void test_item_downcasts_valid() throws Exception {
         BigInteger bInt = new BigInteger("12");
-        ArrayList err = new ArrayList();
-        XmlOptions opts = new XmlOptions(
-            new XmlOptions().setErrorListener(err));
+        List<XmlError> err = new ArrayList<>();
+        XmlOptions opts = new XmlOptions(new 
XmlOptions().setErrorListener(err));
 
         xmlobject.substgroup.OrderItem order = OrderItem.Factory.newInstance();
         ItemType item = order.addNewItem();
 
-        BeanBagType b2Type = (BeanBagType) item.substitute(
-            BeanBagDocument.type.getDocumentElementName(),
-            BeanBagType.type);
+        BeanBagType b2Type = (BeanBagType) 
item.substitute(BeanBagDocument.type.getDocumentElementName(), 
BeanBagType.type);
 
         BeanBagSizeType bbSize = b2Type.addNewSize();
         bbSize.setColor("Blue");
@@ -207,86 +142,67 @@ public class SubstGroupTests {
         b2Type.setName("BeanBagType");
 
         ItemType nItem = order.getItem();
-
-        //nItem.validate(opts);
-        if (!nItem.validate(opts))
-            System.out.println(
-                "nItem - Downcasting Failed Validation:\n" + err);
+        assertTrue(nItem.validate(opts), "nItem - Downcasting Failed 
Validation");
         err.clear();
 
-        item = (ItemType) nItem.substitute(
-            ItemDocument.type.getDocumentElementName(),
-            ItemType.type);
-
-        //System.out.println("Item1: " + item.xmlText());
-
-        if (!item.validate(opts))
-            System.out.println("Item - Downcasting Failed Validation:\n" + 
err);
+        item = (ItemType) 
nItem.substitute(ItemDocument.type.getDocumentElementName(), ItemType.type);
+        // TODO: downcasting shouldn't be allowed
+        // assertTrue(item.validate(opts), "Item - Downcasting Failed 
Validation:\n");
+        item.validate(opts);
 
         XmlError[] xErr = getXmlErrors(err);
-        assertEquals("Length of xm_errors was greater than expected", 1, 
xErr.length);
-        assertEquals("Error Code was not as Expected", 0, 
xErr[0].getErrorCode().compareTo("cvc-complex-type.2.4b"));
+        assertEquals(1, xErr.length, "Length of xm_errors was greater than 
expected");
+        assertEquals("cvc-complex-type.2.4b", xErr[0].getErrorCode(), "Error 
Code was not as Expected");
         err.clear();
 
         String nName = "ItemType";
         item.setName(nName);
-        System.out.println("Item2: " + item.xmlText());
 
-        if (!order.validate(opts))
-            System.out.println(
-                "Order - Downcasting Failed Validation:\n" + err);
+        assertFalse(order.validate(opts), "Order - Downcasting Failed 
Validation");
 
         //Check value was set
-        if (!(nName.compareTo(order.getItem().getName()) == 0))
-            throw new Exception("Name Value was not changed");
+        assertEquals(nName, order.getItem().getName(), "Name Value was not 
changed");
 
         //Check Error message
         String expText = "Element not allowed: size in element 
item@http://xmlobject/substgroup";;
         XmlError[] xErr2 = getXmlErrors(err);
-        assertEquals("Length of xm_errors was greater than expected", 1, 
xErr2.length);
-        assertEquals("Error Code was not as Expected", 0, 
xErr2[0].getErrorCode().compareTo("cvc-complex-type.2.4b"));
-        assertEquals("Error Message was not as expected", 0, 
xErr2[0].getMessage().compareTo(expText));
-
-        err.clear();
+        assertEquals(1, xErr2.length, "Length of xm_errors was greater than 
expected");
+        assertEquals("cvc-complex-type.2.4b", xErr2[0].getErrorCode(), "Error 
Code was not as Expected");
+        assertEquals(expText, xErr2[0].getMessage(), "Error Message was not as 
expected");
     }
 
-    private XmlError[] getXmlErrors(ArrayList c) {
-        XmlError[] errs = new XmlError[c.size()];
-        for (int i = 0; i < errs.length; i++) {
-            errs[i] = (XmlError) c.get(i);
-        }
-        return errs;
+    private XmlError[] getXmlErrors(List<XmlError> c) {
+        return c.toArray(new XmlError[0]);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void test_null_newName() {
+    @Test
+    void test_null_newName() {
         xmlobject.substgroup.OrderItem order = OrderItem.Factory.newInstance();
-        order.substitute(null, OrderItem.type);
+        assertThrows(IllegalArgumentException.class, () -> 
order.substitute(null, OrderItem.type));
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void test_null_newType() {
+    @Test
+    void test_null_newType() {
         OrderItem order = OrderItem.Factory.newInstance();
-        order.substitute(OrderItem.type.getDocumentElementName(), null);
+        assertThrows(IllegalArgumentException.class, () -> 
order.substitute(OrderItem.type.getDocumentElementName(), null));
     }
 
     @Test
-    public void test_unknownQName() {
+    void test_unknownQName() {
         QName exp = new QName("http://www.w3.org/2001/XMLSchema";, "anyType");
         OrderItem order = OrderItem.Factory.newInstance();
-        XmlObject xm = order.substitute(new QName("http://baz";, "baz"),
-            OrderItem.type);
+        XmlObject xm = order.substitute(new QName("http://baz";, "baz"), 
OrderItem.type);
 
         //Verify that the invalid substitution results in an anyType
-        assertEquals("Namespace URIs were not the same", 0, 
exp.getNamespaceURI().compareTo(
-            xm.type.getName().getNamespaceURI()));
-        assertEquals("Local Part was not as Expected", 0, 
xm.type.getName().getLocalPart().compareTo(
-            exp.getLocalPart()));
+        assertEquals(0, exp.getNamespaceURI().compareTo(
+            xm.type.getName().getNamespaceURI()), "Namespace URIs were not the 
same");
+        assertEquals(0, xm.type.getName().getLocalPart().compareTo(
+            exp.getLocalPart()), "Local Part was not as Expected");
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void test_null_Params() {
+    @Test
+    void test_null_Params() {
         XmlObject xml = XmlObject.Factory.newInstance();
-        xml.substitute(null, null);
+        assertThrows(IllegalArgumentException.class, () -> 
xml.substitute(null, null));
     }
 }

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/TestsFromBugs.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/TestsFromBugs.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/TestsFromBugs.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/TestsFromBugs.java Sun Feb  
6 01:51:55 2022
@@ -20,38 +20,33 @@ import com.mytest.Foo;
 import com.mytest.Info;
 import com.mytest.TestDocument;
 import org.apache.xmlbeans.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import test.xmlobject.test36510.Test36510AppDocument;
 
-import java.io.File;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  * Test file that implements test cases that come from closing bugs.
  */
 public class TestsFromBugs {
-    File instance;
-
     /**
      * Radar Bug: 36156
      * Problem with Namespace leaking into siblings
      */
     @Test
-    public void test36156()
+    void test36156()
         throws Exception {
         String str = "<x><y xmlns=\"bar\"><z xmlns=\"foo\"/></y><a/></x>";
         XmlObject x = XmlObject.Factory.parse(str);
 
-        assertEquals("Test 36156 failed: ", x.xmlText(), str);
+        assertEquals(x.xmlText(), str, "Test 36156 failed: ");
     }
 
     /*
      * Radar Bug: 36510
      */
     @Test
-    public void test36510()
+    void test36510()
         throws Exception {
         String str =
             "<test36510-app version='1.0' " +
@@ -69,7 +64,7 @@ public class TestsFromBugs {
         Test36510AppDocument doc = Test36510AppDocument.Factory.parse(str);
         str = doc.getTest36510App().getTestConstraintArray()[0].
             getCustomConstraint().getOptions().toString();
-        assertEquals("Test 36510 failed: ", "BEST", str);
+        assertEquals("BEST", str, "Test 36510 failed: ");
     }
 
 
@@ -77,7 +72,7 @@ public class TestsFromBugs {
      * Radar Bug: 40907
      */
     @Test
-    public void test40907()
+    void test40907()
         throws Exception {
         String str =
             "<myt:Test xmlns:myt=\"http://www.mytest.com\";>" +
@@ -87,7 +82,7 @@ public class TestsFromBugs {
             "</myt:Test>";
         TestDocument doc = TestDocument.Factory.parse(str);
 
-        assertTrue("XML Instance did not validate.", doc.validate());
+        assertTrue(doc.validate(), "XML Instance did not validate.");
 
         Bar bar = Bar.Factory.newInstance();
         bar.setFooMember("new foo member");
@@ -98,7 +93,7 @@ public class TestsFromBugs {
         Foo foo = info.addNewFoo();
         foo.set(bar);
 
-        assertTrue("Modified XML instance did not validate.", doc.validate());
+        assertTrue(doc.validate(), "Modified XML instance did not validate.");
         str = "<myt:Test xmlns:myt=\"http://www.mytest.com\";>" +
             "<myt:foo>" +
             "<myt:fooMember>this is foo member</myt:fooMember>" +
@@ -108,7 +103,7 @@ public class TestsFromBugs {
             "<myt:barMember>new bar member</myt:barMember>" +
             "</myt:foo>" +
             "</myt:Test>";
-        assertEquals("XML instance is not as expected", doc.xmlText(), str);
+        assertEquals(doc.xmlText(), str, "XML instance is not as expected");
 
     }
 
@@ -119,7 +114,7 @@ public class TestsFromBugs {
      * can be called from SchemaGlobalElement and SchemaGlobalAttribute
      */
     @Test
-    public void test199585() throws Exception {
+    void test199585() throws Exception {
         String str =
             "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
             "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n"; +
@@ -128,7 +123,8 @@ public class TestsFromBugs {
             "    xmlns:pre=\"noResolutionNamespace\"\n" +
             "    elementFormDefault=\"qualified\"\n" +
             "    attributeFormDefault=\"unqualified\">\n" +
-            "   <xs:element name=\"QuantityElement\" type=\"tns:quantity\" />" 
+
+            "   <xs:attribute name=\"GlobalAtt\" type=\"xs:string\" />\n" +
+            "   <xs:element name=\"QuantityElement\" type=\"tns:quantity\" 
/>\n" +
             "   <xs:simpleType name=\"quantity\">\n" +
             "    <xs:restriction base=\"xs:NMTOKEN\">\n" +
             "      <xs:enumeration value=\"all\"/>\n" +
@@ -140,36 +136,20 @@ public class TestsFromBugs {
             "  </xs:simpleType>" +
             "</xs:schema>";
 
-        XmlObject[] schemas = new XmlObject[]{
-            XmlObject.Factory.parse(str)};
+        XmlObject[] schemas = {XmlObject.Factory.parse(str)};
         XmlOptions xOpt = new XmlOptions().setValidateTreatLaxAsSkip();
 
         SchemaTypeSystem sts = XmlBeans.compileXmlBeans(null, null, schemas,
             null, XmlBeans.getBuiltinTypeSystem(), null, xOpt);
 
         //ensure SchemaGlobalElement has getSourceName Method
-        SchemaGlobalElement[] sge = sts.globalElements();
-        for (int i = 0; i < sge.length; i++) {
-            System.out.println("SGE SourceName: " + sge[i].getSourceName());
+        SchemaGlobalElement[] els = sts.globalElements();
+        assertEquals(1, els.length);
+        assertDoesNotThrow(els[0]::getSourceName);
 
-        }
         //ensure SchemaGlobalAttribute has getSourceName Method
-        SchemaGlobalAttribute[] sga = sts.globalAttributes();
-        for (int i = 0; i < sga.length; i++) {
-            System.out.println("SGE SourceName: " + sga[i].getSourceName());
-        }
-
-        //ensure SchemaGlobalElement is a subType of SchemaComponent
-        SchemaComponent[] sce = sts.globalElements();
-        for (int i = 0; i < sce.length; i++) {
-            System.out.println("SCE SourceName: " + sce[i].getSourceName());
-
-        }
-
-        //ensure SchemaGlobalAttribute is a subType of SchemaComponent
-        SchemaComponent[] sca = sts.globalElements();
-        for (int i = 0; i < sca.length; i++) {
-            System.out.println("SCA SourceName: " + sca[i].getSourceName());
-        }
+        SchemaGlobalAttribute[] ats = sts.globalAttributes();
+        assertEquals(1, ats.length);
+        assertDoesNotThrow(ats[0]::getSourceName);
     }
 }

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/TypedObjectCursor.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/TypedObjectCursor.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/TypedObjectCursor.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/TypedObjectCursor.java Sun 
Feb  6 01:51:55 2022
@@ -17,14 +17,14 @@ package xmlobject.detailed;
 import com.easypo.XmlCustomerBean;
 import com.easypo.XmlPurchaseOrderDocumentBean;
 import org.apache.xmlbeans.XmlCursor;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class TypedObjectCursor {
 
     @Test
-    public void testObjectCursor() {
+    void testObjectCursor() {
         XmlPurchaseOrderDocumentBean.PurchaseOrder po = 
XmlPurchaseOrderDocumentBean.PurchaseOrder.Factory.newInstance();
         try (XmlCursor cur = po.newCursor()) {
             XmlCustomerBean cust = po.addNewCustomer();

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/TypedSettersTests.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/TypedSettersTests.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/TypedSettersTests.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/TypedSettersTests.java Sun 
Feb  6 01:51:55 2022
@@ -15,15 +15,15 @@
 
 package xmlobject.detailed;
 
-import org.junit.Assert;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlInt;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 
 public class TypedSettersTests {
@@ -62,15 +62,21 @@ public class TypedSettersTests {
             } else
                 i--;
 
-            if (id.equals("schema"))
-                sb.append(schemaNs);
-            else if (id.equals("xsi"))
-                sb.append(instanceNs);
-            else if (id.equals("type")) {
-                Assert.assertTrue(arg.length() > 0);
-                sb.append("xsi:type=\"" + arg + "\"");
-            } else
-                Assert.fail();
+            switch (id) {
+                case "schema":
+                    sb.append(schemaNs);
+                    break;
+                case "xsi":
+                    sb.append(instanceNs);
+                    break;
+                case "type":
+                    assertTrue(arg.length() > 0);
+                    sb.append("xsi:type=\"").append(arg).append("\"");
+                    break;
+                default:
+                    Assertions.fail();
+                    break;
+            }
         }
 
         return sb.toString();
@@ -79,8 +85,7 @@ public class TypedSettersTests {
     private static final String nses = schemaNs + " " + instanceNs;
 
     @Test
-    public void testJavaNoTypeSingletonElement()
-        throws Exception {
+    void testJavaNoTypeSingletonElement() throws Exception {
         XmlObject x = XmlObject.Factory.parse("<xyzzy/>");
         XmlObject x2 = XmlObject.Factory.parse("<bubba>moo</bubba>");
 
@@ -96,8 +101,7 @@ public class TypedSettersTests {
     }
 
     @Test
-    public void testJavaNoTypeSingletonAttribute()
-        throws Exception {
+    void testJavaNoTypeSingletonAttribute() throws Exception {
         XmlObject x = XmlObject.Factory.parse("<xyzzy a=''/>");
         XmlObject x2 = XmlObject.Factory.parse("<bubba b='moo'/>");
 
@@ -115,18 +119,14 @@ public class TypedSettersTests {
     }
 
     @Test
-    public void testJavaNoTypeSingletonElementWithXsiType()
-        throws Exception {
+    void testJavaNoTypeSingletonElementWithXsiType() throws Exception {
         XmlObject x = XmlObject.Factory.parse("<xyzzy/>", new XmlOptions()
             .setDocumentType(XmlObject.type));
         String input = fmt("<xml-fragment $type(xs:int) $xsi $schema>" +
             "69</xml-fragment>");
         //String input=
         XmlObject x2 = XmlObject.Factory.parse(input);
-
-
-        assertSame(x2.schemaType(), XmlInt.type);
-
+        Assertions.assertSame(x2.schemaType(), XmlInt.type);
     }
 
 }

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/TypesTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/TypesTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/TypesTest.java (original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/TypesTest.java Sun Feb  6 
01:51:55 2022
@@ -16,98 +16,72 @@
 
 package xmlobject.detailed;
 
-import org.apache.xmlbeans.SchemaType;
-import org.apache.xmlbeans.SimpleValue;
-import org.apache.xmlbeans.XmlObject;
-import org.junit.Test;
+import org.apache.xmlbeans.*;
+import org.junit.jupiter.api.Test;
 import test.xbean.xmlcursor.purchaseOrder.PurchaseOrderDocument;
-import tools.util.JarUtil;
-import xmlcursor.common.BasicCursorTestCase;
 import xmlcursor.common.Common;
 
 import javax.xml.namespace.QName;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import static xmlcursor.common.BasicCursorTestCase.*;
 
 
-public class TypesTest extends BasicCursorTestCase {
+public class TypesTest {
     @Test
-    public void testSchemaTypeFromStronglyTypedBuiltIn() throws Exception {
-        m_xo = XmlObject.Factory.parse(
-                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
-        m_xc = m_xo.newCursor();
-        m_xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT +
-                "$this//EventStatus/Date");
-        m_xc.toNextSelection();
-        XmlObject xo = m_xc.getObject();
-        SchemaType st = xo.schemaType();
-        assertEquals(true, st.isBuiltinType());
-        QName q = st.getName();
-        assertEquals("{" + Common.XML_SCHEMA_TYPE_SUFFIX + "}date",
-                q.toString());
+    void testSchemaTypeFromStronglyTypedBuiltIn() throws Exception {
+        try (XmlCursor m_xc = jcur(Common.TRANXML_FILE_CLM)) {
+            m_xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT + 
"$this//EventStatus/Date");
+            m_xc.toNextSelection();
+            XmlObject xo = m_xc.getObject();
+            SchemaType st = xo.schemaType();
+            assertTrue(st.isBuiltinType());
+            QName q = st.getName();
+            assertEquals("{" + Common.XML_SCHEMA_TYPE_SUFFIX + "}date", 
q.toString());
+        }
     }
 
     @Test
-    public void testSchemaTypeFromStronglyTyped() throws Exception {
-        m_xo = XmlObject.Factory.parse(
-                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
-        m_xc = m_xo.newCursor();
-        m_xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT +
-                "$this//EventStatus");
-        m_xc.toNextSelection();
-        XmlObject xo = m_xc.getObject();
-        SchemaType st = xo.schemaType();
-        assertEquals(false, st.isBuiltinType());
-        assertEquals(
-                "E=EventStatus|D=EventStatus@" +
-                Common.TRANXML_SCHEMA_TYPE_SUFFIX,
-                st.toString());
-
+    void testSchemaTypeFromStronglyTyped() throws Exception {
+        try (XmlCursor m_xc = jcur(Common.TRANXML_FILE_CLM)) {
+            m_xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT + 
"$this//EventStatus");
+            m_xc.toNextSelection();
+            XmlObject xo = m_xc.getObject();
+            SchemaType st = xo.schemaType();
+            assertFalse(st.isBuiltinType());
+            assertEquals("E=EventStatus|D=EventStatus@" + 
Common.TRANXML_SCHEMA_TYPE_SUFFIX, st.toString());
+        }
     }
 
     @Test
-    public void testSchemaTypeFromNonTyped() throws Exception {
-        m_xo = XmlObject.Factory.parse(Common.XML_FOO_BAR_TEXT);
-        m_xc = m_xo.newCursor();
-        m_xc.selectPath("$this//bar");
-        m_xc.toNextSelection();
-        XmlObject xo = m_xc.getObject();
-        SchemaType st = xo.schemaType();
-        assertEquals(true, st.isNoType());
-        //assertEquals("TanyType@" + Common.XML_SCHEMA_TYPE_SUFFIX, 
st.toString());
+    void testSchemaTypeFromNonTyped() throws Exception {
+        try (XmlCursor m_xc = cur(Common.XML_FOO_BAR_TEXT)) {
+            m_xc.selectPath("$this//bar");
+            m_xc.toNextSelection();
+            XmlObject xo = m_xc.getObject();
+            SchemaType st = xo.schemaType();
+            assertTrue(st.isNoType());
+            //assertEquals("TanyType@" + Common.XML_SCHEMA_TYPE_SUFFIX, 
st.toString());
+        }
     }
 
     @Test
-    public void testInstanceTypeNotNillable() throws Exception {
-        m_xo = XmlObject.Factory.parse(
-                  JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
-        m_xc = m_xo.newCursor();
-        m_xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT +
-                "$this//EventStatus");
-        XmlObject xo = m_xc.getObject();
-        assertEquals(xo.schemaType(), ((SimpleValue) xo).instanceType());
+    void testInstanceTypeNotNillable() throws Exception {
+        try (XmlCursor m_xc = jcur(Common.TRANXML_FILE_CLM)) {
+            m_xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT + 
"$this//EventStatus");
+            XmlObject xo = m_xc.getObject();
+            assertEquals(xo.schemaType(), ((SimpleValue) xo).instanceType());
+        }
     }
 
     @Test
-    public void testInstanceTypeNil() throws Exception {
-        PurchaseOrderDocument pod = (PurchaseOrderDocument) 
XmlObject.Factory.parse(
-                JarUtil.getResourceFromJar("xbean/xmlcursor/po.xml"));
-        m_xo = pod.getPurchaseOrder().getShipTo().xgetName();
+    void testInstanceTypeNil() throws Exception {
+        PurchaseOrderDocument pod = (PurchaseOrderDocument) 
jobj("xbean/xmlcursor/po.xml");
+        XmlString m_xo = pod.getPurchaseOrder().getShipTo().xgetName();
         m_xo.setNil();
-        assertEquals(true, m_xo.isNil());
-        if (m_xo.schemaType() == ((SimpleValue) m_xo).instanceType()) {
-            fail("Nil object's instanceType should not be equal to 
schemaType");
-        }
-        assertTrue(true);
-    }
-
-    /*
-    public void testInstanceTypeUnion() throws Exception
-    {
-        // tbd
+        assertTrue(m_xo.isNil());
+        assertNotEquals(m_xo.schemaType(), ((SimpleValue) m_xo).instanceType(),
+            "Nil object's instanceType should not be equal to schemaType");
     }
-    */
-
-
 }
 

Modified: xmlbeans/trunk/src/test/java/xmlobject/detailed/ValueEqualsTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/ValueEqualsTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/detailed/ValueEqualsTest.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmlobject/detailed/ValueEqualsTest.java Sun 
Feb  6 01:51:55 2022
@@ -17,24 +17,19 @@
 package xmlobject.detailed;
 
 import org.apache.xmlbeans.XmlObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument;
-import tools.util.JarUtil;
-import xmlcursor.common.BasicCursorTestCase;
 import xmlcursor.common.Common;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static xmlcursor.common.BasicCursorTestCase.jobj;
 
-public class ValueEqualsTest extends BasicCursorTestCase {
+public class ValueEqualsTest  {
     @Test
-    public void testValueEqualsTrue() throws Exception {
-        CarLocationMessageDocument clmDoc = (CarLocationMessageDocument)
-                XmlObject.Factory.parse(
-                           
JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
-        m_xo = XmlObject.Factory.parse(
-                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
-        assertEquals(true, clmDoc.valueEquals(m_xo));
+    void testValueEqualsTrue() throws Exception {
+        CarLocationMessageDocument clmDoc = (CarLocationMessageDocument) 
jobj(Common.TRANXML_FILE_CLM);
+        XmlObject m_xo = jobj(Common.TRANXML_FILE_CLM);
+        assertTrue(clmDoc.valueEquals(m_xo));
     }
 
 }

Modified: 
xmlbeans/trunk/src/test/java/xmlobject/detailed/XmlObjectAbstractClassTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/detailed/XmlObjectAbstractClassTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/xmlobject/detailed/XmlObjectAbstractClassTest.java 
(original)
+++ 
xmlbeans/trunk/src/test/java/xmlobject/detailed/XmlObjectAbstractClassTest.java 
Sun Feb  6 01:51:55 2022
@@ -15,15 +15,14 @@
 package xmlobject.detailed;
 
 import org.apache.xmlbeans.impl.tool.CodeGenUtil;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 import tools.util.JarUtil;
 
 import java.io.*;
 import java.util.ArrayList;
 import java.util.List;
 
-import static org.junit.Assert.assertTrue;
-
 /**
  * JUnit Test file to test XmlObject Abstract base class
  */
@@ -34,15 +33,13 @@ public class XmlObjectAbstractClassTest
      * The test entry point.
      */
     @Test
-    public void testAbstractBaseClass() throws Exception {
+    void testAbstractBaseClass() throws Exception {
         // create the source file
         //String src = JarUtil.getResourceFromJarasStream(Common.XMLCASES_JAR, 
"xbean/xmlobject/SimpleXmlObject.java.txt");
         File to = new File("build/SimpleXmlObject.java");
-        InputStreamReader r = new InputStreamReader(
-            JarUtil.getResourceFromJarasStream(
-                "xbean/xmlobject/SimpleXmlObject.java.txt"));
-        assertTrue("Could not create source file", copyTo(r, to));
-        assertTrue("Could not compile SimpleXmlObject.java", compileFile(to));
+        InputStreamReader r = new 
InputStreamReader(JarUtil.getResourceFromJarasStream("xbean/xmlobject/SimpleXmlObject.java.txt"));
+        Assertions.assertDoesNotThrow(() -> copyTo(r, to));
+        Assertions.assertDoesNotThrow(() -> compileFile(to));
         to.deleteOnExit();
     }
 
@@ -66,58 +63,43 @@ public class XmlObjectAbstractClassTest
     /**
      * Copies a file. If destination file exists it will be overwritten
      */
-    private boolean copyTo(InputStreamReader src, File to) {
-        try {
-            // inputstream to read in the file
-            BufferedReader in = new BufferedReader(src);
-
-            // delete the existing file
-            to.delete();
-            to.createNewFile();
-            // outputstream to write out the java file
-            FileOutputStream fos = new FileOutputStream(to);
-            int b;
-
-            while ((b = in.read()) != -1) {
-                fos.write(b);
-            }
-
-            in.close();
-            fos.close();
-        } catch (Exception ioe) {
-            System.out.println("Could not create source file: " + ioe);
-            ioe.printStackTrace();
-            return false;
+    private void copyTo(InputStreamReader src, File to) throws IOException {
+        // inputstream to read in the file
+        BufferedReader in = new BufferedReader(src);
+
+        // delete the existing file
+        to.delete();
+        to.createNewFile();
+        // outputstream to write out the java file
+        FileOutputStream fos = new FileOutputStream(to);
+        int b;
+
+        while ((b = in.read()) != -1) {
+            fos.write(b);
         }
 
-        return true;
+        in.close();
+        fos.close();
     }
 
     /**
      * Copies a file. If destination file exists it will be overwritten
      */
-    private boolean copyTo(File src, File to) {
-        try {
-            // inputstream to read in the file
-            FileInputStream fis = new FileInputStream(src);
-
-            // delete the existing file
-            to.delete();
-            to.createNewFile();
-            // outputstream to write out the java file
-            FileOutputStream fos = new FileOutputStream(to);
-            int b;
-
-            while ((b = fis.read()) != -1) {
-                fos.write(b);
-            }
-            fis.close();
-            fos.close();
-        } catch (Exception ioe) {
-            System.out.println("Could not create source file: " + ioe);
-            return false;
-        }
+    private void copyTo(File src, File to) throws IOException {
+        // inputstream to read in the file
+        FileInputStream fis = new FileInputStream(src);
+
+        // delete the existing file
+        to.delete();
+        to.createNewFile();
+        // outputstream to write out the java file
+        FileOutputStream fos = new FileOutputStream(to);
+        int b;
 
-        return true;
+        while ((b = fis.read()) != -1) {
+            fos.write(b);
+        }
+        fis.close();
+        fos.close();
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/xmlobject/extensions/interfaceFeature/averageCase/checkin/AverageTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/extensions/interfaceFeature/averageCase/checkin/AverageTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/xmlobject/extensions/interfaceFeature/averageCase/checkin/AverageTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/xmlobject/extensions/interfaceFeature/averageCase/checkin/AverageTest.java
 Sun Feb  6 01:51:55 2022
@@ -18,49 +18,39 @@ package xmlobject.extensions.interfaceFe
 import interfaceFeature.xbean.averageCase.purchaseOrder.Items;
 import interfaceFeature.xbean.averageCase.purchaseOrder.PurchaseOrderDocument;
 import interfaceFeature.xbean.averageCase.purchaseOrder.PurchaseOrderType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.math.BigDecimal;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 
 public class AverageTest {
 
     @Test
-       public void test(){
+    void test() {
 
-         PurchaseOrderDocument poDoc ;
+        PurchaseOrderDocument poDoc;
 
-         poDoc= PurchaseOrderDocument.Factory.newInstance();
-         PurchaseOrderType po=poDoc.addNewPurchaseOrder();
-         int LEN=20;
-
-         Items.Item[] it= new Items.Item[LEN];
-         for (int i=0; i< LEN; i++){
-                it[i]=Items.Item.Factory.newInstance();
-                it[i].setUSPrice(new BigDecimal(""+ 2 ));
-         }
-         Items items= Items.Factory.newInstance();
-            items.setItemArray(it);
-         po.setItems(items);
-       // System.out.println("poDoc: " + poDoc);
-
-        int i=poDoc.getTotal();
-        //20 items @ $2
-        assertEquals( 40, i );
-
-    }
+        poDoc = PurchaseOrderDocument.Factory.newInstance();
+        PurchaseOrderType po = poDoc.addNewPurchaseOrder();
+        int LEN = 20;
 
-    public void testJiraXMLBEANS_206()
-    {
-        PurchaseOrderDocument poDoc ;
+        Items.Item[] it = new Items.Item[LEN];
+        for (int i = 0; i < LEN; i++) {
+            it[i] = Items.Item.Factory.newInstance();
+            it[i].setUSPrice(new BigDecimal("" + 2));
+        }
+        Items items = Items.Factory.newInstance();
+        items.setItemArray(it);
+        po.setItems(items);
 
-        poDoc= PurchaseOrderDocument.Factory.newInstance();
-        PurchaseOrderType po = poDoc.addNewPurchaseOrder();
+        int i = poDoc.getTotal();
+        //20 items @ $2
+        assertEquals(40, i);
 
-        System.out.println("Jira206 Test : = " + po.getName("String1"));
-        System.out.println("Jira206 Test : = " + po.getName("String1", 3));
+        assertNotNull(po.getName("String1"));
+        assertNotNull(po.getName("String1", 3));
     }
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to