Modified: 
xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltNillable.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltNillable.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltNillable.java 
(original)
+++ xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltNillable.java 
Sun Feb  6 01:51:55 2022
@@ -16,29 +16,31 @@
 package scomp.elements.detailed;
 
 import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.impl.values.XmlValueNotNillableException;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.element.globalEltNillable.*;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import static scomp.common.BaseCase.createOptions;
+import static scomp.common.BaseCase.getErrorCodes;
 
-public class GlobalEltNillable extends BaseCase {
+public class GlobalEltNillable {
 
     //xsi:nil illegal in instance if the elt is not nillable
     @Test
-    public void testNillableFalse() throws Exception {
-        GlobalEltNotNillableDocument testElt = GlobalEltNotNillableDocument
-                .Factory.parse("<GlobalEltNotNillable" +
-                "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
-                " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
-                " xsi:nil=\"false\"/>");
-        assertTrue(!testElt.validate(validateOptions));
-        assertEquals(1, errorList.size());
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_LOCALLY_VALID$NOT_NILLABLE};
-             assertTrue(compareErrorCodes(errExpected));
+    void testNillableFalse() throws XmlException {
+        String input =
+            "<GlobalEltNotNillable" +
+            "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
+            " xsi:nil=\"false\"/>";
+        GlobalEltNotNillableDocument testElt = 
GlobalEltNotNillableDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
+        assertFalse(testElt.validate(validateOptions));
+        String[] errExpected = {XmlErrorCodes.ELEM_LOCALLY_VALID$NOT_NILLABLE};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     /**
@@ -50,108 +52,84 @@ public class GlobalEltNillable extends B
      * element, will also add the "xsi:nil" attribute.
      */
     @Test
-    public void testNotNillable() {
+    void testNotNillable() {
 
         // XmlValueNotNillableException should be thrown only when 
validateOnSet property is set
         XmlOptions options = new XmlOptions();
         options.setValidateOnSet();
 
-        GlobalEltNotNillableDocument testElt = 
GlobalEltNotNillableDocument.Factory.newInstance(options);
-        try {
-            testElt.setNil();
-            fail("Expected XmlValueNotNillableException");
-        }
-        catch (XmlValueNotNillableException e) {
-        }
-
-        try {
-            testElt.set(null);
-            fail("Expected XmlValueNotNillableException");
-        }
-        catch (XmlValueNotNillableException e) {
-        }
+        GlobalEltNotNillableDocument testElt1 = 
GlobalEltNotNillableDocument.Factory.newInstance(options);
+        assertThrows(XmlValueNotNillableException.class, testElt1::setNil);
+        assertThrows(XmlValueNotNillableException.class, () -> 
testElt1.set(null));
 
         options.setValidateOnSet(false);
-        testElt = GlobalEltNotNillableDocument.Factory.newInstance(options);
+        GlobalEltNotNillableDocument testElt = 
GlobalEltNotNillableDocument.Factory.newInstance(options);
         testElt.setGlobalEltNotNillable(null);
 
         //assert that value is cleared
         assertEquals("<glob:GlobalEltNotNillable " +
-                "xsi:nil=\"true\" " +
-                "xmlns:glob=\"http://xbean/scomp/element/GlobalEltNillable\"; " 
+
-                "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>"
-                ,testElt.xmlText());
+                                "xsi:nil=\"true\" " +
+                                
"xmlns:glob=\"http://xbean/scomp/element/GlobalEltNillable\"; " +
+                                
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>", testElt.xmlText());
+
+        XmlOptions validateOptions = createOptions();
         assertFalse(testElt.validate(validateOptions));
-        assertEquals(1, errorList.size());
-        showErrors();
-        String[] errExpected =
-                new String[]{
-                    XmlErrorCodes.ELEM_LOCALLY_VALID$NOT_NILLABLE};
-             assertTrue(compareErrorCodes(errExpected));
+        String[] errExpected = {XmlErrorCodes.ELEM_LOCALLY_VALID$NOT_NILLABLE};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     //for nillable, fixed value cannot be specified (instance error) :
     // Walmsley p.137 footnote
     @Test
-    public void testNillableFixed() throws Exception {
-        GlobalEltNillableFixedDocument testElt = GlobalEltNillableFixedDocument
-                .Factory.parse("<GlobalEltNillableFixed" +
-                "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
-                "   xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
-                "   xsi:nil=\"true\"" +
-                "/>");
+    void testNillableFixed() throws XmlException {
+        String input =
+            "<GlobalEltNillableFixed" +
+            "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
+            "   xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
+            "   xsi:nil=\"true\"" +
+            "/>";
+        GlobalEltNillableFixedDocument testElt = 
GlobalEltNillableFixedDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
         assertFalse(testElt.validate(validateOptions));
-        assertEquals(1, errorList.size());
-        showErrors();
-               String[] errExpected = new 
String[]{XmlErrorCodes.ELEM_LOCALLY_VALID$NIL_WITH_FIXED};
-                    assertTrue(compareErrorCodes(errExpected));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_LOCALLY_VALID$NIL_WITH_FIXED};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testNillableInt() throws Exception {
-        GlobalEltNillableIntDocument testElt = GlobalEltNillableIntDocument
-                .Factory.parse("<GlobalEltNillableInt" +
-                "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
-                " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
-                " xsi:nil=\"true\"/>");
-
-        try {
-            assertTrue(testElt.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-        }
-        assertTrue ( testElt.isNilGlobalEltNillableInt());
+    void testNillableInt() throws XmlException {
+        String input =
+            "<GlobalEltNillableInt" +
+            "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
+            " xsi:nil=\"true\"/>";
+        GlobalEltNillableIntDocument testElt = 
GlobalEltNillableIntDocument.Factory.parse(input);
+
+        XmlOptions validateOptions = createOptions();
+        assertTrue(testElt.validate(validateOptions));
+        assertTrue(testElt.isNilGlobalEltNillableInt());
         assertEquals(0, testElt.getGlobalEltNillableInt());
 
         //after setting the value, the nil attribute should be gone
         testElt.setGlobalEltNillableInt(3);
-        assertEquals(
-                "<GlobalEltNillableInt" +
-                " xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
-                " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
-                ">3</GlobalEltNillableInt>",
-                testElt.xmlText() );
-
-
+        assertEquals("<GlobalEltNillableInt" +
+                            " 
xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
+                            " 
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
+                            ">3</GlobalEltNillableInt>", testElt.xmlText());
     }
 
 
     //default value not filled in for nillable elts when xsi:nil=true
     // $TODO: check w/ Kevin--what is the value of a nillable attr if it's a 
primitive type????
     @Test
-    public void testNillableDefault() throws Exception {
-        GlobalEltNillableDefaultDocument testElt = 
GlobalEltNillableDefaultDocument
-                .Factory.parse("<GlobalEltNillableDefault" +
-                "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
-                " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
-                " xsi:nil=\"true\"/>");
-        try {
-            assertTrue(testElt.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-        }
+    void testNillableDefault() throws Exception {
+        String input =
+            "<GlobalEltNillableDefault" +
+            "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
+            " xsi:nil=\"true\"/>";
+        GlobalEltNillableDefaultDocument testElt = 
GlobalEltNillableDefaultDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
+        assertTrue(testElt.validate(validateOptions));
 
         assertEquals(0, testElt.getGlobalEltNillableDefault());
     }
@@ -159,69 +137,50 @@ public class GlobalEltNillable extends B
     // An element with xsi:nil="true" may not have any element content but it
     //  may still carry attributes.
     @Test
-    public void testComplexNillable() throws Throwable {
-        GlobalEltComplexDocument testElt = GlobalEltComplexDocument
-                .Factory.parse("<GlobalEltComplex" +
-                "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
-                " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
-                " xsi:nil=\"true\"><nestedElt/></GlobalEltComplex>");
-        assertTrue(!testElt.validate(validateOptions));
-        assertEquals(1, errorList.size());
-
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_LOCALLY_VALID$NIL_WITH_CONTENT};
-             assertTrue(compareErrorCodes(errExpected));
-
-        testElt = GlobalEltComplexDocument
-                .Factory.parse("<GlobalEltComplex" +
-                "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
-                " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
-                " xsi:nil=\"true\" testattribute=\"foobar\"/>");
-        try {
-            assertTrue(testElt.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+    void testComplexNillable() throws XmlException {
+        String input =
+            "<GlobalEltComplex" +
+            "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
+            " xsi:nil=\"true\"><nestedElt/></GlobalEltComplex>";
+        GlobalEltComplexDocument testElt = 
GlobalEltComplexDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
+        assertFalse(testElt.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_LOCALLY_VALID$NIL_WITH_CONTENT};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
+        input =
+            "<GlobalEltComplex" +
+            "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
+            " xsi:nil=\"true\" testattribute=\"foobar\"/>";
+        testElt = GlobalEltComplexDocument.Factory.parse(input);
+        assertTrue(testElt.validate(validateOptions));
     }
 
-    /** calling setNil should inserts
+    /**
+     * calling setNil should inserts
      * attr and delete value
      */
     @Test
-    public void testDelete() throws Throwable{
-        GlobalEltComplexDocument  testElt = GlobalEltComplexDocument
-                .Factory.parse("<pre:GlobalEltComplex" +
-                "   
xmlns:pre=\"http://xbean/scomp/element/GlobalEltNillable\""; +
-                " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
-                " testattribute=\"foobar\">" +
-                "<nestedElt>" +
-                "foo</nestedElt></pre:GlobalEltComplex>");
-        try {
-            assertTrue(testElt.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+    void testDelete() throws XmlException {
+        String input =
+            "<pre:GlobalEltComplex" +
+            "   xmlns:pre=\"http://xbean/scomp/element/GlobalEltNillable\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
+            " testattribute=\"foobar\">" +
+            "<nestedElt>" +
+            "foo</nestedElt></pre:GlobalEltComplex>";
+        GlobalEltComplexDocument testElt = 
GlobalEltComplexDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
+        assertTrue(testElt.validate(validateOptions));
         testElt.getGlobalEltComplex().setNil();
         assertEquals("<pre:GlobalEltComplex " +
-                "testattribute=\"foobar\" " +
-                "xsi:nil=\"true\" " +
-                "xmlns:pre=\"http://xbean/scomp/element/GlobalEltNillable\"; " +
-                "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>",
-                testElt.xmlText());
-         try {
-            assertTrue(testElt.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
+                                "testattribute=\"foobar\" " +
+                                "xsi:nil=\"true\" " +
+                                
"xmlns:pre=\"http://xbean/scomp/element/GlobalEltNillable\"; " +
+                                
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>", testElt.xmlText());
+        assertTrue(testElt.validate(validateOptions));
     }
 
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/elements/detailed/LocalEltMinMaxOccurs.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/elements/detailed/LocalEltMinMaxOccurs.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/elements/detailed/LocalEltMinMaxOccurs.java 
(original)
+++ 
xmlbeans/trunk/src/test/java/scomp/elements/detailed/LocalEltMinMaxOccurs.java 
Sun Feb  6 01:51:55 2022
@@ -14,86 +14,77 @@
  */
 package scomp.elements.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
-import xbean.scomp.element.localEltMinMaxOccurs.MinMaxOccursDocDocument;
 import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
+import org.junit.jupiter.api.Test;
+import xbean.scomp.element.localEltMinMaxOccurs.MinMaxOccursDocDocument;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
+import static scomp.common.BaseCase.createOptions;
+import static scomp.common.BaseCase.getErrorCodes;
 
 /**
  *
  */
-public class LocalEltMinMaxOccurs extends BaseCase {
+public class LocalEltMinMaxOccurs {
 
-    public void testMinOccursZero() throws Throwable {
-        MinMaxOccursDocDocument testDoc = MinMaxOccursDocDocument
-                .Factory.parse("<MinMaxOccursDoc" +
-                " xmlns=\"http://xbean/scomp/element/LocalEltMinMaxOccurs\";>" +
-                "<minOccursOne>1</minOccursOne>" +
-                "<maxOccursOne>1</maxOccursOne>" +
-                "<twoToFour>1</twoToFour>" +
-                "<twoToFour>1</twoToFour>" +
-                "</MinMaxOccursDoc>");
-        try {
-            assertTrue(testDoc.validate());
-        }
-        catch (Throwable t) {
-                 showErrors();
-            throw t;
-        }
+    @Test
+    void testMinOccursZero() throws XmlException {
+        String input =
+            "<MinMaxOccursDoc" +
+            " xmlns=\"http://xbean/scomp/element/LocalEltMinMaxOccurs\";>" +
+            "<minOccursOne>1</minOccursOne>" +
+            "<maxOccursOne>1</maxOccursOne>" +
+            "<twoToFour>1</twoToFour>" +
+            "<twoToFour>1</twoToFour>" +
+            "</MinMaxOccursDoc>";
+        MinMaxOccursDocDocument testDoc = 
MinMaxOccursDocDocument.Factory.parse(input);
+        assertTrue(testDoc.validate());
     }
 
 
-    @Test
-    public void testMinGTMaxOccurs() {
-        //compile time error raised correctly. Same for neg values
-    }
+//    @Test
+//    public void testMinGTMaxOccurs() {
+//        //compile time error raised correctly. Same for neg values
+//    }
 
     // twoToFour occurs only once
     @Test
-    public void testInstanceLTMinOccurs() throws Exception {
-        MinMaxOccursDocDocument testDoc = MinMaxOccursDocDocument
-                .Factory.parse("<MinMaxOccursDoc" +
-                " xmlns=\"http://xbean/scomp/element/LocalEltMinMaxOccurs\";>" +
-                "<minOccursOne>1</minOccursOne>" +
-                "<maxOccursOne>1</maxOccursOne>" +
-                "<twoToFour>1</twoToFour>" +
-                "</MinMaxOccursDoc>");
-        assertTrue(!testDoc.validate(validateOptions));
-        assertEquals(1, errorList.size());
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
+    void testInstanceLTMinOccurs() throws XmlException {
+        String input =
+            "<MinMaxOccursDoc" +
+            " xmlns=\"http://xbean/scomp/element/LocalEltMinMaxOccurs\";>" +
+            "<minOccursOne>1</minOccursOne>" +
+            "<maxOccursOne>1</maxOccursOne>" +
+            "<twoToFour>1</twoToFour>" +
+            "</MinMaxOccursDoc>";
+        MinMaxOccursDocDocument testDoc = 
MinMaxOccursDocDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
+        assertFalse(testDoc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     // maxOccursOne occurs 2ce
     @Test
-    public void testInstanceGTMaxOccurs() throws Exception {
-        MinMaxOccursDocDocument testDoc = MinMaxOccursDocDocument
-                .Factory.parse("<MinMaxOccursDoc" +
-                " xmlns=\"http://xbean/scomp/element/LocalEltMinMaxOccurs\";>" +
-                "<minOccursOne>1</minOccursOne>" +
-                "<maxOccursOne>1</maxOccursOne>" +
-                "<maxOccursOne>1</maxOccursOne>" +
-                "<twoToFour>1</twoToFour>" +
-                "<twoToFour>1</twoToFour>" +
-                "</MinMaxOccursDoc>");
-        assertEquals(0, errorList.size());
-        assertTrue(!testDoc.validate(validateOptions));
-        assertEquals(1, errorList.size());
+    void testInstanceGTMaxOccurs() throws Exception {
+        String input =
+            "<MinMaxOccursDoc" +
+            " xmlns=\"http://xbean/scomp/element/LocalEltMinMaxOccurs\";>" +
+            "<minOccursOne>1</minOccursOne>" +
+            "<maxOccursOne>1</maxOccursOne>" +
+            "<maxOccursOne>1</maxOccursOne>" +
+            "<twoToFour>1</twoToFour>" +
+            "<twoToFour>1</twoToFour>" +
+            "</MinMaxOccursDoc>";
+        MinMaxOccursDocDocument testDoc = 
MinMaxOccursDocDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
+        assertFalse(testDoc.validate(validateOptions));
         //TODO: why is this not element not allowed?
 
-        String[] errExpected = new String[]{
-            
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT};
-        assertTrue(compareErrorCodes(errExpected));
-
-        //fail("Error is incorrect: the dev infers the cause... incorrectly");
-        showErrors();
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/elements/detailed/NamedModelGroupsTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/elements/detailed/NamedModelGroupsTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/elements/detailed/NamedModelGroupsTest.java 
(original)
+++ 
xmlbeans/trunk/src/test/java/scomp/elements/detailed/NamedModelGroupsTest.java 
Sun Feb  6 01:51:55 2022
@@ -14,37 +14,32 @@
  */
 package scomp.elements.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.element.namedModelGroup.EmployeePerf;
 import xbean.scomp.element.namedModelGroup.EmployeePerformanceDocument;
 import xbean.scomp.element.namedModelGroup.ManagerDocument;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.util.Calendar;
 import java.util.GregorianCalendar;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static scomp.common.BaseCase.createOptions;
 
-public class NamedModelGroupsTest extends BaseCase {
+public class NamedModelGroupsTest {
     @Test
-    public void testValid() throws Exception {
-        EmployeePerformanceDocument doc =
-            EmployeePerformanceDocument.Factory.newInstance();
+    void testValid() {
+        EmployeePerformanceDocument doc = 
EmployeePerformanceDocument.Factory.newInstance();
         EmployeePerf elt = doc.addNewEmployeePerformance();
         ManagerDocument.Manager m = elt.addNewManager();
         m.setDepartment("Marketing");
         m.setLastName("Smith");
 
         elt.setComment("Horrible performance by employee Potatohead");
-        elt.setDate(new GregorianCalendar(2004, 8, 12));
+        elt.setDate(new GregorianCalendar(2004, Calendar.SEPTEMBER, 12));
         elt.setGrade(new BigDecimal(new BigInteger("10")));
         elt.setManager(m);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
     }
 }

Modified: xmlbeans/trunk/src/test/java/scomp/elements/detailed/NillTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/elements/detailed/NillTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/scomp/elements/detailed/NillTest.java 
(original)
+++ xmlbeans/trunk/src/test/java/scomp/elements/detailed/NillTest.java Sun Feb  
6 01:51:55 2022
@@ -16,22 +16,22 @@ package scomp.elements.detailed;
 
 import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.impl.values.XmlValueNotNillableException;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.element.nillTest.*;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 
 /**
  * this test illustrates somewhat inconsistent behavior
  * of nillable:
  */
-public class NillTest extends BaseCase {
+public class NillTest {
     /**
      * Tests exceptions when setting values to
      * null for non-nillable elems
-     *  * CR CR192914:
+     * * CR CR192914:
      * Regardless of Schema definition,
      * setXXX(null) will clear the value of the
      * XXX attribute/element and if the container is an
@@ -39,183 +39,103 @@ public class NillTest extends BaseCase {
      */
     // for all nillable tests, the validation falls thro only if the 
ValidateOnSet option is turned on
     @Test
-    public void testNotNillableLocalElem() {
+    void testNotNillableLocalElem() {
 
         XmlOptions options = new XmlOptions();
         options.setValidateOnSet();
 
         // local element, not nillable. If setXXX is set to null & 
validateOnSet is true, it should throw XmlValueNotNillableException
         Contact contact = Contact.Factory.newInstance(options);
-        try{
-            contact.setFirstName(null);
-            fail("XmlValueNotNillableException Expected here");
-        }
-        catch (XmlValueNotNillableException e) {
-            e.printStackTrace();
-        }
+        assertThrows(XmlValueNotNillableException.class, () -> 
contact.setFirstName(null));
 
         // with validate turned off, this should to thro
         Contact contactWithValidateOff = Contact.Factory.newInstance();
-        try{
-            contactWithValidateOff.setFirstName(null);
-        }
-        catch (XmlValueNotNillableException e) {
-            e.printStackTrace();
-            fail("XmlValueNotNillableException NOT Expected here");
-        }
+        contactWithValidateOff.setFirstName(null);
         assertEquals("<firstName " +
-               "xsi:nil=\"true\" " +
-               "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>",
-               contactWithValidateOff.xmlText());
-
+                                "xsi:nil=\"true\" " +
+                                
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>", 
contactWithValidateOff.xmlText());
     }
 
     @Test
-    public void testNotNillableGlobalElem() {
+    void testNotNillableGlobalElem() {
         XmlOptions options = new XmlOptions();
         options.setValidateOnSet();
 
         // global element, not nillable. If setXXX is set to null & 
validateOnSet is true, it should throw XmlValueNotNillableException
         CityNameDocument cityName = 
CityNameDocument.Factory.newInstance(options);
-        try{
-            cityName.setCityName(null);
-            fail("XmlValueNotNillableException Expected here");
-        }
-        catch (XmlValueNotNillableException e) {
-        }
+        assertThrows(XmlValueNotNillableException.class, () -> 
cityName.setCityName(null));
 
         // with validate turned off, this should to thro
         CityNameDocument cityNameWithValidateOff = 
CityNameDocument.Factory.newInstance();
-        try{
-            cityNameWithValidateOff.setCityName(null);
-        }
-        catch (XmlValueNotNillableException e) {
-            e.printStackTrace();
-            fail("XmlValueNotNillableException NOT Expected here");
-        }
+        cityNameWithValidateOff.setCityName(null);
 
         assertEquals("<nil:cityName " +
-               "xsi:nil=\"true\" " +
-               "xmlns:nil=\"http://xbean/scomp/element/NillTest\"; " +
-               "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>",
-               cityNameWithValidateOff.xmlText());
+                                "xsi:nil=\"true\" " +
+                                
"xmlns:nil=\"http://xbean/scomp/element/NillTest\"; " +
+                                
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>", 
cityNameWithValidateOff.xmlText());
     }
 
     @Test
-    public void testNillableGlobalElement()
-    {
+    void testNillableGlobalElement() {
         XmlOptions options = new XmlOptions();
         options.setValidateOnSet();
 
         // global element, nillable. If setXXX is set to null & validateOnSet 
is true, it should NOT throw XmlValueNotNillableException
-        GlobalEltNillableDocument testElt = GlobalEltNillableDocument
-                .Factory.newInstance(options);
-        try{
-            testElt.setGlobalEltNillable(null);
-        }
-        catch (XmlValueNotNillableException e) {
-            e.printStackTrace();
-            fail("XmlValueNotNillableException Not Expected here");
-        }
+        GlobalEltNillableDocument testElt = 
GlobalEltNillableDocument.Factory.newInstance(options);
+        testElt.setGlobalEltNillable(null);
         assertEquals("<nil:GlobalEltNillable " +
-               "xsi:nil=\"true\" " +
-               "xmlns:nil=\"http://xbean/scomp/element/NillTest\"; " +
-               "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>",
-               testElt.xmlText());
+                                "xsi:nil=\"true\" " +
+                                
"xmlns:nil=\"http://xbean/scomp/element/NillTest\"; " +
+                                
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>", testElt.xmlText());
 
         // without the validateOnSet - no exception in this case either
-        GlobalEltNillableDocument testEltWithValidateOff = 
GlobalEltNillableDocument
-                .Factory.newInstance();
-        try{
-            testEltWithValidateOff.setGlobalEltNillable(null);
-        }
-        catch (XmlValueNotNillableException e) {
-            e.printStackTrace();
-            fail("XmlValueNotNillableException Not Expected here");
-        }
+        GlobalEltNillableDocument testEltWithValidateOff = 
GlobalEltNillableDocument.Factory.newInstance();
+        testEltWithValidateOff.setGlobalEltNillable(null);
         assertEquals("<nil:GlobalEltNillable " +
-               "xsi:nil=\"true\" " +
-               "xmlns:nil=\"http://xbean/scomp/element/NillTest\"; " +
-               "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>",
-               testElt.xmlText());
+                                "xsi:nil=\"true\" " +
+                                
"xmlns:nil=\"http://xbean/scomp/element/NillTest\"; " +
+                                
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>", testElt.xmlText());
     }
 
     @Test
-    public void testNillableLocalElement()
-    {
+    void testNillableLocalElement() {
         XmlOptions options = new XmlOptions();
         options.setValidateOnSet();
 
         // global element, nillable. If setXXX is set to null & validateOnSet 
is true, it should NOT throw XmlValueNotNillableException
-        Contact contact = Contact
-                .Factory.newInstance(options);
-        try{
-            contact.setLocalNillableElem(null);
-        }
-        catch (XmlValueNotNillableException e) {
-            e.printStackTrace();
-            fail("XmlValueNotNillableException Not Expected here");
-        }
+        Contact contact = Contact.Factory.newInstance(options);
+        contact.setLocalNillableElem(null);
         assertEquals("<LocalNillableElem " +
-               "xsi:nil=\"true\" " +
-               "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>",
-               contact.xmlText());
+                                "xsi:nil=\"true\" " +
+                                
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>", contact.xmlText());
 
         // without the validateOnSet - no exception in this case either
-        Contact contactWithValidationOff = Contact
-                .Factory.newInstance();
-        try{
-            contactWithValidationOff.setLocalNillableElem(null);
-        }
-        catch (XmlValueNotNillableException e) {
-            e.printStackTrace();
-            fail("XmlValueNotNillableException Not Expected here");
-        }
+        Contact contactWithValidationOff = Contact.Factory.newInstance();
+        contactWithValidationOff.setLocalNillableElem(null);
         assertEquals("<LocalNillableElem " +
-               "xsi:nil=\"true\" " +
-               "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>",
-               contactWithValidationOff.xmlText());
+                                "xsi:nil=\"true\" " +
+                                
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>", 
contactWithValidationOff.xmlText());
     }
 
     @Test
-    public void testDefaultValElement()
-    {
+    void testDefaultValElement() {
         XmlOptions options = new XmlOptions();
         options.setValidateOnSet();
 
         // default value element, not nillable. If setXXX is set to null & 
validateOnSet is true, it should
         // throw XmlValueNotNillableException and validation should fail
-        GlobalEltDefaultDocument elt = GlobalEltDefaultDocument
-                .Factory.newInstance(options);
-        try{
-            elt.setGlobalEltDefault(null);
-            System.out.println("Elt Text:" + elt.xmlText());
-            assertFalse(elt.validate());
-            fail("XmlValueNotNillableException Expected here");
-        }
-        catch (XmlValueNotNillableException e) {
-        }
+        GlobalEltDefaultDocument elt = 
GlobalEltDefaultDocument.Factory.newInstance(options);
+        assertThrows(XmlValueNotNillableException.class, () -> 
elt.setGlobalEltDefault(null));
     }
 
     @Test
-    public void testNotNillableFixedValueElement()
-    {
+    void testNotNillableFixedValueElement() {
         XmlOptions options = new XmlOptions();
         options.setValidateOnSet();
 
         // fixed value element, not nillable. If setXXX is set to null & 
validateOnSet is true, it should
         // throw XmlValueNotNillableException and validation should fail
-        GlobalEltFixedDocument elt = GlobalEltFixedDocument
-                .Factory.newInstance(options);
-        try{
-            elt.setGlobalEltFixed(null);
-            System.out.println("Elt Text:" + elt.xmlText());
-            assertFalse(elt.validate());
-            fail("XmlValueNotNillableException Expected here");
-        }
-        catch (XmlValueNotNillableException e) {
-            e.printStackTrace();
-        }
+        GlobalEltFixedDocument elt = 
GlobalEltFixedDocument.Factory.newInstance(options);
+        assertThrows(XmlValueNotNillableException.class, () -> 
elt.setGlobalEltFixed(null));
     }
-
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/idConstraint/detailed/KeyKeyref.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/idConstraint/detailed/KeyKeyref.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/scomp/idConstraint/detailed/KeyKeyref.java 
(original)
+++ xmlbeans/trunk/src/test/java/scomp/idConstraint/detailed/KeyKeyref.java Sun 
Feb  6 01:51:55 2022
@@ -16,44 +16,41 @@
 package scomp.idConstraint.detailed;
 
 import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.XmlString;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.idConstraint.constraint.*;
 
-import static org.junit.Assert.assertTrue;
-
-public class KeyKeyref extends BaseCase {
-
-    @Test
-    public void testUnique() throws Throwable {
-        String input =
-                "<con:productList 
xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\";>" +
-                " <con:product>" +
-                " <con:department con:name=\"Marketing\"/>" +
-                " <con:id>FooBarChart</con:id>" +
-                "</con:product>" +
-                "<con:product>" +
-                " <con:department con:name=\"7345\"/>" +
-                " <con:id>FooBarChart</con:id>" +
-                "</con:product>" +
-                "</con:productList>";
+import static org.junit.jupiter.api.Assertions.*;
+import static scomp.common.BaseCase.createOptions;
+import static scomp.common.BaseCase.getErrorCodes;
+
+public class KeyKeyref {
+
+    @Test
+    void testUnique() throws XmlException {
+        String input =
+            "<con:productList 
xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\";>" +
+            " <con:product>" +
+            " <con:department con:name=\"Marketing\"/>" +
+            " <con:id>FooBarChart</con:id>" +
+            "</con:product>" +
+            "<con:product>" +
+            " <con:department con:name=\"7345\"/>" +
+            " <con:id>FooBarChart</con:id>" +
+            "</con:product>" +
+            "</con:productList>";
 
         ProductListDocument doc = ProductListDocument.Factory.parse(input);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
+        assertTrue(doc.validate(createOptions()));
     }
 
     /**
      * field combo not unique in instance  (a and c are the same)
      */
     @Test
-    public void testUniqueIllegal() throws Throwable {
+    void testUniqueIllegal() {
         ProductListDocument doc = ProductListDocument.Factory.newInstance();
         ProductListType products = ProductListType.Factory.newInstance();
         ProductType a = products.addNewProduct();
@@ -73,16 +70,10 @@ public class KeyKeyref extends BaseCase
         c.setId("0");
         doc.setProductList(products);
 
-        System.out.println(doc.xmlText());
-
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.IDENTITY_CONSTRAINT_VALID$DUPLICATE_UNIQUE
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
-
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.IDENTITY_CONSTRAINT_VALID$DUPLICATE_UNIQUE};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     /**
@@ -90,162 +81,145 @@ public class KeyKeyref extends BaseCase
      * Only one dept can appear in the first product
      */
     @Test
-    public void testUniqueIllegal2() throws Throwable {
+    void testUniqueIllegal2() throws XmlException {
         String input =
-                "<con:productList 
xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\";>" +
-                " <con:product>" +
-                " <con:department con:name=\"Marketing\"/>" +
-                " <con:department con:name=\"Management\"/>" +
-                " <con:id>FooBarChart</con:id>" +
-                "</con:product>" +
-                "<con:product>" +
-                " <con:department con:name=\"7345\"/>" +
-                " <con:id>FooBarChart</con:id>" +
-                "</con:product>" +
-                "</con:productList>";
-
-        ProductListDocument doc = ProductListDocument
-                .Factory.parse(input);
-
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
+            "<con:productList 
xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\";>" +
+            " <con:product>" +
+            " <con:department con:name=\"Marketing\"/>" +
+            " <con:department con:name=\"Management\"/>" +
+            " <con:id>FooBarChart</con:id>" +
+            "</con:product>" +
+            "<con:product>" +
+            " <con:department con:name=\"7345\"/>" +
+            " <con:id>FooBarChart</con:id>" +
+            "</con:product>" +
+            "</con:productList>";
+
+        ProductListDocument doc = ProductListDocument.Factory.parse(input);
+
+        assertFalse(doc.validate(createOptions()));
     }
 
 
     @Test
-    public void testKey() throws Throwable {
-        String input =
-                "<con:KeyProductList 
xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\";>" +
-                " <con:product>" +
-                " <con:department con:name=\"Marketing\"/>" +
-                " <con:id>FooBarChart</con:id>" +
-                "</con:product>" +
-                "<con:product>" +
-                " <con:department con:name=\"7345\"/>" +
-                " <con:id>FooBarChart</con:id>" +
-                "</con:product>" +
-                "</con:KeyProductList>";
+    void testKey() throws XmlException {
+        String input =
+            "<con:KeyProductList 
xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\";>" +
+            " <con:product>" +
+            " <con:department con:name=\"Marketing\"/>" +
+            " <con:id>FooBarChart</con:id>" +
+            "</con:product>" +
+            "<con:product>" +
+            " <con:department con:name=\"7345\"/>" +
+            " <con:id>FooBarChart</con:id>" +
+            "</con:product>" +
+            "</con:KeyProductList>";
 
         KeyProductListDocument doc = 
KeyProductListDocument.Factory.parse(input);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
     }
 
     /**
      * null key in instance:missing dept in first product
      */
     @Test
-    public void testKeyIllegal() throws Throwable {
+    void testKeyIllegal() throws XmlException {
         String input =
-                "<xs:KeyProductList 
xmlns:xs=\"http://xbean/scomp/idConstraint/Constraint\";>" +
-                " <xs:product>" +
-                " <xs:id>FooBarChart</xs:id>" +
-                "</xs:product>" +
-                "<xs:product>" +
-                " <xs:department xs:name=\"7345\"/>" +
-                " <xs:id>FooBarChart</xs:id>" +
-                "</xs:product>" +
-                "</xs:KeyProductList>";
+            "<xs:KeyProductList 
xmlns:xs=\"http://xbean/scomp/idConstraint/Constraint\";>" +
+            " <xs:product>" +
+            " <xs:id>FooBarChart</xs:id>" +
+            "</xs:product>" +
+            "<xs:product>" +
+            " <xs:department xs:name=\"7345\"/>" +
+            " <xs:id>FooBarChart</xs:id>" +
+            "</xs:product>" +
+            "</xs:KeyProductList>";
 
         KeyProductListDocument doc = 
KeyProductListDocument.Factory.parse(input);
 
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
         //TODO: is this the right error
-        String[] errExpected = new String[]{
+        String[] errExpected = {
             
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT,
-           XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT
+            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT
         };
-        assertTrue(compareErrorCodes(errExpected));
-
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
 
     @Test
-    public void testKeyRef() throws Throwable {
+    void testKeyRef() throws XmlException {
         String input =
-                "<con:CompanyDB 
xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\";>" +
-                "<con:KeyProductList >" +
-                " <con:product>" +
-                " <con:department con:name=\"Marketing\"/>" +
-                " <con:id>FooBarChart</con:id>" +
-                "</con:product>" +
-                "<con:product>" +
-                " <con:department con:name=\"7345\"/>" +
-                " <con:id>FooBarChart</con:id>" +
-                "</con:product>" +
-                "</con:KeyProductList>" +
-                "<con:order>" +
-                "   <con:customerName>Bozo</con:customerName>" +
-                "   <con:item con:deptId=\"7345\"" +
-                "   con:SKU='FooBarChart'>" +
-                "  </con:item>" +
-                "</con:order>" +
-                "<con:order>" +
-                "   <con:customerName>Bozo</con:customerName>" +
-                "   <con:item con:deptId=\"7345\"" +
-                "        con:SKU=\"FooBarChart\">" +
-                "  </con:item>" +
-                "</con:order>" +
-                "</con:CompanyDB>";
+            "<con:CompanyDB 
xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\";>" +
+            "<con:KeyProductList >" +
+            " <con:product>" +
+            " <con:department con:name=\"Marketing\"/>" +
+            " <con:id>FooBarChart</con:id>" +
+            "</con:product>" +
+            "<con:product>" +
+            " <con:department con:name=\"7345\"/>" +
+            " <con:id>FooBarChart</con:id>" +
+            "</con:product>" +
+            "</con:KeyProductList>" +
+            "<con:order>" +
+            "   <con:customerName>Bozo</con:customerName>" +
+            "   <con:item con:deptId=\"7345\"" +
+            "   con:SKU='FooBarChart'>" +
+            "  </con:item>" +
+            "</con:order>" +
+            "<con:order>" +
+            "   <con:customerName>Bozo</con:customerName>" +
+            "   <con:item con:deptId=\"7345\"" +
+            "        con:SKU=\"FooBarChart\">" +
+            "  </con:item>" +
+            "</con:order>" +
+            "</con:CompanyDB>";
 
         CompanyDBDocument doc = CompanyDBDocument.Factory.parse(input);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
-
+        assertTrue(doc.validate(createOptions()));
     }
 
     // Invalid xml instance with 2 problems :
     // a) the values for the key & key ref elems are not the same
     // b) The keyref/key elems are duplicated
     @Test
-    public void testKeyRefIllegal() throws Throwable {
+    void testKeyRefIllegal() throws XmlException {
 
         String input =
-                "<con:CompanyDB 
xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\";>" +
-                "<con:KeyProductList >" +
-                " <con:product>" +
-                " <con:department con:name=\"Marketing\"/>" +
-                " <con:id>FooBarChart</con:id>" +
-                "</con:product>" +
-                " <con:product>" +
-                " <con:department con:name=\"Marketing\"/>" +
-                " <con:id>FooBarChart</con:id>" +
-                "</con:product>" +
-                "</con:KeyProductList>" +
-                "<con:order>" +
-                "   <con:customerName>Bozo</con:customerName>" +
-                "   <con:item con:deptId=\"7345\"" +
-                "   con:SKU=\"ID1\">" +
-                "  </con:item>" +
-                "</con:order>" +
-                "<con:order>" +
-                "   <con:customerName>Bozo</con:customerName>" +
-                "   <con:item con:deptId=\"7345\"" +
-                "   con:SKU=\"ID1\">" +
-                "  </con:item>" +
-                "</con:order>" +
-                "</con:CompanyDB>";
+            "<con:CompanyDB 
xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\";>" +
+            "<con:KeyProductList >" +
+            " <con:product>" +
+            " <con:department con:name=\"Marketing\"/>" +
+            " <con:id>FooBarChart</con:id>" +
+            "</con:product>" +
+            " <con:product>" +
+            " <con:department con:name=\"Marketing\"/>" +
+            " <con:id>FooBarChart</con:id>" +
+            "</con:product>" +
+            "</con:KeyProductList>" +
+            "<con:order>" +
+            "   <con:customerName>Bozo</con:customerName>" +
+            "   <con:item con:deptId=\"7345\"" +
+            "   con:SKU=\"ID1\">" +
+            "  </con:item>" +
+            "</con:order>" +
+            "<con:order>" +
+            "   <con:customerName>Bozo</con:customerName>" +
+            "   <con:item con:deptId=\"7345\"" +
+            "   con:SKU=\"ID1\">" +
+            "  </con:item>" +
+            "</con:order>" +
+            "</con:CompanyDB>";
 
         CompanyDBDocument doc = CompanyDBDocument.Factory.parse(input);
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = {
             XmlErrorCodes.IDENTITY_CONSTRAINT_VALID$DUPLICATE_KEY,
             XmlErrorCodes.IDENTITY_CONSTRAINT_VALID$KEYREF_KEY_NOT_FOUND
         };
-        assertTrue(compareErrorCodes(errExpected));
-
-
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/namespace/checkin/PreserveNamespaces.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/namespace/checkin/PreserveNamespaces.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/namespace/checkin/PreserveNamespaces.java 
(original)
+++ 
xmlbeans/trunk/src/test/java/scomp/namespace/checkin/PreserveNamespaces.java 
Sun Feb  6 01:51:55 2022
@@ -16,43 +16,36 @@
 package scomp.namespace.checkin;
 
 import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlOptions;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.xmlbeans.XmlException;
+import org.junit.jupiter.api.Test;
 import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
 import tools.xml.XmlComparator;
 
 import javax.xml.namespace.QName;
 
-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 PreserveNamespaces
-{
-    public static XmlOptions options;
-    public static final String EOL = System.getProperty("line.separator");
-
-    @Before
-    public void setUp() {
-        options = new XmlOptions().setSavePrettyPrint().setSaveOuter();
-    }
+public class PreserveNamespaces {
 
     //tests for preserving/copying namespace declarations when doing an 
XmlObject.set()
     @Test
-    public void testDroppedXsdNSDecl() throws Exception {
+    void testDroppedXsdNSDecl() throws XmlException {
+        String input =
+            "<soap:Envelope \n" +
+            "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; \n" +
+            "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"; \n" +
+            "xmlns:tns=\"http://Walkthrough/XmlWebServices/\"; \n" +
+            "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\";>\n" +
+            "  <soap:Body>\n" +
+            "    <tns:ConvertTemperature>\n" +
+            "      <dFahrenheit xsi:type=\"xsd:double\">88</dFahrenheit>\n" +
+            "    </tns:ConvertTemperature>\n" +
+            "  </soap:Body>\n" +
+            "</soap:Envelope>";
         // Test for XSD namespace declaration dropped
-        EnvelopeDocument env1 = EnvelopeDocument.Factory.parse("<soap:Envelope 
\n" +
-                "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; \n" +
-                "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"; \n" +
-                "xmlns:tns=\"http://Walkthrough/XmlWebServices/\"; \n" +
-                "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\";>\n" +
-                "  <soap:Body>\n" +
-                "    <tns:ConvertTemperature>\n" +
-                "      <dFahrenheit 
xsi:type=\"xsd:double\">88</dFahrenheit>\n" +
-                "    </tns:ConvertTemperature>\n" +
-                "  </soap:Body>\n" +
-                "</soap:Envelope>");
+        EnvelopeDocument env1 = EnvelopeDocument.Factory.parse(input);
 
         EnvelopeDocument env2 = EnvelopeDocument.Factory.newInstance();
         env2.addNewEnvelope().setBody(env1.getEnvelope().getBody());
@@ -66,58 +59,58 @@ public class PreserveNamespaces
             assertTrue(env2Cursor.toFirstChild());      // <Envelope>
             assertTrue(env2Cursor.toFirstChild());      // <Body>
             assertTrue(env2Cursor.toFirstChild());      // <ConvertTemperature>
-            if (env2Cursor.toFirstChild())               // <dFahrenheit>
-            {
-                assertEquals("Element name mismatch!", env2Cursor.getName(), 
new QName("", "dFahrenheit"));
-                assertEquals("Element val mismatch!", "88", 
env2Cursor.getTextValue());
-                assertEquals("XSD Namespace has been dropped", 
"http://www.w3.org/2001/XMLSchema";, env2Cursor.namespaceForPrefix("xsd"));
-            }
+            assertTrue(env2Cursor.toFirstChild());      // <dFahrenheit>
+            assertEquals(new QName("", "dFahrenheit"), env2Cursor.getName(), 
"Element name mismatch!");
+            assertEquals("88", env2Cursor.getTextValue(), "Element val 
mismatch!");
+            assertEquals("http://www.w3.org/2001/XMLSchema";, 
env2Cursor.namespaceForPrefix("xsd"), "XSD Namespace has been dropped");
         }
     }
 
     @Test
-    public void testsModifiedXsdNSPrefix() throws Exception {
+    void testsModifiedXsdNSPrefix() throws XmlException {
+        String input =
+            "<soap:Envelope \n" +
+            "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; \n" +
+            "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"; \n" +
+            "xmlns:tns=\"http://Walkthrough/XmlWebServices/\"; \n" +
+            "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\";>\n" +
+            "  <soap:Body>\n" +
+            "      <xsd:element name=\"myname\" type=\"xsd:string\"/>\n" +
+            "  </soap:Body>\n" +
+            "</soap:Envelope>";
         // XSD namespace used in QName values and elements
-        EnvelopeDocument env1 = EnvelopeDocument.Factory.parse("<soap:Envelope 
\n" +
-                "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; \n" +
-                "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"; \n" +
-                "xmlns:tns=\"http://Walkthrough/XmlWebServices/\"; \n" +
-                "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\";>\n" +
-                "  <soap:Body>\n" +
-                "      <xsd:element name=\"myname\" type=\"xsd:string\"/>\n" +
-                "  </soap:Body>\n" +
-                "</soap:Envelope>");
+        EnvelopeDocument env1 = EnvelopeDocument.Factory.parse(input);
 
         EnvelopeDocument env2 = EnvelopeDocument.Factory.newInstance();
         env2.addNewEnvelope().setBody(env1.getEnvelope().getBody());
 
         // compare the 2 body elements using the Xml Comparator. This uses a 
cursor to walk thro the docs and compare elements and attributes
         tools.xml.XmlComparator.Diagnostic diag = new 
tools.xml.XmlComparator.Diagnostic();
-        assertTrue("new envelope has missing XSD namespace declaration", 
XmlComparator.lenientlyCompareTwoXmlStrings(env1.getEnvelope().getBody().xmlText(),
 env2.getEnvelope().getBody().xmlText(), diag));
+        
assertTrue(XmlComparator.lenientlyCompareTwoXmlStrings(env1.getEnvelope().getBody().xmlText(),
 env2.getEnvelope().getBody().xmlText(), diag), "new envelope has missing XSD 
namespace declaration");
 
         // navigate to the 'element' element and check for the XSD namespace
         try (XmlCursor env2Cursor = env2.newCursor()) {
             assertTrue(env2Cursor.toFirstChild());      // <Envelope>
             assertTrue(env2Cursor.toFirstChild());      // <Body>
-            if (env2Cursor.toFirstChild())              // <element>
-            {
-                assertEquals("Element name mismatch!", env2Cursor.getName(), 
new QName("http://www.w3.org/2001/XMLSchema";, "element"));
-                assertEquals("XSD Namespace has been dropped", 
"http://www.w3.org/2001/XMLSchema";, env2Cursor.namespaceForPrefix("xsd"));
-            }
+            assertTrue(env2Cursor.toFirstChild());      // <element>
+            assertEquals(new QName("http://www.w3.org/2001/XMLSchema";, 
"element"), env2Cursor.getName(), "Element name mismatch!");
+            assertEquals("http://www.w3.org/2001/XMLSchema";, 
env2Cursor.namespaceForPrefix("xsd"), "XSD Namespace has been dropped");
         }
     }
 
     @Test
-    public void testsFaultCodeNSUpdate() throws Exception {
-        EnvelopeDocument env1 = EnvelopeDocument.Factory.parse("<soap:Envelope 
\n" +
-                "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\";>\n" +
-                "  <soap:Body>\n" +
-                "      <soap:Fault>\n" +
-                "           <faultcode>soap:Server</faultcode>\n" +
-                "           <faultstring>my error message</faultstring>\n" +
-                "      </soap:Fault>\n" +
-                "  </soap:Body>\n" +
-                "</soap:Envelope>");
+    void testsFaultCodeNSUpdate() throws XmlException {
+        String input =
+            "<soap:Envelope \n" +
+            "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\";>\n" +
+            "  <soap:Body>\n" +
+            "      <soap:Fault>\n" +
+            "           <faultcode>soap:Server</faultcode>\n" +
+            "           <faultstring>my error message</faultstring>\n" +
+            "      </soap:Fault>\n" +
+            "  </soap:Body>\n" +
+            "</soap:Envelope>";
+        EnvelopeDocument env1 = EnvelopeDocument.Factory.parse(input);
 
         // Test for NS of the faultcode element
         EnvelopeDocument env2 = EnvelopeDocument.Factory.newInstance();
@@ -125,18 +118,16 @@ public class PreserveNamespaces
 
         // compare the 2 body elements using the Xml Comparator. This uses a 
cursor to walk thro the docs and compare elements and attributes
         tools.xml.XmlComparator.Diagnostic diag = new 
tools.xml.XmlComparator.Diagnostic();
-        assertTrue("new envelope has missing XSD namespace declaration", 
XmlComparator.lenientlyCompareTwoXmlStrings(env1.getEnvelope().getBody().xmlText(),
 env2.getEnvelope().getBody().xmlText(), diag));
+        
assertTrue(XmlComparator.lenientlyCompareTwoXmlStrings(env1.getEnvelope().getBody().xmlText(),
 env2.getEnvelope().getBody().xmlText(), diag), "new envelope has missing XSD 
namespace declaration");
 
         // navigate to the soap element and check for the 'soap' namespace
         try (XmlCursor env2Cursor = env2.newCursor()) {
             assertTrue(env2Cursor.toFirstChild());      // <Envelope>
             assertTrue(env2Cursor.toFirstChild());      // <Body>
             assertTrue(env2Cursor.toFirstChild());      // <Fault>
-            if (env2Cursor.toFirstChild())              // <faultcode>
-            {
-                assertEquals("Element name mismatch!", env2Cursor.getName(), 
new QName("", "faultcode"));
-                assertEquals("soap Namespace has been dropped", 
"http://schemas.xmlsoap.org/soap/envelope/";, 
env2Cursor.namespaceForPrefix("soap"));
-            }
+            assertTrue(env2Cursor.toFirstChild());      // <faultcode>
+            assertEquals(env2Cursor.getName(), new QName("", "faultcode"), 
"Element name mismatch!");
+            assertEquals("http://schemas.xmlsoap.org/soap/envelope/";, 
env2Cursor.namespaceForPrefix("soap"), "soap Namespace has been dropped");
         }
     }
 

Modified: 
xmlbeans/trunk/src/test/java/scomp/namespace/detailed/AttrFormDefault.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/namespace/detailed/AttrFormDefault.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/scomp/namespace/detailed/AttrFormDefault.java 
(original)
+++ xmlbeans/trunk/src/test/java/scomp/namespace/detailed/AttrFormDefault.java 
Sun Feb  6 01:51:55 2022
@@ -17,58 +17,43 @@ package scomp.namespace.detailed;
 
 import org.apache.xmlbeans.XmlAnySimpleType;
 import org.apache.xmlbeans.XmlErrorCodes;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.apache.xmlbeans.XmlOptions;
+import org.junit.jupiter.api.Test;
 import 
xbean.scomp.namespace.attributeFormDefault.AttributeFormDefaultEltDocument;
 import xbean.scomp.namespace.attributeFormDefault.ElementT;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
+import static scomp.common.BaseCase.createOptions;
+import static scomp.common.BaseCase.getErrorCodes;
 
 /**
- * 
+ *
  */
-public class AttrFormDefault extends BaseCase {
+public class AttrFormDefault {
     @Test
-    public void testValid() throws Throwable {
-        AttributeFormDefaultEltDocument doc =
-                
AttributeFormDefaultEltDocument.Factory.parse("<ns:AttributeFormDefaultElt " +
-                
"xmlns:ns=\"http://xbean/scomp/namespace/AttributeFormDefault\""; +
-                " ns:localAttr=\"foobar\"/>");
-
-        try {
-            doc.validate(validateOptions);
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+    void testValid() throws Throwable {
+        String input =
+            "<ns:AttributeFormDefaultElt 
xmlns:ns=\"http://xbean/scomp/namespace/AttributeFormDefault\"; 
ns:localAttr=\"foobar\"/>";
+        AttributeFormDefaultEltDocument doc = 
AttributeFormDefaultEltDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
+        doc.validate(validateOptions);
     }
 
     @Test
-    public void testInvalid() throws Throwable {
-        AttributeFormDefaultEltDocument doc =
-            AttributeFormDefaultEltDocument.Factory.newInstance();
+    void testInvalid() throws Throwable {
+        AttributeFormDefaultEltDocument doc = 
AttributeFormDefaultEltDocument.Factory.newInstance();
         ElementT elt = doc.addNewAttributeFormDefaultElt();
         XmlAnySimpleType val = XmlAnySimpleType.Factory.newInstance();
         val.setStringValue("345");
         elt.setLocalAttr(val);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
-        doc =
-            
AttributeFormDefaultEltDocument.Factory.parse("<ns:AttributeFormDefaultElt " +
-                
"xmlns:ns=\"http://xbean/scomp/namespace/AttributeFormDefault\""; +
-                " localAttr=\"foobar\"/>");
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NO_WILDCARD
-        };
-        assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
 
+        String input =
+            "<ns:AttributeFormDefaultElt 
xmlns:ns=\"http://xbean/scomp/namespace/AttributeFormDefault\"; 
localAttr=\"foobar\"/>";
+        doc = AttributeFormDefaultEltDocument.Factory.parse(input);
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NO_WILDCARD};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 }



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

Reply via email to