Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/AttributeWCExtension.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/AttributeWCExtension.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/AttributeWCExtension.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/AttributeWCExtension.java
 Sun Feb  6 01:51:55 2022
@@ -14,85 +14,71 @@
  */
 package scomp.derivation.extension.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.derivation.attributeWCExtension.*;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static scomp.common.BaseCase.createOptions;
 
-public class AttributeWCExtension extends BaseCase {
+public class AttributeWCExtension {
 
     /**
      * Strict wildcard ##local
      * Base type didn't have wildcards
      */
     @Test
-    public void testRestrictBaseWOWC() throws Throwable {
-        String input = "<pre:BaseNoWC " +
-                " 
xmlns:pre=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " 
xmlns:base=\"http://xbean/scomp/attribute/GlobalAttrDefault\"; " +
-                " base:testattribute=\"val\"" +
-                " base:testattributeInt=\"3\"" +
-                " pre:testAttr=\"val1\"/>";
+    void testRestrictBaseWOWC() throws Throwable {
+        String input =
+            "<pre:BaseNoWC " +
+            " 
xmlns:pre=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
+            " xmlns:base=\"http://xbean/scomp/attribute/GlobalAttrDefault\"; " +
+            " base:testattribute=\"val\"" +
+            " base:testattributeInt=\"3\"" +
+            " pre:testAttr=\"val1\"/>";
         BaseNoWCDocument doc = BaseNoWCDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     /**
      * Strict validation: attr should be found AND valid
      */
     @Test
-    public void testAnyStrict() throws Throwable {
-        String input = "<foo:AnyStrict " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " foo:testAttr=\"val1\"/>";
+    void testAnyStrict() throws Throwable {
+        String input =
+            "<foo:AnyStrict  
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"; 
foo:testAttr=\"val1\"/>";
         AnyStrictDocument doc = AnyStrictDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     /**
      * Lax validation:IF attr is found, it should be valid
      */
     @Test
-    public void testAnyLax() throws Throwable {
-        String input = "<foo:AnyLax " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " testAttr=\"val1\"/>";
+    void testAnyLax() throws Throwable {
+        String input =
+            "<foo:AnyLax  
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"; 
testAttr=\"val1\"/>";
         AnyLaxDocument doc = AnyLaxDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     @Test
-    public void testAnySkip() throws Throwable {
-        String input = "<foo:AnySkip " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " testAttr=\"val1\"/>";
+    void testAnySkip() throws Throwable {
+        String input =
+            "<foo:AnySkip  
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"; 
testAttr=\"val1\"/>";
         AnySkipDocument doc = AnySkipDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     /**
      * target and local here too
      */
     @Test
-    public void test2ListsLax() throws Throwable {
+    void test2ListsLax() throws Throwable {
 
-        String input = "<foo:UriListLax " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " testAttr=\"val1\"/>";
+        String input =
+            "<foo:UriListLax  
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"; 
testAttr=\"val1\"/>";
         UriListLaxDocument doc = UriListLaxDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     /**
@@ -100,64 +86,53 @@ public class AttributeWCExtension extend
      * as long as NS is other or target
      */
     @Test
-    public void test2ListsSkip() throws Throwable {
-        String input = "<foo:UriListSkip " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " foo:testAttr=\"val1\"/>";
+    void test2ListsSkip() throws Throwable {
+        String input =
+            "<foo:UriListSkip  
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"; 
foo:testAttr=\"val1\"/>";
         UriListSkipDocument doc = UriListSkipDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     @Test
-    public void test2ListsStrict() throws Throwable {
-        String input = "<foo:UriListStrict " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrFixed\""; +
-                " at:testattributeStr=\"XBeanAttrStr\"/>";
+    void test2ListsStrict() throws Throwable {
+        String input =
+            "<foo:UriListStrict " +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
+            " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrFixed\""; +
+            " at:testattributeStr=\"XBeanAttrStr\"/>";
         UriListStrictDocument doc = UriListStrictDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     /**
      * target and local here too
      */
     @Test
-    public void testOtherListLax() throws Throwable {
-        String input = "<foo:OtherListLax " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " testAttr=\"val1\"/>";
+    void testOtherListLax() throws Throwable {
+        String input =
+            "<foo:OtherListLax  
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"; 
testAttr=\"val1\"/>";
         OtherListLaxDocument doc = OtherListLaxDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     @Test
-    public void testOtherListSkip() throws Throwable {
-        String input = "<foo:OtherListSkip " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " foo:undeclAttr=\"val1\"/>";
+    void testOtherListSkip() throws Throwable {
+        String input =
+            "<foo:OtherListSkip  
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"; 
foo:undeclAttr=\"val1\"/>";
         OtherListSkipDocument doc = OtherListSkipDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     @Test
-    public void testOtherListStrict() throws Throwable {
-        String input = "<foo:OtherListStrict " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrFixed\""; +
-                " at:testattributeStr=\"XBeanAttrStr\"/>";
+    void testOtherListStrict() throws Throwable {
+        String input =
+            "<foo:OtherListStrict " +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
+            " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrFixed\""; +
+            " at:testattributeStr=\"XBeanAttrStr\"/>";
 
         OtherListStrictDocument doc = 
OtherListStrictDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     /**
@@ -165,39 +140,36 @@ public class AttributeWCExtension extend
      * Other other should be equivalent to ##any
      */
     @Test
-    public void testOtherOtherLax() throws Throwable {
-        String input = "<foo:OtherOtherLax " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""+
-                " at:testAttr=\"val1\"/>";
+    void testOtherOtherLax() throws Throwable {
+        String input =
+            "<foo:OtherOtherLax " +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
+            " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""; +
+            " at:testAttr=\"val1\"/>";
         OtherOtherLaxDocument doc = OtherOtherLaxDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     @Test
-    public void testOtherOtherSkip() throws Throwable {
-        String input = "<foo:OtherOtherSkip " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""+
-                " at:foobar=\"val1\"/>";
+    void testOtherOtherSkip() throws Throwable {
+        String input =
+            "<foo:OtherOtherSkip " +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
+            " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""; +
+            " at:foobar=\"val1\"/>";
         OtherOtherSkipDocument doc = 
OtherOtherSkipDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 
     @Test
-    public void testOtherOtherStrict() throws Throwable {
-        String input = "<foo:OtherOtherStrict " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
-                " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrFixed\""; +
-                " at:testattributeStr=\"XBeanAttrStr\"/>";
+    void testOtherOtherStrict() throws Throwable {
+        String input =
+            "<foo:OtherOtherStrict " +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\""; +
+            " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrFixed\""; +
+            " at:testattributeStr=\"XBeanAttrStr\"/>";
 
         OtherOtherStrictDocument doc = 
OtherOtherStrictDocument.Factory.parse(input);
-        if (!doc.validate(validateOptions))
-            showErrors();
-        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc.validate(createOptions()));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java
 Sun Feb  6 01:51:55 2022
@@ -15,25 +15,22 @@
 package scomp.derivation.extension.detailed;
 
 import org.apache.xmlbeans.*;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.derivation.complexExtension.ChoiceExtensionEltDocument;
 import xbean.scomp.derivation.complexExtension.ChoiceExtensionT;
 import xbean.scomp.derivation.complexExtension.SequenceExtensionEltDocument;
 import xbean.scomp.derivation.complexExtension.SequenceExtensionT;
 
 import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
 
-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 ComplexContentExtensionTest extends BaseCase {
+public class ComplexContentExtensionTest {
     @Test
-    public void testSequenceExtension() throws Throwable {
-        SequenceExtensionEltDocument doc = SequenceExtensionEltDocument.Factory
-                .newInstance();
+    void testSequenceExtension() throws Throwable {
+        SequenceExtensionEltDocument doc = 
SequenceExtensionEltDocument.Factory.newInstance();
         SequenceExtensionT elt = doc.addNewSequenceExtensionElt();
         elt.setChild1(BigInteger.ONE);
         elt.addChild2("foobar");
@@ -46,52 +43,41 @@ public class ComplexContentExtensionTest
         elt.insertChild2(0, "newfoobar");
         assertEquals("newfoobar", elt.getChild2Array()[0]);
 
-        assertTrue(!doc.validate(validateOptions));
-              showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED
-        };
-                     assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
 
         elt.removeExtraEltInt(0);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         elt.removeExtraEltStr(1);
         assertTrue(elt.validate());
-
     }
 
     /**
-     *  result type is a sequence of 2 choices
+     * result type is a sequence of 2 choices
      * Valid sets: { (child1 xor child2 xor child3 )(extraEltStr xor 
extraEltStr) }
-     * @throws Throwable
      */
     @Test
-    public void testChoiceExtension() throws Throwable {
-        ChoiceExtensionEltDocument doc = ChoiceExtensionEltDocument.Factory
-                .newInstance();
+    void testChoiceExtension() throws Throwable {
+        ChoiceExtensionEltDocument doc = 
ChoiceExtensionEltDocument.Factory.newInstance();
         ChoiceExtensionT elt = doc.addNewChoiceExtensionElt();
         elt.setChild1(new BigInteger("10"));
         elt.addChild2("foobar");
         elt.setChild3Array(new BigInteger[]{BigInteger.ONE, BigInteger.ZERO});
         elt.addExtraEltInt(3);
         elt.setExtraEltStrArray(new String[]{"extra1", "extra2"});
-        assertTrue(!doc.validate(validateOptions));
-                    showErrors();
-             //TODO: child 2 and child3 not allowed
-             //extraEltStr not allowed
-              String[] errExpected = new String[]{
-                  
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT,
-                   
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT,
-                  
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED
-              };
-                           assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        //TODO: child 2 and child3 not allowed
+        //extraEltStr not allowed
+        String[] errExpected = {
+            
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT,
+            
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT,
+            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED
+        };
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         assertEquals(new BigInteger("10"), elt.getChild1());
         assertEquals("foobar", elt.getChild2Array()[0]);
@@ -99,47 +85,32 @@ public class ComplexContentExtensionTest
 
         XmlInteger expected = XmlInteger.Factory.newInstance();
         expected.setBigIntegerValue(BigInteger.ONE);
-        assertTrue( expected.valueEquals(elt.xgetChild3Array()[0]) );
+        assertTrue(expected.valueEquals(elt.xgetChild3Array()[0]));
         elt.removeExtraEltInt(0);
         elt.removeChild2(0);
-        clearErrors();
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            System.out.println(" test failed :");
-            showErrors();
-            throw t;
-        }
 
+        validateOptions.getErrorListener().clear();
+        assertTrue(doc.validate(validateOptions));
 
-
-         elt.addExtraEltInt(3);
+        elt.addExtraEltInt(3);
         expected.setBigIntegerValue(BigInteger.ZERO);
-        assertTrue( expected.valueEquals(elt.xgetChild3Array()[1]) );
-          assertEquals(3, elt.getExtraEltIntArray()[0]);
+        assertTrue(expected.valueEquals(elt.xgetChild3Array()[1]));
+        assertEquals(3, elt.getExtraEltIntArray()[0]);
         assertEquals(3, elt.getExtraEltIntArray(0));
-        clearErrors();
-        assertTrue(!doc.validate(validateOptions));
-                           showErrors();
-                    errExpected = new String[]{
-                         
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED
-                        };
-                                  assertTrue(compareErrorCodes(errExpected));
+
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc.validate(validateOptions));
+
+        errExpected = new 
String[]{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
         elt.removeExtraEltInt(0);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
+
         XmlString expected1 = XmlString.Factory.newInstance();
         expected1.setStringValue("extra1");
-        assertTrue( expected1.valueEquals(elt.xgetExtraEltStrArray(0)) );
+        assertTrue(expected1.valueEquals(elt.xgetExtraEltStrArray(0)));
         expected1.setStringValue("extra2");
-        assertTrue( expected1.valueEquals(elt.xgetExtraEltStrArray()[1]) );
-
+        assertTrue(expected1.valueEquals(elt.xgetExtraEltStrArray()[1]));
     }
 
     /**
@@ -147,200 +118,180 @@ public class ComplexContentExtensionTest
      * They are negative tests and test for #all, restriction, extenstion and 
'extenstion restriction' values
      */
     @Test
-    public void testFinalAll() {
-        String inputXsd = "    <xsd:schema 
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\";>\n" +
-                "    <xsd:complexType name=\"BaseProductTypeFinalAll\" 
final=\"#all\">\n" +
-                "        <xsd:sequence>\n" +
-                "            <xsd:element name=\"number\" type=\"xsd:integer\" 
/>\n" +
-                "            <xsd:element name=\"name\" type=\"xsd:string\" 
minOccurs=\"0\" />\n" +
-                "        </xsd:sequence>\n" +
-                "    </xsd:complexType>\n" +
-                "\n" +
-                "    <xsd:complexType name=\"ProductTypeExtension\">\n" +
-                "        <xsd:complexContent>\n" +
-                "            <xsd:extension 
base=\"BaseProductTypeFinalAll\">\n" +
-                "                <xsd:sequence>\n" +
-                "                    <xsd:element name=\"subcategory\" 
type=\"xsd:string\"/>\n" +
-                "                </xsd:sequence>\n" +
-                "            </xsd:extension>\n" +
-                "        </xsd:complexContent>\n" +
-                "    </xsd:complexType>    \n" +
-                "\n" +
-                "    <xsd:complexType name=\"ProductTypeRestriction\">\n" +
-                "        <xsd:complexContent>\n" +
-                "            <xsd:restriction 
base=\"BaseProductTypeFinalAll\">\n" +
-                "                <xsd:sequence>\n" +
-                "                    <xsd:element name=\"number\" 
type=\"xsd:integer\"/>\n" +
-                "                </xsd:sequence>\n" +
-                "            </xsd:restriction>\n" +
-                "        </xsd:complexContent>\n" +
-                "    </xsd:complexType>    \n" +
-                "\n" +
-                "    </xsd:schema>";
-
-        XmlOptions options = new XmlOptions();
-        List errors = new ArrayList();
-        options.setErrorListener(errors);
-
-        try {
-            XmlObject xobj = XmlObject.Factory.parse(inputXsd);
-            XmlObject[] compInput = new XmlObject[]{xobj};
-            XmlBeans.compileXmlBeans(null, null, compInput, null, 
XmlBeans.getBuiltinTypeSystem(), null, options);
-        }
-        catch (XmlException xme) {
-            // The convention is that the XmlException that gets thrown form 
XmlBeans.compile* methods always contains
-            // just the first error and if you need to see all errors you use 
XmlOptions.
-            // hence checking for error codes is now done with XmlOptions.
-            assertEquals(1, xme.getErrors().size());
-        }
-
-        assertEquals(2, errors.size());
-
-        Iterator itr = errors.iterator();
-        XmlError eacherr = (XmlError) itr.next();
-        System.out.println("Err:" + eacherr.getMessage() + "," + 
eacherr.getErrorCode());
-        assertNotNull(eacherr.getErrorCode());
-        assertEquals(XmlErrorCodes.COMPLEX_TYPE_EXTENSION$FINAL, 
eacherr.getErrorCode());
-
-        eacherr = (XmlError) itr.next();
-        System.out.println("Err:" + eacherr.getMessage());
-        assertNotNull(eacherr.getErrorCode());
-        assertEquals(XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$FINAL, 
eacherr.getErrorCode());
-
+    void testFinalAll() throws XmlException {
+        String inputXsd =
+            "    <xsd:schema 
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\";>\n" +
+            "    <xsd:complexType name=\"BaseProductTypeFinalAll\" 
final=\"#all\">\n" +
+            "        <xsd:sequence>\n" +
+            "            <xsd:element name=\"number\" type=\"xsd:integer\" 
/>\n" +
+            "            <xsd:element name=\"name\" type=\"xsd:string\" 
minOccurs=\"0\" />\n" +
+            "        </xsd:sequence>\n" +
+            "    </xsd:complexType>\n" +
+            "\n" +
+            "    <xsd:complexType name=\"ProductTypeExtension\">\n" +
+            "        <xsd:complexContent>\n" +
+            "            <xsd:extension base=\"BaseProductTypeFinalAll\">\n" +
+            "                <xsd:sequence>\n" +
+            "                    <xsd:element name=\"subcategory\" 
type=\"xsd:string\"/>\n" +
+            "                </xsd:sequence>\n" +
+            "            </xsd:extension>\n" +
+            "        </xsd:complexContent>\n" +
+            "    </xsd:complexType>    \n" +
+            "\n" +
+            "    <xsd:complexType name=\"ProductTypeRestriction\">\n" +
+            "        <xsd:complexContent>\n" +
+            "            <xsd:restriction base=\"BaseProductTypeFinalAll\">\n" 
+
+            "                <xsd:sequence>\n" +
+            "                    <xsd:element name=\"number\" 
type=\"xsd:integer\"/>\n" +
+            "                </xsd:sequence>\n" +
+            "            </xsd:restriction>\n" +
+            "        </xsd:complexContent>\n" +
+            "    </xsd:complexType>    \n" +
+            "\n" +
+            "    </xsd:schema>";
+
+        XmlOptions validateOptions = createOptions();
+
+        XmlObject xobj = XmlObject.Factory.parse(inputXsd);
+        XmlObject[] compInput = new XmlObject[]{xobj};
+
+        // The convention is that the XmlException that gets thrown form 
XmlBeans.compile* methods always contains
+        // just the first error and if you need to see all errors you use 
XmlOptions.
+        // hence checking for error codes is now done with XmlOptions.
+        XmlException xme = assertThrows(XmlException.class, () ->
+            XmlBeans.compileXmlBeans(null, null, compInput, null, 
XmlBeans.getBuiltinTypeSystem(), null, validateOptions));
+        assertEquals(1, xme.getErrors().size());
+
+        String[] errExpected = {
+            XmlErrorCodes.COMPLEX_TYPE_EXTENSION$FINAL,
+            XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$FINAL
+        };
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testFinalExtension() {
-        String inputXsd = "    <xsd:schema 
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\";>\n" +
-                "    <xsd:complexType name=\"BaseProductTypeFinalExtension\" 
final=\"extension\">\n" +
-                "        <xsd:sequence>\n" +
-                "            <xsd:element name=\"number\" type=\"xsd:integer\" 
/>\n" +
-                "            <xsd:element name=\"name\" type=\"xsd:string\" 
minOccurs=\"0\" />\n" +
-                "        </xsd:sequence>\n" +
-                "    </xsd:complexType>\n" +
-                "\n" +
-                "    <xsd:complexType name=\"ProductTypeExtension\">\n" +
-                "        <xsd:complexContent>\n" +
-                "            <xsd:extension 
base=\"BaseProductTypeFinalExtension\">\n" +
-                "                <xsd:sequence>\n" +
-                "                    <xsd:element name=\"subcategory\" 
type=\"xsd:string\"/>\n" +
-                "                </xsd:sequence>\n" +
-                "            </xsd:extension>\n" +
-                "        </xsd:complexContent>\n" +
-                "    </xsd:complexType>    \n" +
-                "\n" +
-                "    </xsd:schema>";
-
-        try {
-            XmlObject xobj = XmlObject.Factory.parse(inputXsd);
-            XmlObject[] compInput = new XmlObject[]{xobj};
-            XmlBeans.compileXmlBeans(null, null, compInput, null, 
XmlBeans.getBuiltinTypeSystem(), null, null);
-        }
-        catch (XmlException xme) {
-            assertEquals(xme.getErrors().size(), 1);
-
-            XmlError eacherr = (XmlError) xme.getErrors().iterator().next();
-            System.out.println("error:" + eacherr.getErrorCode());
-            assertNotNull(eacherr.getErrorCode());
-            assertEquals(XmlErrorCodes.COMPLEX_TYPE_EXTENSION$FINAL, 
eacherr.getErrorCode());
-        }
+    void testFinalExtension() throws XmlException {
+        String inputXsd =
+            "    <xsd:schema 
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\";>\n" +
+            "    <xsd:complexType name=\"BaseProductTypeFinalExtension\" 
final=\"extension\">\n" +
+            "        <xsd:sequence>\n" +
+            "            <xsd:element name=\"number\" type=\"xsd:integer\" 
/>\n" +
+            "            <xsd:element name=\"name\" type=\"xsd:string\" 
minOccurs=\"0\" />\n" +
+            "        </xsd:sequence>\n" +
+            "    </xsd:complexType>\n" +
+            "\n" +
+            "    <xsd:complexType name=\"ProductTypeExtension\">\n" +
+            "        <xsd:complexContent>\n" +
+            "            <xsd:extension 
base=\"BaseProductTypeFinalExtension\">\n" +
+            "                <xsd:sequence>\n" +
+            "                    <xsd:element name=\"subcategory\" 
type=\"xsd:string\"/>\n" +
+            "                </xsd:sequence>\n" +
+            "            </xsd:extension>\n" +
+            "        </xsd:complexContent>\n" +
+            "    </xsd:complexType>    \n" +
+            "\n" +
+            "    </xsd:schema>";
+
+        XmlObject xobj = XmlObject.Factory.parse(inputXsd);
+        XmlObject[] compInput = new XmlObject[]{xobj};
+        XmlOptions validateOptions = createOptions();
+
+        XmlException xme = assertThrows(XmlException.class, () ->
+            XmlBeans.compileXmlBeans(null, null, compInput, null, 
XmlBeans.getBuiltinTypeSystem(), null, validateOptions));
+
+        assertEquals(xme.getErrors().size(), 1);
+
+        String[] errExpected = {XmlErrorCodes.COMPLEX_TYPE_EXTENSION$FINAL};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testFinalRestriction() {
-        String inputXsd = "    <xsd:schema 
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\";>\n" +
-                "    <xsd:complexType name=\"BaseProductTypeFinalRestriction\" 
final=\"restriction\">\n" +
-                "        <xsd:sequence>\n" +
-                "            <xsd:element name=\"number\" type=\"xsd:integer\" 
/>\n" +
-                "            <xsd:element name=\"name\" type=\"xsd:string\" 
/>\n" +
-                "        </xsd:sequence>\n" +
-                "    </xsd:complexType>\n" +
-                "\n" +
-                "    <xsd:complexType name=\"ProductTypeRestriction\">\n" +
-                "        <xsd:complexContent>\n" +
-                "            <xsd:restriction 
base=\"BaseProductTypeFinalRestriction\">\n" +
-                "                <xsd:sequence>\n" +
-                "                    <xsd:element name=\"number\" 
type=\"xsd:integer\"/>\n" +
-                "                </xsd:sequence>\n" +
-                "            </xsd:restriction>\n" +
-                "        </xsd:complexContent>\n" +
-                "    </xsd:complexType>    " +
-                "    </xsd:schema>";
-
-        try {
-            XmlObject xobj = XmlObject.Factory.parse(inputXsd);
-            XmlObject[] compInput = new XmlObject[]{xobj};
-            XmlBeans.compileXmlBeans(null, null, compInput, null, 
XmlBeans.getBuiltinTypeSystem(), null, null);
-        }
-        catch (XmlException xme) {
-            assertEquals(1, xme.getErrors().size());
-
-            XmlError eacherr = (XmlError) xme.getErrors().iterator().next();
-            System.out.println("Err:" + eacherr.getMessage());
-            assertNotNull(eacherr.getErrorCode());
-            assertEquals(XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$FINAL, 
eacherr.getErrorCode());
-        }
+    void testFinalRestriction() throws XmlException {
+        String inputXsd =
+            "    <xsd:schema 
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\";>\n" +
+            "    <xsd:complexType name=\"BaseProductTypeFinalRestriction\" 
final=\"restriction\">\n" +
+            "        <xsd:sequence>\n" +
+            "            <xsd:element name=\"number\" type=\"xsd:integer\" 
/>\n" +
+            "            <xsd:element name=\"name\" type=\"xsd:string\" />\n" +
+            "        </xsd:sequence>\n" +
+            "    </xsd:complexType>\n" +
+            "\n" +
+            "    <xsd:complexType name=\"ProductTypeRestriction\">\n" +
+            "        <xsd:complexContent>\n" +
+            "            <xsd:restriction 
base=\"BaseProductTypeFinalRestriction\">\n" +
+            "                <xsd:sequence>\n" +
+            "                    <xsd:element name=\"number\" 
type=\"xsd:integer\"/>\n" +
+            "                </xsd:sequence>\n" +
+            "            </xsd:restriction>\n" +
+            "        </xsd:complexContent>\n" +
+            "    </xsd:complexType>    " +
+            "    </xsd:schema>";
+
+        XmlObject xobj = XmlObject.Factory.parse(inputXsd);
+        XmlObject[] compInput = new XmlObject[]{xobj};
+        XmlOptions validateOptions = createOptions();
+
+        XmlException xme = assertThrows(XmlException.class, () ->
+            XmlBeans.compileXmlBeans(null, null, compInput, null, 
XmlBeans.getBuiltinTypeSystem(), null, validateOptions));
+
+        assertEquals(1, xme.getErrors().size());
+
+        String[] errExpected = {
+            XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$FINAL,
+            XmlErrorCodes.PARTICLE_DERIVATION_RECURSE$UNMAPPED_ARE_EMPTIABLE
+        };
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testFinalRestrExt() {
-        String inputXsd = "    <xsd:schema 
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\";>\n" +
-                "    <xsd:complexType name=\"BaseProductTypeFinalAll\" 
final=\"restriction extension\">\n" +
-                "        <xsd:sequence>\n" +
-                "            <xsd:element name=\"number\" type=\"xsd:integer\" 
/>\n" +
-                "            <xsd:element name=\"name\" type=\"xsd:string\" 
minOccurs=\"0\" />\n" +
-                "        </xsd:sequence>\n" +
-                "    </xsd:complexType>\n" +
-                "\n" +
-                "    <xsd:complexType name=\"ProductTypeExtension\">\n" +
-                "        <xsd:complexContent>\n" +
-                "            <xsd:extension 
base=\"BaseProductTypeFinalAll\">\n" +
-                "                <xsd:sequence>\n" +
-                "                    <xsd:element name=\"subcategory\" 
type=\"xsd:string\"/>\n" +
-                "                </xsd:sequence>\n" +
-                "            </xsd:extension>\n" +
-                "        </xsd:complexContent>\n" +
-                "    </xsd:complexType>    \n" +
-                "\n" +
-                "    <xsd:complexType name=\"ProductTypeRestriction\">\n" +
-                "        <xsd:complexContent>\n" +
-                "            <xsd:restriction 
base=\"BaseProductTypeFinalAll\">\n" +
-                "                <xsd:sequence>\n" +
-                "                    <xsd:element name=\"number\" 
type=\"xsd:integer\"/>\n" +
-                "                </xsd:sequence>\n" +
-                "            </xsd:restriction>\n" +
-                "        </xsd:complexContent>\n" +
-                "    </xsd:complexType>    \n" +
-                "\n" +
-                "    </xsd:schema>";
-
-        XmlOptions options = new XmlOptions();
-        List errors = new ArrayList();
-        options.setErrorListener(errors);
-
-        try {
-            XmlObject xobj = XmlObject.Factory.parse(inputXsd);
-            XmlObject[] compInput = new XmlObject[]{xobj};
-            XmlBeans.compileXmlBeans(null, null, compInput, null, 
XmlBeans.getBuiltinTypeSystem(), null, options);
-        }
-        catch (XmlException xme) {
-            // The convention is that the XmlException that gets thrown form 
XmlBeans.compile* methods always contains
-            // just the first error and if you need to see all errors you use 
XmlOptions.
-            // hence checking for error codes is now done with XmlOptions.
-            assertEquals(1, xme.getErrors().size());
-        }
-
-        assertEquals(2, errors.size());
-
-        Iterator itr = errors.iterator();
-        XmlError eacherr = (XmlError) itr.next();
-        System.out.println("Err:" + eacherr.getMessage() + "," + 
eacherr.getErrorCode());
-        assertNotNull(eacherr.getErrorCode());
-        assertEquals(XmlErrorCodes.COMPLEX_TYPE_EXTENSION$FINAL, 
eacherr.getErrorCode());
-
-        eacherr = (XmlError) itr.next();
-        System.out.println("Err:" + eacherr.getMessage());
-        assertNotNull(eacherr.getErrorCode());
-        assertEquals(XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$FINAL, 
eacherr.getErrorCode());
+    void testFinalRestrExt() throws XmlException {
+        String inputXsd =
+            "    <xsd:schema 
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\";>\n" +
+            "    <xsd:complexType name=\"BaseProductTypeFinalAll\" 
final=\"restriction extension\">\n" +
+            "        <xsd:sequence>\n" +
+            "            <xsd:element name=\"number\" type=\"xsd:integer\" 
/>\n" +
+            "            <xsd:element name=\"name\" type=\"xsd:string\" 
minOccurs=\"0\" />\n" +
+            "        </xsd:sequence>\n" +
+            "    </xsd:complexType>\n" +
+            "\n" +
+            "    <xsd:complexType name=\"ProductTypeExtension\">\n" +
+            "        <xsd:complexContent>\n" +
+            "            <xsd:extension base=\"BaseProductTypeFinalAll\">\n" +
+            "                <xsd:sequence>\n" +
+            "                    <xsd:element name=\"subcategory\" 
type=\"xsd:string\"/>\n" +
+            "                </xsd:sequence>\n" +
+            "            </xsd:extension>\n" +
+            "        </xsd:complexContent>\n" +
+            "    </xsd:complexType>    \n" +
+            "\n" +
+            "    <xsd:complexType name=\"ProductTypeRestriction\">\n" +
+            "        <xsd:complexContent>\n" +
+            "            <xsd:restriction base=\"BaseProductTypeFinalAll\">\n" 
+
+            "                <xsd:sequence>\n" +
+            "                    <xsd:element name=\"number\" 
type=\"xsd:integer\"/>\n" +
+            "                </xsd:sequence>\n" +
+            "            </xsd:restriction>\n" +
+            "        </xsd:complexContent>\n" +
+            "    </xsd:complexType>    \n" +
+            "\n" +
+            "    </xsd:schema>";
+
+        XmlOptions validateOptions = createOptions();
+        XmlObject xobj = XmlObject.Factory.parse(inputXsd);
+        XmlObject[] compInput = new XmlObject[]{xobj};
+
+        // The convention is that the XmlException that gets thrown form 
XmlBeans.compile* methods always contains
+        // just the first error and if you need to see all errors you use 
XmlOptions.
+        // hence checking for error codes is now done with XmlOptions.
+        XmlException xme = assertThrows(XmlException.class, () ->
+            XmlBeans.compileXmlBeans(null, null, compInput, null, 
XmlBeans.getBuiltinTypeSystem(), null, validateOptions));
+        assertEquals(1, xme.getErrors().size());
+
+
+        String[] errExpected = {
+            XmlErrorCodes.COMPLEX_TYPE_EXTENSION$FINAL,
+            XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$FINAL
+        };
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/EmptyContentExtension.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/EmptyContentExtension.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/EmptyContentExtension.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/EmptyContentExtension.java
 Sun Feb  6 01:51:55 2022
@@ -14,31 +14,26 @@
  */
 package scomp.derivation.extension.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.derivation.emtpy.ExtendedEmptyEltDocument;
 import xbean.scomp.derivation.emtpy.ExtendedEmptyT;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static scomp.common.BaseCase.createOptions;
 
-public class EmptyContentExtension extends BaseCase{
+public class EmptyContentExtension {
     @Test
-    public void testEmptyElementContent() throws Throwable{
-       ExtendedEmptyEltDocument 
doc=ExtendedEmptyEltDocument.Factory.newInstance();
-       ExtendedEmptyT elt=doc.addNewExtendedEmptyElt();
-       assertTrue( !elt.isSetExtendedAttr() );
+    void testEmptyElementContent() throws Throwable {
+        ExtendedEmptyEltDocument doc = 
ExtendedEmptyEltDocument.Factory.newInstance();
+        ExtendedEmptyT elt = doc.addNewExtendedEmptyElt();
+        assertFalse(elt.isSetExtendedAttr());
         elt.setEmptyAttr("baseAttr");
-       
-        ExtendedEmptyT.ExtendedChild child=elt.addNewExtendedChild();
+
+        ExtendedEmptyT.ExtendedChild child = elt.addNewExtendedChild();
         child.setSubCh1("Child 1");
         child.setSubCh2(1.3f);
 
-        try{
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-           throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/MixedContentExtension.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/MixedContentExtension.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/MixedContentExtension.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/MixedContentExtension.java
 Sun Feb  6 01:51:55 2022
@@ -17,21 +17,21 @@ package scomp.derivation.extension.detai
 
 import org.apache.xmlbeans.XmlCursor;
 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.derivation.complexExtension.ExtendedMixedEltDocument;
 import xbean.scomp.derivation.complexExtension.ExtendedMixedT;
 
 import java.math.BigInteger;
 
-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 MixedContentExtension extends BaseCase {
+public class MixedContentExtension {
     @Test
-    public void testMixedContentInvalid() throws Throwable {
-        ExtendedMixedEltDocument doc = ExtendedMixedEltDocument.
-                Factory.newInstance();
+    void testMixedContentInvalid() throws Throwable {
+        ExtendedMixedEltDocument doc = 
ExtendedMixedEltDocument.Factory.newInstance();
         ExtendedMixedT elt = doc.addNewExtendedMixedElt();
         elt.setExtendedAttr("FOOBAR_val");
         elt.setChild1(new BigInteger("10"));
@@ -47,35 +47,34 @@ public class MixedContentExtension exten
             cur.toNextToken();
             cur.insertChars(" SOME CDATA HERE");
         }
-        String resultStr=
-                "<com:ExtendedMixedElt extendedAttr=\"FOOBAR_val\" " +
-                
"xmlns:com=\"http://xbean/scomp/derivation/ComplexExtension\";>" +
-                "<Child2/>" +
-                "2" +
-                "<child1>10</child1>" +
-                " SOME CDATA HERE" +
-                "<child3>1</child3>" +
-                "</com:ExtendedMixedElt>";
-        assertEquals(resultStr, doc.xmlText());
+        String expected =
+            "<com:ExtendedMixedElt extendedAttr=\"FOOBAR_val\" " +
+            "xmlns:com=\"http://xbean/scomp/derivation/ComplexExtension\";>" +
+            "<Child2/>" +
+            "2" +
+            "<child1>10</child1>" +
+            " SOME CDATA HERE" +
+            "<child3>1</child3>" +
+            "</com:ExtendedMixedElt>";
+        assertEquals(expected, doc.xmlText());
+
 
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
         //TODO: Order check: is this the right errors? last one seems 
redundant given second-to-last
         //need ch1, ch2
         String[] errExpected = new String[]{
             
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT,
             
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT,
             XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT
-         };
-        assertTrue(compareErrorCodes(errExpected));
-
-
+        };
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testMixedContentValid() throws Throwable {
+    void testMixedContentValid() throws Throwable {
         ExtendedMixedEltDocument doc = ExtendedMixedEltDocument.
-                Factory.newInstance();
+            Factory.newInstance();
         ExtendedMixedT elt = doc.addNewExtendedMixedElt();
         elt.setExtendedAttr("FOOBAR_val");
         elt.setChild1(new BigInteger("10"));
@@ -91,18 +90,16 @@ public class MixedContentExtension exten
             cur.toEndToken();
             cur.insertChars("SOME CDATA HERE");
 
-            assertTrue( doc.validate(validateOptions) );
+            assertTrue(doc.validate(createOptions()));
         }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        assertEquals("<com:ExtendedMixedElt " +
-                "extendedAttr=\"FOOBAR_val\" " +
-                
"xmlns:com=\"http://xbean/scomp/derivation/ComplexExtension\";>" +
-                "<child1>10</child1>" +
-                "<child2>2</child2><!--My comment--><child3>1</child3>" +
-                "SOME CDATA HERE</com:ExtendedMixedElt>", doc.xmlText());
-    }
 
+        String expected =
+            "<com:ExtendedMixedElt " +
+            "extendedAttr=\"FOOBAR_val\" " +
+            "xmlns:com=\"http://xbean/scomp/derivation/ComplexExtension\";>" +
+            "<child1>10</child1>" +
+            "<child2>2</child2><!--My comment--><child3>1</child3>" +
+            "SOME CDATA HERE</com:ExtendedMixedElt>";
+        assertEquals(expected, doc.xmlText());
+    }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/SimpleTypeExtensionTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/SimpleTypeExtensionTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/SimpleTypeExtensionTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/SimpleTypeExtensionTest.java
 Sun Feb  6 01:51:55 2022
@@ -15,61 +15,36 @@
 
 package scomp.derivation.extension.detailed;
 
-import org.junit.Test;
+import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.derivation.simpleExtension.SimpleExtensionEltDocument;
 import xbean.scomp.derivation.simpleExtension.SimpleExtensionT;
-import scomp.common.BaseCase;
-import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import static scomp.common.BaseCase.createOptions;
 
-public class SimpleTypeExtensionTest extends BaseCase {
+public class SimpleTypeExtensionTest {
 
     @Test
-    public void testExtension() throws Throwable {
+    void testExtension() throws Throwable {
         SimpleExtensionEltDocument doc = 
SimpleExtensionEltDocument.Factory.newInstance();
         SimpleExtensionT elt = doc.addNewSimpleExtensionElt();
 
-        assertTrue(!doc.validate(validateOptions));
-
-        String[] errExpected = new String[]{"cvc-attribute"};
-//        assertTrue(compareErrorCodes(errExpected));
+        assertFalse(doc.validate(createOptions()));
 
         elt.setStringValue("1");
         assertTrue(elt.validate());
         elt.setAttribute("ATTR_VAL");
-        try{
         assertTrue(doc.validate());
-        }catch(Throwable t){
-            showErrors();
-            throw t;
-        }
         assertEquals("ATTR_VAL", elt.getAttribute());
         elt.unsetAttribute();
-        assertEquals(null, elt.getAttribute());
-        assertTrue(!elt.isSetAttribute());
+        assertNull(elt.getAttribute());
+        assertFalse(elt.isSetAttribute());
 
         // why does type mismatch show up as XmlValueOutOfRangeException ?
         // updated: ok, since a setStringValue is used for an integer, this is 
a case where set value cannot be converted
         // into any of the possible valid types. Hence an exception is
         // throw irrespective of the setValidateOnSet XmlOption
-        boolean voeThrown = false;
-        try{
-            elt.setStringValue("foobar");
-            //assertTrue(!elt.validate(validateOptions));
-
-            //errExpected = new String[]{"cvc-attribute"};
-            //assertTrue(compareErrorCodes(errExpected));
-        }
-        catch (XmlValueOutOfRangeException voe){
-            voeThrown = true;
-        }
-        finally{
-            if(!voeThrown)
-                fail("Expected XmlValueOutOfRangeException here");
-        }
-
-
+        assertThrows(XmlValueOutOfRangeException.class, () -> 
elt.setStringValue("foobar"));
     }
-
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/AttrWCRestriction.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/AttrWCRestriction.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/AttrWCRestriction.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/AttrWCRestriction.java
 Sun Feb  6 01:51:55 2022
@@ -15,42 +15,43 @@
 
 package scomp.derivation.restriction.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
-import xbean.scomp.derivation.attributeWCRestriction.*;
 import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlOptions;
+import org.junit.jupiter.api.Test;
+import xbean.scomp.derivation.attributeWCRestriction.Any2ConcreteDocument;
+import xbean.scomp.derivation.attributeWCRestriction.Any2LocalDocument;
+import xbean.scomp.derivation.attributeWCRestriction.List2SubsetDocument;
+import xbean.scomp.derivation.attributeWCRestriction.Other2ListDocument;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static scomp.common.BaseCase.createOptions;
+import static scomp.common.BaseCase.getErrorCodes;
 
-import static org.junit.Assert.assertTrue;
-
-public class AttrWCRestriction extends BaseCase {
-    String input;
+public class AttrWCRestriction {
     /**
      * Replace a wildcard with a concrete attribute
      * No other attr should be valid here
-    */
+     */
     @Test
-    public void testAny2Instance() throws Throwable{
-         input="<foo:Any2Concrete " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
-                 " 
xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""; +
-                " at:testattribute=\"XBean\"/>";
-         Any2ConcreteDocument doc=
-                 Any2ConcreteDocument.Factory.parse(input);
-        assertTrue ( doc.validate(validateOptions));
-
-          input="<foo:Any2Concrete " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
-                 " 
xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""; +
-                " at:testatt=\"3\"/>";
-          doc=
-                 Any2ConcreteDocument.Factory.parse(input);
-        assertTrue ( !doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NO_WILDCARD
-        };
-                     assertTrue(compareErrorCodes(errExpected));
-
+    void testAny2Instance() throws Throwable {
+        XmlOptions validateOptions = createOptions();
+        String input =
+            "<foo:Any2Concrete " +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
+            " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""; +
+            " at:testattribute=\"XBean\"/>";
+        Any2ConcreteDocument doc = Any2ConcreteDocument.Factory.parse(input);
+        assertTrue(doc.validate(validateOptions));
+
+        input =
+            "<foo:Any2Concrete " +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
+            " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""; +
+            " at:testatt=\"3\"/>";
+        doc = Any2ConcreteDocument.Factory.parse(input);
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NO_WILDCARD};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     /**
@@ -60,53 +61,44 @@ public class AttrWCRestriction extends B
      * No namespace should be OK, any other namespace should be notOK
      */
     @Test
-    public void testAny2LocalStrict() throws Throwable{
-          input="<foo:Any2Local " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
-                " testattribute=\"XBean\"/>";
-         Any2LocalDocument doc=
-                 Any2LocalDocument.Factory.parse(input);
-        try{
-        assertTrue ( doc.validate(validateOptions));
-        }catch(Throwable t){
-            showErrors();
-            throw t;
-        }
+    void testAny2LocalStrict() throws Throwable {
+        XmlOptions validateOptions = createOptions();
+        String input =
+            "<foo:Any2Local " +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
+            " testattribute=\"XBean\"/>";
+        Any2LocalDocument doc = Any2LocalDocument.Factory.parse(input);
+        assertTrue(doc.validate(validateOptions));
 
         //a diff ns is not OK
-         input="<foo:Any2Local " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
-                 " 
xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""; +
-                " at:testattribute=\"XBean\"/>";
-          doc=
-                 Any2LocalDocument.Factory.parse(input);
-        assertTrue (! doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NOT_WILDCARD_VALID};
-                     assertTrue(compareErrorCodes(errExpected));
-
+        input =
+            "<foo:Any2Local " +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
+            " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""; +
+            " at:testattribute=\"XBean\"/>";
+        doc = Any2LocalDocument.Factory.parse(input);
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NOT_WILDCARD_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     /**
      * should be able to replace list of ns w/ subset
      * lax to strict
-     * @throws Throwable
      */
     @Test
-    public void testList2SubsetStrict()throws Throwable{
-          input="<foo:List2Subset " +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
-                 " xmlns:at=\"http://ap.org\""; +
-                " at:testattribute=\"XBean\"/>";
-         List2SubsetDocument doc=
-                 List2SubsetDocument.Factory.parse(input);
+    void testList2SubsetStrict() throws Throwable {
+        XmlOptions validateOptions = createOptions();
+        String input =
+            "<foo:List2Subset " +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
+            " xmlns:at=\"http://ap.org\""; +
+            " at:testattribute=\"XBean\"/>";
+        List2SubsetDocument doc = List2SubsetDocument.Factory.parse(input);
         //this is a non-existing NS...strict should complain
-        assertTrue ( !doc.validate(validateOptions));
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NOT_WILDCARD_VALID};
-                     assertTrue(compareErrorCodes(errExpected));
-
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NOT_WILDCARD_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         //invalid case: give the attr a bad value, make sure it's being 
validated
     }
@@ -116,28 +108,25 @@ public class AttrWCRestriction extends B
      * skip to lax
      */
     @Test
-    public void testOther2ListLax()throws Throwable{
-          input="<foo:Other2List" +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
-                 " 
xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""; +
-                " at:testattribute=\"XBean\"/>";
-         Other2ListDocument doc=
-                 Other2ListDocument.Factory.parse(input);
-        assertTrue ( doc.validate(validateOptions));
+    void testOther2ListLax() throws Throwable {
+        XmlOptions validateOptions = createOptions();
+        String input =
+            "<foo:Other2List" +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
+            " xmlns:at=\"http://xbean/scomp/attribute/GlobalAttrDefault\""; +
+            " at:testattribute=\"XBean\"/>";
+        Other2ListDocument doc = Other2ListDocument.Factory.parse(input);
+        assertTrue(doc.validate(validateOptions));
 
         //invalid case: a ns not in the list
-
-         input="<foo:Other2List" +
-                " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
-                 " xmlns:at=\"http://foobar\""; +
-                " at:testattribute=\"XBean\"/>";
-          doc=
-                 Other2ListDocument.Factory.parse(input);
-        assertTrue (! doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NOT_WILDCARD_VALID};
-                     assertTrue(compareErrorCodes(errExpected));
-
+        input =
+            "<foo:Other2List" +
+            " 
xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\""; +
+            " xmlns:at=\"http://foobar\""; +
+            " at:testattribute=\"XBean\"/>";
+        doc = Other2ListDocument.Factory.parse(input);
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NOT_WILDCARD_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/AttributeRestriction.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/AttributeRestriction.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/AttributeRestriction.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/AttributeRestriction.java
 Sun Feb  6 01:51:55 2022
@@ -15,97 +15,87 @@
 
 package scomp.derivation.restriction.detailed;
 
-import org.junit.Test;
+import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlString;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.derivation.attributeRestriction.AttrEltDocument;
 import xbean.scomp.derivation.attributeRestriction.RestrictedAttrT;
 
 import java.math.BigInteger;
 
-import scomp.common.BaseCase;
-import org.apache.xmlbeans.XmlString;
-import org.apache.xmlbeans.XmlErrorCodes;
-
-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 AttributeRestriction extends BaseCase {
+public class AttributeRestriction {
     /**
      * A should be positive
      * B should be there by default
      */
     @Test
-    public void testAttributeABC() throws Throwable {
+    void testAttributeABC() throws Throwable {
         AttrEltDocument doc = AttrEltDocument.Factory.newInstance();
         RestrictedAttrT elt = doc.addNewAttrElt();
         elt.setA(new BigInteger("-3"));
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-       String[] errExpected = new String[]{
-           "cvc-attribute",
-           
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_REQUIRED_ATTRIBUTE
-       };
-//                    assertTrue(compareErrorCodes(errExpected));
+        assertFalse(doc.validate(createOptions()));
+        String[] errExpected = {
+            "cvc-attribute",
+            
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_REQUIRED_ATTRIBUTE
+        };
+        // assertTrue(compareErrorCodes(errExpected));
 
         assertEquals("b", elt.getB());
-       XmlString expected=XmlString.Factory.newInstance();
-       expected.setStringValue("c2");
-        assertTrue ( expected.valueEquals(elt.xgetC()) );
+        XmlString expected = XmlString.Factory.newInstance();
+        expected.setStringValue("c2");
+        assertTrue(expected.valueEquals(elt.xgetC()));
     }
 
     @Test
-    public void testAttributeDEF() throws Throwable {
+    void testAttributeDEF() throws Throwable {
         AttrEltDocument doc = AttrEltDocument.Factory.newInstance();
         RestrictedAttrT elt = doc.addNewAttrElt();
-        XmlString expected=XmlString.Factory.newInstance();
+        XmlString expected = XmlString.Factory.newInstance();
         expected.setStringValue("a");
         elt.xsetD(expected);
         assertEquals("a", elt.getD());
-        assertTrue(!doc.validate(validateOptions));
-       // showErrors();
+
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        // showErrors();
         //D invalid, F missing
-        String[] errExpected = new String[]{
+        String[] errExpected = {
             XmlErrorCodes.ATTR_LOCALLY_VALID$FIXED,
-              
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_REQUIRED_ATTRIBUTE
+            
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_REQUIRED_ATTRIBUTE
         };
-        assertTrue(compareErrorCodes(errExpected));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         elt.setD("d");
         elt.setE("e");
         elt.setF("foobar");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
     }
 
     /**
      * G is prohibited, X can appear even though not explicit in type
      */
     @Test
-    public void testAttributeGX() throws Throwable {
+    void testAttributeGX() throws Throwable {
         AttrEltDocument doc = AttrEltDocument.Factory.newInstance();
         RestrictedAttrT elt = doc.addNewAttrElt();
         elt.setG("foobar");
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
         //g prohibited, f missing
-        String[] errExpected = new String[]{
+        String[] errExpected = {
             XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NO_WILDCARD,
             
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_REQUIRED_ATTRIBUTE
         };
-        assertTrue(compareErrorCodes(errExpected));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         elt.setX("myval");
         elt.unsetG();
         elt.setF("foobar");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/ElementRestriction.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/ElementRestriction.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/ElementRestriction.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/ElementRestriction.java
 Sun Feb  6 01:51:55 2022
@@ -14,20 +14,18 @@
  */
 package scomp.derivation.restriction.detailed;
 
-import org.apache.xmlbeans.XmlDecimal;
-import org.apache.xmlbeans.XmlErrorCodes;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlString;
+import org.apache.xmlbeans.*;
 import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.derivation.elementRestriction.ElementDocument;
 import xbean.scomp.derivation.elementRestriction.RestrictedEltT;
 
-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 ElementRestriction extends BaseCase {
+public class ElementRestriction {
     /**
      * <xsd:complexType name="SequenceT">
      * <xsd:sequence>
@@ -48,7 +46,7 @@ public class ElementRestriction extends
      * </xsd:complexType>
      */
     @Test
-    public void testRestrictedElement() throws Throwable {
+    void testRestrictedElement() throws Throwable {
         ElementDocument doc = ElementDocument.Factory.newInstance();
         RestrictedEltT elt = doc.addNewElement();
         XmlString aValue = XmlString.Factory.newInstance();
@@ -65,29 +63,21 @@ public class ElementRestriction extends
         XmlDecimal dValue = XmlDecimal.Factory.newInstance();
         dValue.setBigDecimalValue(new java.math.BigDecimal("3.5"));
         elt.setD(dValue);
+
+        XmlOptions validateOptions = createOptions();
         assertFalse(doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
+        String[] errExpected = {
             
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT,
             XmlErrorCodes.ELEM_LOCALLY_VALID$FIXED_VALID_MIXED_CONTENT,
             XmlErrorCodes.INTEGER,
         };
-        assertTrue(compareErrorCodes(errExpected));
-
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         elt.removeA(2);
         bValue.setStringValue("myval");
         elt.setB(bValue);
         elt.setD(3);
-        assertEquals("myval",
-                ((XmlAnyTypeImpl)elt.getB()).getStringValue());
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
+        assertEquals("myval", ((XmlAnyTypeImpl)elt.getB()).getStringValue());
+        assertTrue(doc.validate(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/ElementWCRestriction.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/ElementWCRestriction.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/ElementWCRestriction.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/ElementWCRestriction.java
 Sun Feb  6 01:51:55 2022
@@ -16,164 +16,130 @@
 package scomp.derivation.restriction.detailed;
 
 import org.apache.xmlbeans.XmlErrorCodes;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.derivation.elementWCRestriction.ConcreteEltDocument;
 import xbean.scomp.derivation.elementWCRestriction.OtherLaxDocument;
 import xbean.scomp.derivation.elementWCRestriction.UriSkipDocument;
 
-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;
 
 //TODO compile time tests w/ occurence contstraints
-public class ElementWCRestriction extends BaseCase {
+public class ElementWCRestriction {
     // max occurs is now 2, not 3
     //NS restricted from any to other
     @Test
-    public void testMaxOccurs() throws Throwable {
+    void testMaxOccurs() throws XmlException {
+        XmlOptions validateOptions = createOptions();
         String input =
-                "<OtherLax " +
-                " 
xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\""; +
-                " xmlns:elt=\"http://xbean/scomp/element/GlobalEltDefault\";>" +
-                "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
-                "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
-                "</OtherLax>";
-        OtherLaxDocument doc =
-                OtherLaxDocument.Factory.parse(input);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+            "<OtherLax " +
+            " xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\""; +
+            " xmlns:elt=\"http://xbean/scomp/element/GlobalEltDefault\";>" +
+            "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
+            "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
+            "</OtherLax>";
+        OtherLaxDocument doc = OtherLaxDocument.Factory.parse(input);
+        assertTrue(doc.validate(validateOptions));
+
         //more than 2 elts not OK anymore
         //TODO: how do you add more than one elt here? only a
         //  setXXX method...no array
         input =
-                "<OtherLax " +
-                " 
xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\""; +
-                " xmlns:elt=\"http://xbean/scomp/element/GlobalEltDefault\";>" +
-                "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
-                "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
-                "<elt:GlobalEltDefaultInt>3</elt:GlobalEltDefaultInt>" +
-                "</OtherLax>";
-        doc =
-                OtherLaxDocument.Factory.parse(input);
-
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED
-        };
-                     assertTrue(compareErrorCodes(errExpected));
-
+            "<OtherLax " +
+            " xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\""; +
+            " xmlns:elt=\"http://xbean/scomp/element/GlobalEltDefault\";>" +
+            "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
+            "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
+            "<elt:GlobalEltDefaultInt>3</elt:GlobalEltDefaultInt>" +
+            "</OtherLax>";
+        doc = OtherLaxDocument.Factory.parse(input);
+
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         //Only valid NS should be Other
         input =
-                "<OtherLax " +
-                " 
xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\";>" +
-                "<testElt>foo</testElt></OtherLax>";
-        doc =
-                OtherLaxDocument.Factory.parse(input);
-        clearErrors();
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
+            "<OtherLax " +
+            " xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\";>" +
+            "<testElt>foo</testElt></OtherLax>";
+        doc = OtherLaxDocument.Factory.parse(input);
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc.validate(validateOptions));
         errExpected = new String[]{
             XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED,
             XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_ELEMENT
         };
-                     assertTrue(compareErrorCodes(errExpected));
-
-
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     //elt needs to occur exactly 2x
     //only URI allowed is GlobalElt
     @Test
-    public void testMinOccurs() throws Throwable {
+    void testMinOccurs() throws XmlException {
+        XmlOptions validateOptions = createOptions();
         String input =
-                "<UriSkip " +
-                " 
xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\""; +
-                " xmlns:elt=\"http://xbean/scomp/element/GlobalEltDefault\";>" +
-                "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
-                "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
-                "</UriSkip>";
-        UriSkipDocument doc =
-                UriSkipDocument.Factory.parse(input);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+            "<UriSkip " +
+            " xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\""; +
+            " xmlns:elt=\"http://xbean/scomp/element/GlobalEltDefault\";>" +
+            "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
+            "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
+            "</UriSkip>";
+        UriSkipDocument doc = UriSkipDocument.Factory.parse(input);
+        assertTrue(doc.validate(validateOptions));
+
         //MinOccurs is 2
         input =
-                "<UriSkip " +
-                " 
xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\""; +
-                " xmlns:elt=\"http://xbean/scomp/element/GlobalEltDefault\";>" +
-                "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
-                "</UriSkip>";
-        doc =
-                UriSkipDocument.Factory.parse(input);
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_ELEMENT
-        };
-                     assertTrue(compareErrorCodes(errExpected));
-
+            "<UriSkip " +
+            " xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\""; +
+            " xmlns:elt=\"http://xbean/scomp/element/GlobalEltDefault\";>" +
+            "<elt:GlobalEltDefaultStr>foo</elt:GlobalEltDefaultStr>" +
+            "</UriSkip>";
+        doc = UriSkipDocument.Factory.parse(input);
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_ELEMENT};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     //WC replaced by elt
     //maxOccurs is 1
     @Test
-    public void testConcrete() throws Throwable {
+    void testConcrete() throws Throwable {
+        XmlOptions validateOptions = createOptions();
         String input =
-                "<foo:ConcreteElt " +
-                
"xmlns:foo=\"http://xbean/scomp/derivation/ElementWCRestriction\";>" +
-                "<concreteChild>foo</concreteChild>" +
-                "</foo:ConcreteElt>";
-        ConcreteEltDocument doc =
-                ConcreteEltDocument.Factory.parse(input);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+            "<foo:ConcreteElt " +
+            
"xmlns:foo=\"http://xbean/scomp/derivation/ElementWCRestriction\";>" +
+            "<concreteChild>foo</concreteChild>" +
+            "</foo:ConcreteElt>";
+        ConcreteEltDocument doc = ConcreteEltDocument.Factory.parse(input);
+        assertTrue(doc.validate(validateOptions));
+
         //Max Occurs is 1
         input =
-                "<foo:ConcreteElt " +
-                
"xmlns:foo=\"http://xbean/scomp/derivation/ElementWCRestriction\";>" +
-                "<concreteChild>foo</concreteChild>" +
-                "<concreteChild>2</concreteChild>" +
-                "</foo:ConcreteElt>";
-        doc =
-                        ConcreteEltDocument.Factory.parse(input);
-
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
+            "<foo:ConcreteElt " +
+            
"xmlns:foo=\"http://xbean/scomp/derivation/ElementWCRestriction\";>" +
+            "<concreteChild>foo</concreteChild>" +
+            "<concreteChild>2</concreteChild>" +
+            "</foo:ConcreteElt>";
+        doc = ConcreteEltDocument.Factory.parse(input);
+        assertFalse(doc.validate(validateOptions));
 
         //child other than that elt
         input =
-                "<ConcreteElt " +
-                "xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\""; 
+
-                "<testElt>foo</testElt></ConcreteElt>";
-        clearErrors();
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-             XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED
+            "<ConcreteElt " +
+            "xmlns=\"http://xbean/scomp/derivation/ElementWCRestriction\";>" +
+            "<testElt>foo</testElt></ConcreteElt>";
+        validateOptions.getErrorListener().clear();
+        doc = ConcreteEltDocument.Factory.parse(input);
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = {
+            
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT,
+            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT
         };
-                     assertTrue(compareErrorCodes(errExpected));
-
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
-
 }
 

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/EmptyContentRestriction.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/EmptyContentRestriction.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/EmptyContentRestriction.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/EmptyContentRestriction.java
 Sun Feb  6 01:51:55 2022
@@ -16,55 +16,46 @@ package scomp.derivation.restriction.det
 
 import org.apache.xmlbeans.XmlCursor;
 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.derivation.emtpy.RestrictedEmptyEltDocument;
 import xbean.scomp.derivation.emtpy.RestrictedEmptyT;
 
-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 EmptyContentRestriction extends BaseCase {
+public class EmptyContentRestriction {
 
     @Test
-    public void testRestriction() throws Throwable {
+    void testRestriction() throws Throwable {
         RestrictedEmptyEltDocument doc = 
RestrictedEmptyEltDocument.Factory.newInstance();
 
         RestrictedEmptyT elt = doc.addNewRestrictedEmptyElt();
         elt.setEmptyAttr("foobar");
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ATTR_LOCALLY_VALID$FIXED
-        };
-                     assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = {XmlErrorCodes.ATTR_LOCALLY_VALID$FIXED};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         elt.setEmptyAttr("myval");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
+
         try (XmlCursor cur = elt.newCursor()) {
             cur.toFirstContentToken();
             cur.toNextToken();
             cur.beginElement("foobar");
         }
-        assertEquals("<xml-fragment>" +
-                "<emt:RestrictedEmptyElt emptyAttr=\"myval\" " +
-                "xmlns:emt=\"http://xbean/scomp/derivation/Emtpy\"/>" +
-                "<foobar/></xml-fragment>", doc.xmlText());
-
-        clearErrors();
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
-
+        String expXml =
+            "<xml-fragment>" +
+            "<emt:RestrictedEmptyElt emptyAttr=\"myval\" " +
+            "xmlns:emt=\"http://xbean/scomp/derivation/Emtpy\"/>" +
+            "<foobar/></xml-fragment>";
+        assertEquals(expXml, doc.xmlText());
+
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc.validate(validateOptions));
+        errExpected = new 
String[]{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/EnumTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/EnumTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/EnumTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/EnumTest.java
 Sun Feb  6 01:51:55 2022
@@ -17,70 +17,52 @@ package scomp.derivation.restriction.det
 
 import org.apache.xmlbeans.*;
 import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 
-import java.util.ArrayList;
 import java.util.Collections;
-import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static scomp.common.BaseCase.createOptions;
 
-public class EnumTest extends BaseCase
- {
+public class EnumTest {
     /*
-    * Refer CR199528, CR191369.
-    * This fails in V1 and the case is added here to ensure compliance in v2.
-    */
+     * Refer CR199528, CR191369.
+     * This fails in V1 and the case is added here to ensure compliance in v2.
+     */
     @Test
-    public void testEnumRestrictionScomp() throws Exception {
-        String xsdAsString = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
-                "\n" +
-                "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\";>\n" +
-                "\n" +
-                " <xs:element name=\"ActionTypeElem\" type=\"ACTION_TYPE\" 
/>\n" +
-                " <xs:element name=\"VIPActionTypeElem\" 
type=\"VIP_ACTION_TYPE\" />\n" +
-                "\n" +
-                " <xs:simpleType name=\"ACTION_TYPE\">\n" +
-                "  <xs:restriction base=\"xs:string\">\n" +
-                "   <xs:enumeration value=\"PROVIDE\"/>\n" +
-                "   <xs:enumeration value=\"MODIFY\"/>\n" +
-                "   <xs:enumeration value=\"CEASE\"/>\n" +
-                "  </xs:restriction>\n" +
-                " </xs:simpleType>\n" +
-                "\n" +
-                " <xs:simpleType name=\"VIP_ACTION_TYPE\">\n" +
-                "  <xs:restriction base=\"ACTION_TYPE\">\n" +
-                "   <xs:enumeration value=\"QUERY\"/>\n" +
-                "  </xs:restriction>\n" +
-                " </xs:simpleType>\n" +
-                "\n" +
-                "</xs:schema>";
+    void testEnumRestrictionScomp() throws Exception {
+        String xsdAsString =
+            "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
+            "\n" +
+            "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\";>\n" +
+            "\n" +
+            " <xs:element name=\"ActionTypeElem\" type=\"ACTION_TYPE\" />\n" +
+            " <xs:element name=\"VIPActionTypeElem\" type=\"VIP_ACTION_TYPE\" 
/>\n" +
+            "\n" +
+            " <xs:simpleType name=\"ACTION_TYPE\">\n" +
+            "  <xs:restriction base=\"xs:string\">\n" +
+            "   <xs:enumeration value=\"PROVIDE\"/>\n" +
+            "   <xs:enumeration value=\"MODIFY\"/>\n" +
+            "   <xs:enumeration value=\"CEASE\"/>\n" +
+            "  </xs:restriction>\n" +
+            " </xs:simpleType>\n" +
+            "\n" +
+            " <xs:simpleType name=\"VIP_ACTION_TYPE\">\n" +
+            "  <xs:restriction base=\"ACTION_TYPE\">\n" +
+            "   <xs:enumeration value=\"QUERY\"/>\n" +
+            "  </xs:restriction>\n" +
+            " </xs:simpleType>\n" +
+            "\n" +
+            "</xs:schema>";
 
         // load schema file as SchemaDocument XmlObject
-        SchemaDocument sd = 
SchemaDocument.Factory.parse(xsdAsString.toString());
+        SchemaDocument sd = SchemaDocument.Factory.parse(xsdAsString);
 
         // compile loaded XmlObject
-        try
-        {
-        XmlOptions options = new XmlOptions();
-        List errors = new ArrayList();
-        options.setErrorListener(errors);
-        SchemaTypeSystem sts = XmlBeans.compileXsd((XmlObject[]) 
Collections.singletonList(sd).toArray(new XmlObject[]{}),
-                XmlBeans.getContextTypeLoader(),
-                options);
-        }
-
-        catch(XmlException xme)
-        {
-            System.out.println(xme.getError().getMessage());
-            
assertEquals(XmlErrorCodes.DATATYPE_ENUM_RESTRICTION,xme.getError().getErrorCode());
-        }
-        catch (NullPointerException npe)
-        {
-            fail("Null Pointer Exception thrown for invalid tyoe restriction 
attempt for Enum values");
-        }
-
+        XmlOptions validateOptions = createOptions();
+        XmlException xme = assertThrows(XmlException.class, () ->
+            XmlBeans.compileXsd(Collections.singletonList(sd).toArray(new 
XmlObject[]{}), XmlBeans.getContextTypeLoader(), validateOptions));
+        assertEquals(XmlErrorCodes.DATATYPE_ENUM_RESTRICTION, 
xme.getError().getErrorCode());
     }
 }



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

Reply via email to