Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/GroupRestrictionTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/GroupRestrictionTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/GroupRestrictionTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/GroupRestrictionTest.java
 Sun Feb  6 01:51:55 2022
@@ -15,134 +15,96 @@
 package scomp.derivation.restriction.detailed;
 
 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.groupRestriction.*;
 
 import java.math.BigInteger;
 
-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 GroupRestrictionTest extends BaseCase {
+public class GroupRestrictionTest {
 
     @Test
-    public void testRestrictSequence() throws Throwable {
-        RestrictedSequenceEltDocument doc = 
RestrictedSequenceEltDocument.Factory
-                .newInstance();
+    void testRestrictSequence() {
+        RestrictedSequenceEltDocument doc = 
RestrictedSequenceEltDocument.Factory.newInstance();
         RestrictedSequenceT elt = doc.addNewRestrictedSequenceElt();
         elt.setChild1(BigInteger.ONE);
 
         elt.addChild3(new BigInteger("10"));
         elt.addChild3(new BigInteger("10"));
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
         elt.addChild2("foobar");
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
-
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testRestrictChoice() throws Throwable {
-        RestrictedChoiceEltDocument doc = RestrictedChoiceEltDocument.Factory
-                .newInstance();
+    void testRestrictChoice() {
+        RestrictedChoiceEltDocument doc = 
RestrictedChoiceEltDocument.Factory.newInstance();
         RestrictedChoiceT elt = doc.addNewRestrictedChoiceElt();
         elt.addChild2("foobar");
         elt.addChild3(BigInteger.ZERO);
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT};
-        assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         elt.removeChild2(0);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
+        assertTrue(doc.validate(validateOptions));
     }
 
     @Test
-    public void testRestrictAll() throws Throwable {
-        RestrictedAllEltDocument doc = RestrictedAllEltDocument.Factory
-                .newInstance();
+    void testRestrictAll() {
+        RestrictedAllEltDocument doc = 
RestrictedAllEltDocument.Factory.newInstance();
         RestrictedAllT elt = doc.addNewRestrictedAllElt();
         elt.setChild2("foobar");
         //child3 can't be missing
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT
-        };
-        assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         elt.setChild3(new BigInteger("10"));
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
     }
 
     @Test
-    public void testAllToSequence() throws Throwable {
+    void testAllToSequence() {
         All2SeqEltDocument doc = All2SeqEltDocument.Factory.newInstance();
         All2SequenceT elt = doc.addNewAll2SeqElt();
         elt.setA("foo");
         elt.setC(3);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
+
         //b not part of restricted type
         elt.setB("bar");
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testChoiceToSequence() throws Throwable {
+    void testChoiceToSequence() throws Throwable {
         Choice2SeqEltDocument doc = 
Choice2SeqEltDocument.Factory.newInstance();
         Choice2SequenceT elt = doc.addNewChoice2SeqElt();
         elt.addA("foo");
         elt.addC(3);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
+
         //b not part of restricted type
         elt.addB("bar");
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/MixedContentRestriction.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/MixedContentRestriction.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/MixedContentRestriction.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/MixedContentRestriction.java
 Sun Feb  6 01:51:55 2022
@@ -14,24 +14,25 @@
  */
 package scomp.derivation.restriction.detailed;
 
-import org.junit.Test;
-import xbean.scomp.derivation.mixedContentRestriction.*;
-import scomp.common.BaseCase;
-
-import java.math.BigInteger;
-
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.impl.values.XmlValueNotSupportedException;
+import org.junit.jupiter.api.Test;
+import xbean.scomp.derivation.mixedContentRestriction.*;
+
+import java.math.BigInteger;
 
-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 MixedContentRestriction extends BaseCase{
+public class MixedContentRestriction {
     @Test
-    public void testRestrictedMixed() throws Throwable{
-        MixedEltDocument doc=MixedEltDocument.Factory.newInstance();
-        RestrictedMixedT elt=doc.addNewMixedElt();
-        assertTrue( !elt.isSetChild1());
+    void testRestrictedMixed() {
+        MixedEltDocument doc = MixedEltDocument.Factory.newInstance();
+        RestrictedMixedT elt = doc.addNewMixedElt();
+        assertFalse(elt.isSetChild1());
         elt.setChild1(new BigInteger("10"));
         elt.setChild2(BigInteger.ZERO);
         //insert text b/n the 2 elements
@@ -39,22 +40,18 @@ public class MixedContentRestriction ext
             cur.toFirstContentToken();
             assertTrue(cur.toNextSibling());
             cur.insertChars("My chars");
-
-            assertTrue( doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
         }
-        assertEquals("<xml-fragment>" +
-                "<child1>10</child1>My chars<child2>0</child2>" +
-                "</xml-fragment>", elt.xmlText());
+        assertTrue(doc.validate(createOptions()));
+
+        assertEquals("<xml-fragment><child1>10</child1>My 
chars<child2>0</child2></xml-fragment>", elt.xmlText());
     }
 
     @Test
-    public void testRestrictedEltOnly() throws Throwable{
-        ElementOnlyEltDocument 
doc=ElementOnlyEltDocument.Factory.newInstance();
-        RestrictedEltT elt=doc.addNewElementOnlyElt();
-        assertTrue( !elt.isSetChild1());
+    void testRestrictedEltOnly() throws Throwable {
+        XmlOptions validateOptions = createOptions();
+        ElementOnlyEltDocument doc = 
ElementOnlyEltDocument.Factory.newInstance();
+        RestrictedEltT elt = doc.addNewElementOnlyElt();
+        assertFalse(elt.isSetChild1());
         elt.setChild1(new BigInteger("10"));
         elt.setChild2(BigInteger.ZERO);
         //insert text b/n the 2 elements
@@ -62,57 +59,34 @@ public class MixedContentRestriction ext
             cur.toFirstContentToken();
             assertTrue(cur.toNextSibling());
             cur.insertChars("My chars");
-            assertTrue( !doc.validate(validateOptions));
-            showErrors();
-            String[] errExpected = new String[]{
-                
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_ONLY_WITH_TEXT};
-                                assertTrue(compareErrorCodes(errExpected));
+            assertFalse(doc.validate(validateOptions));
+            String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_ONLY_WITH_TEXT};
+            assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
             //should be valid w/o the Text there
             cur.toPrevToken();
-            assertEquals("<xml-fragment>" +
-                    "<child1>10</child1>My chars<child2>0</child2>" +
-                    "</xml-fragment>", elt.xmlText());
+            assertEquals("<xml-fragment><child1>10</child1>My 
chars<child2>0</child2></xml-fragment>", elt.xmlText());
             assertTrue(cur.removeXml());
-            assertTrue( doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
         }
-        assertEquals("<xml-fragment>" +
-                "<child1>10</child1><child2>0</child2>" +
-                "</xml-fragment>", elt.xmlText());
-
-
+        assertTrue(doc.validate(validateOptions));
+        
assertEquals("<xml-fragment><child1>10</child1><child2>0</child2></xml-fragment>",
 elt.xmlText());
     }
 
     //seems that this is not a valid example p.329 top
     @Test
-    public void testRestrictedMixedToEmpty() throws Throwable{
-         Mixed2EmptyEltDocument 
doc=Mixed2EmptyEltDocument.Factory.newInstance();
-         Mixed2EmptyT elt=doc.addNewMixed2EmptyElt();
-        assertEquals(null,elt.xgetChild1());
+    void testRestrictedMixedToEmpty() throws Throwable {
+        Mixed2EmptyEltDocument doc = 
Mixed2EmptyEltDocument.Factory.newInstance();
+        Mixed2EmptyT elt = doc.addNewMixed2EmptyElt();
+        assertNull(elt.xgetChild1());
 
         // ok this gets a little tricky. Due to the restriction extension, the 
setter method is now
         // 'removed'. So the schema is actually an XmlAnyType while the method 
sets it to a BigInteger.
         // This will fail irrespective of the setValidateOnset XmlOption
-        boolean vneThrown = false;
-        try
-        {
-        elt.setChild1(new BigInteger("10"));
-         assertTrue( !doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{"cvc-attribute"};
-                            assertTrue(compareErrorCodes(errExpected));
-        }
-
-        catch (XmlValueNotSupportedException vns) {
-            vneThrown = true;
-        }
-        finally {
-            if(!vneThrown)
-                fail("Expected XmlValueNotSupportedException here");
-        }
+        assertThrows(XmlValueNotSupportedException.class, () -> 
elt.setChild1(new BigInteger("10")));
 
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SimpleContentRestrictionTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SimpleContentRestrictionTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SimpleContentRestrictionTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SimpleContentRestrictionTest.java
 Sun Feb  6 01:51:55 2022
@@ -15,39 +15,35 @@
 package scomp.derivation.restriction.detailed;
 
 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.simpleExtension.SimpleRestrictionEltDocument;
 import xbean.scomp.derivation.simpleExtension.SimpleRestrictionT;
 
-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 SimpleContentRestrictionTest extends BaseCase {
+public class SimpleContentRestrictionTest {
     @Test
-    public void testLegalValues() throws Throwable {
+    void testLegalValues() throws Throwable {
         SimpleRestrictionEltDocument doc = 
SimpleRestrictionEltDocument.Factory.newInstance();
         SimpleRestrictionT elt = doc.addNewSimpleRestrictionElt();
         elt.setIntValue(3);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
     }
 
     @Test
-    public void testIllegalValues() throws Throwable {
+    void testIllegalValues() throws Throwable {
         SimpleRestrictionEltDocument doc = 
SimpleRestrictionEltDocument.Factory.newInstance();
         SimpleRestrictionT elt = doc.addNewSimpleRestrictionElt();
         elt.setIntValue(5);
 
-        assertTrue(!doc.validate(validateOptions));
+        XmlOptions validateOptions = createOptions();
 
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID
-        };
-        assertTrue(compareErrorCodes(errExpected));
+        assertFalse(doc.validate(validateOptions));
+
+        String[] errExpected = {XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SimpleTypeRestriction.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SimpleTypeRestriction.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SimpleTypeRestriction.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SimpleTypeRestriction.java
 Sun Feb  6 01:51:55 2022
@@ -16,8 +16,7 @@
 
 package scomp.derivation.restriction.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.derivation.facets.dateTimePattern.DateTimes;
 import xbean.scomp.derivation.facets.dateTimePattern.DateTimesDocument;
 import xbean.scomp.derivation.simpleTypeRestriction.SmallPantSizeEltDocument;
@@ -25,43 +24,31 @@ import xbean.scomp.derivation.simpleType
 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 SimpleTypeRestriction extends BaseCase{
+public class SimpleTypeRestriction {
 
     @Test
-    public void testPatternRestriction()throws Throwable{
+    void testPatternRestriction() throws Throwable {
         SmallPantSizeEltDocument doc = 
SmallPantSizeEltDocument.Factory.newInstance();
         doc.setSmallPantSizeElt(8);
         //doc.setSmallPantSizeElt(6);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
     }
 
     @Test
-    public void testDateTimeRestriction() throws Throwable{
-       DateTimesDocument doc=
-               DateTimesDocument.Factory.newInstance();
-        Calendar c=new GregorianCalendar(2004,8,10);
-        DateTimes date=DateTimes.Factory.newInstance();
+    void testDateTimeRestriction() throws Throwable {
+        DateTimesDocument doc = DateTimesDocument.Factory.newInstance();
+        Calendar c = new GregorianCalendar(2004, Calendar.SEPTEMBER, 10);
+        DateTimes date = DateTimes.Factory.newInstance();
         date.setExtendedDate1(c);
         date.setExtendedDate2("2004-08-10");
-        c.set(2004,8,10,12,10);
+        c.set(2004, Calendar.SEPTEMBER, 10, 12, 10);
         date.setExtendedDateTime1(c);
         date.setExtendedDateTime2(c);
         date.setExtendedDateTimeAny3(c);
 
-        System.out.println(
-                date.getExtendedDate1()+"\n"+
-                 date.getExtendedDate2()+"\n"+
-                 date.getExtendedDateTime1()+"\n"+
-                 date.getExtendedDateTime2()+"\n"+
-                 date.getExtendedDateTimeAny3()+"\n"
-        );
-
+        // TODO: add asserts
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SubstitutionTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SubstitutionTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SubstitutionTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/detailed/SubstitutionTest.java
 Sun Feb  6 01:51:55 2022
@@ -15,52 +15,40 @@
 
 package scomp.derivation.restriction.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.contentType.modelGroup.ChoiceEltDocument;
 import xbean.scomp.contentType.simpleType.PantSizeEltDocument;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static scomp.common.BaseCase.createOptions;
 
-public class SubstitutionTest extends BaseCase {
+public class SubstitutionTest {
     @Test
-    public void testSubstitution() throws Throwable{
-         ChoiceEltDocument doc=
-                ChoiceEltDocument.Factory.parse(
-                        "<foo:ChoiceElt " +
-                 "xmlns:foo=\"http://xbean/scomp/contentType/ModelGroup\""; +
-                 " 
xmlns:sub=\"http://xbean/scomp/derivation/GroupRestriction\""+
-                 " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
-                 " xsi:type=\"sub:restrictedChoiceT\">" +
-                 "<child3>50</child3>" +
-                 "</foo:ChoiceElt>"
-                );
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+    void testSubstitution() throws Throwable {
+        String input =
+            "<foo:ChoiceElt " +
+            "xmlns:foo=\"http://xbean/scomp/contentType/ModelGroup\""; +
+            " xmlns:sub=\"http://xbean/scomp/derivation/GroupRestriction\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
+            " xsi:type=\"sub:restrictedChoiceT\">" +
+            "<child3>50</child3>" +
+            "</foo:ChoiceElt>";
+        ChoiceEltDocument doc = ChoiceEltDocument.Factory.parse(input);
+        assertTrue(doc.validate(createOptions()));
     }
 
     @Test
-    public void testSimpleTypeSubstitution() throws Throwable{
-        PantSizeEltDocument doc =
-            PantSizeEltDocument.Factory.parse(
-                "<foo:PantSizeElt " +
-                    "xmlns:foo=\"http://xbean/scomp/contentType/SimpleType\""; +
-                    " 
xmlns:sub=\"http://xbean/scomp/derivation/SimpleTypeRestriction\""; +
-                    " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; 
+
-                    " xsi:type=\"sub:SmallPantSize\">" +
-                    "8" +
-                    "</foo:PantSizeElt>"
-            );
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-     }
+    void testSimpleTypeSubstitution() throws Throwable {
+        String input =
+            "<foo:PantSizeElt " +
+            "xmlns:foo=\"http://xbean/scomp/contentType/SimpleType\""; +
+            " 
xmlns:sub=\"http://xbean/scomp/derivation/SimpleTypeRestriction\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; +
+            " xsi:type=\"sub:SmallPantSize\">" +
+            "8" +
+            "</foo:PantSizeElt>";
+
+        PantSizeEltDocument doc = PantSizeEltDocument.Factory.parse(input);
+        assertTrue(doc.validate(createOptions()));
+    }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java
 Sun Feb  6 01:51:55 2022
@@ -12,11 +12,11 @@
  *   See the License for the specific language governing permissions and
  *  limitations under the License.
  */
- package scomp.derivation.restriction.facets.detailed;
+package scomp.derivation.restriction.facets.detailed;
 
 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.facets.facetRestriction.*;
 
 import java.math.BigDecimal;
@@ -24,238 +24,176 @@ import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.TimeZone;
 
-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 FacetRestrictionTest extends BaseCase {
+public class FacetRestrictionTest {
     @Test
-    public void testMinMaxInclusiveElt() throws Throwable {
-        MinMaxInclusiveEltDocument doc =
-                MinMaxInclusiveEltDocument.Factory.newInstance();
+    void testMinMaxInclusiveElt() {
+        MinMaxInclusiveEltDocument doc = 
MinMaxInclusiveEltDocument.Factory.newInstance();
         doc.setMinMaxInclusiveElt(3);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MIN_INCLUSIVE_VALID};
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
+        String[] errExpected = {XmlErrorCodes.DATATYPE_MIN_INCLUSIVE_VALID};
 
         doc.setMinMaxInclusiveElt(2);
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
-        clearErrors();
-        errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
+        validateOptions.getErrorListener().clear();
+        errExpected = new String[]{XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
         doc.setMinMaxInclusiveElt(10);
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
-
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testMinMaxInclusiveDateElt() throws Throwable {
-        MinMaxInclusiveDateEltDocument doc =
-            MinMaxInclusiveDateEltDocument.Factory.newInstance();
+    void testMinMaxInclusiveDateElt() {
+        MinMaxInclusiveDateEltDocument doc = 
MinMaxInclusiveDateEltDocument.Factory.newInstance();
         TimeZone tz = TimeZone.getDefault();
         Calendar c = new GregorianCalendar(tz);
-        c.set(2003, 11, 22);
+        c.set(2003, Calendar.DECEMBER, 22);
         doc.setMinMaxInclusiveDateElt(c);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        c = new GregorianCalendar(2003, 11, 24);
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
+        c = new GregorianCalendar(2003, Calendar.DECEMBER, 24);
         doc.setMinMaxInclusiveDateElt(c);
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        String[] errExpected = {XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testMinMaxExclusiveElt() throws Throwable {
-        MinMaxExclusiveEltDocument doc =
-            MinMaxExclusiveEltDocument.Factory.newInstance();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MIN_EXCLUSIVE_VALID};
+    void testMinMaxExclusiveElt() {
+        MinMaxExclusiveEltDocument doc = 
MinMaxExclusiveEltDocument.Factory.newInstance();
+        String[] errExpected = {XmlErrorCodes.DATATYPE_MIN_EXCLUSIVE_VALID};
 
         doc.setMinMaxExclusiveElt(3);
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
-        clearErrors();
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
+        validateOptions.getErrorListener().clear();
 
         doc.setMinMaxExclusiveElt(4);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         doc.setMinMaxExclusiveElt(8);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
+        assertTrue(doc.validate(validateOptions));
     }
 
     @Test
-    public void testMinMaxExclusiveDateElt() throws Throwable {
+    void testMinMaxExclusiveDateElt() {
         MinMaxExclusiveDateEltDocument doc = 
MinMaxExclusiveDateEltDocument.Factory.newInstance();
-        Calendar c = new GregorianCalendar(2003, 11, 24);
+        Calendar c = new GregorianCalendar(2003, Calendar.DECEMBER, 24);
         doc.setMinMaxExclusiveDateElt(c);
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_EXCLUSIVE_VALID};
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
-        clearErrors();
-        c = new GregorianCalendar(2003, 11, 23);
+        String[] errExpected = {XmlErrorCodes.DATATYPE_MAX_EXCLUSIVE_VALID};
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
+        validateOptions.getErrorListener().clear();
+        c = new GregorianCalendar(2003, Calendar.DECEMBER, 23);
         doc.setMinMaxExclusiveDateElt(c);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
     }
 
     @Test
-    public void testMinMaxLengthElt() throws Throwable {
+    void testMinMaxLengthElt() {
         MinMaxLengthEltDocument doc = 
MinMaxLengthEltDocument.Factory.newInstance();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_LENGTH_VALID$STRING};
+        String[] errExpected = 
{XmlErrorCodes.DATATYPE_MAX_LENGTH_VALID$STRING};
+        XmlOptions validateOptions = createOptions();
 
         doc.setMinMaxLengthElt("fooba");
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         doc.setMinMaxLengthElt("fo");
-        errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MIN_LENGTH_VALID$STRING};
-        clearErrors();
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        errExpected = new 
String[]{XmlErrorCodes.DATATYPE_MIN_LENGTH_VALID$STRING};
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         doc.setMinMaxLengthElt("foo");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         doc.setMinMaxLengthElt("foob");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
+        assertTrue(doc.validate(validateOptions));
     }
 
     @Test
-    public void testDigitsElt() throws Throwable {
+    void testDigitsElt() {
         DigitsEltDocument doc = DigitsEltDocument.Factory.newInstance();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_TOTAL_DIGITS_VALID};
+        String[] errExpected = {XmlErrorCodes.DATATYPE_TOTAL_DIGITS_VALID};
+        XmlOptions validateOptions = createOptions();
 
         doc.setDigitsElt(new BigDecimal("122.2"));
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         doc.setDigitsElt(new BigDecimal("12.3"));
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        clearErrors();
-        errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_FRACTION_DIGITS_VALID};
+        assertTrue(doc.validate(validateOptions));
+        validateOptions.getErrorListener().clear();
+        errExpected = new 
String[]{XmlErrorCodes.DATATYPE_FRACTION_DIGITS_VALID};
         doc.setDigitsElt(new BigDecimal("2.45"));
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testWSElt() throws Throwable {
+    void testWSElt() throws Throwable {
+        String inputReplace =
+            "<WSReplaceElt 
xmlns=\"http://xbean/scomp/derivation/facets/FacetRestriction\";>" +
+            " This is a    test.\nThe resulting string should convert tabs \t, 
line feeds \n  and carriage returns into a single space \n" +
+            "</WSReplaceElt>";
+
+        String inputCollapse =
+            "<WSCollapseElt 
xmlns=\"http://xbean/scomp/derivation/facets/FacetRestriction\";>" +
+            " This is a    test.\nThe resulting string should convert tabs \t, 
line feeds \n  and carriage returns into a single space \n" +
+            "</WSCollapseElt>";
 
         // whiteSpace="replace" case
-        WSReplaceEltDocument doc = 
WSReplaceEltDocument.Factory.parse("<WSReplaceElt " +
-                
"xmlns=\"http://xbean/scomp/derivation/facets/FacetRestriction\";>" +
-                " This is a    test.\nThe resulting string should convert tabs 
\t, line feeds \n  and carriage returns into a single space \n" +
-                "</WSReplaceElt>");
+        WSReplaceEltDocument doc = 
WSReplaceEltDocument.Factory.parse(inputReplace);
 
         // whiteSpace="collapse " case
-        WSCollapseEltDocument doc2 = 
WSCollapseEltDocument.Factory.parse("<WSCollapseElt " +
-                
"xmlns=\"http://xbean/scomp/derivation/facets/FacetRestriction\";>" +
-                " This is a    test.\nThe resulting string should convert tabs 
\t, line feeds \n  and carriage returns into a single space \n" +
-                "</WSCollapseElt>");
-
-        try {
-            assertTrue(doc.validate(validateOptions));
-            assertTrue(doc2.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        WSCollapseEltDocument doc2 = 
WSCollapseEltDocument.Factory.parse(inputCollapse);
+        XmlOptions validateOptions = createOptions();
+
+        assertTrue(doc.validate(validateOptions));
+        assertTrue(doc2.validate(validateOptions));
 
         String replaceExpected = " This is a    test. The resulting string 
should convert tabs  , line feeds    and carriage returns into a single space  
";
         assertEquals(replaceExpected, doc.getWSReplaceElt());
 
         String collapseExpected = "This is a test. The resulting string should 
convert tabs , line feeds and carriage returns into a single space";
         assertEquals(collapseExpected, doc2.getWSCollapseElt());
-
     }
 
     @Test
-    public void testEnumElt() throws Throwable {
+    void testEnumElt() throws Throwable {
         EnumEltDocument doc = EnumEltDocument.Factory.newInstance();
         doc.setEnumElt(EnumT.A);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        doc = EnumEltDocument.Factory.parse("<EnumElt " +
-            "xmlns=\"http://xbean/scomp/derivation/facets/FacetRestriction\";>" 
+
-            "b" +
-            "</EnumElt>");
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_ENUM_VALID};
 
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
+
+        doc = EnumEltDocument.Factory.parse(
+            "<EnumElt 
xmlns=\"http://xbean/scomp/derivation/facets/FacetRestriction\";>b</EnumElt>");
+        String[] errExpected = {XmlErrorCodes.DATATYPE_ENUM_VALID};
 
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testPatternElt() throws Throwable {
-
+    void testPatternElt() throws Throwable {
         // base pattern is (a[^bc]d){3}, derived pattern is (a[^ef]d){3}
         PatternEltDocument doc = PatternEltDocument.Factory.newInstance();
         doc.setPatternElt("axdaydazd");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID};
+
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
+        String[] errExpected = {XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID};
 
         doc.setPatternElt("aedafdagd");
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/FacetsTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/FacetsTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/FacetsTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/FacetsTest.java
 Sun Feb  6 01:51:55 2022
@@ -15,8 +15,9 @@
 package scomp.derivation.restriction.facets.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.facets.facets.*;
 
 import java.math.BigDecimal;
@@ -24,257 +25,180 @@ import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.TimeZone;
 
-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 FacetsTest extends BaseCase {
+public class FacetsTest {
     @Test
-    public void testMinMaxInclusiveElt() throws Throwable {
-        MinMaxInclusiveEltDocument doc =
-                MinMaxInclusiveEltDocument.Factory.newInstance();
+    void testMinMaxInclusiveElt() {
+        MinMaxInclusiveEltDocument doc = 
MinMaxInclusiveEltDocument.Factory.newInstance();
         doc.setMinMaxInclusiveElt(3);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MIN_INCLUSIVE_VALID};
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
+        String[] errExpected = {XmlErrorCodes.DATATYPE_MIN_INCLUSIVE_VALID};
 
         doc.setMinMaxInclusiveElt(1);
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
-        clearErrors();
-        errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
+        validateOptions.getErrorListener().clear();
+        errExpected = new String[]{XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
         doc.setMinMaxInclusiveElt(11);
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
-
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testMinMaxInclusiveDateElt() throws Throwable {
-        MinMaxInclusiveDateEltDocument doc =
-                MinMaxInclusiveDateEltDocument.Factory.newInstance();
+    void testMinMaxInclusiveDateElt() {
+        MinMaxInclusiveDateEltDocument doc = 
MinMaxInclusiveDateEltDocument.Factory.newInstance();
         TimeZone tz = TimeZone.getDefault();
         Calendar c = new GregorianCalendar(tz);
-        c.set(2003, 11, 24);
+        c.set(2003, Calendar.DECEMBER, 24);
         doc.setMinMaxInclusiveDateElt(c);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
         c = new GregorianCalendar(2003, 11, 28);
         doc.setMinMaxInclusiveDateElt(c);
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
-
-
+        String[] errExpected = {XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     //valid range should be 3-9
     @Test
-    public void testMinMaxExclusiveElt() throws Throwable {
-        MinMaxExclusiveEltDocument doc =
-                MinMaxExclusiveEltDocument.Factory.newInstance();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MIN_EXCLUSIVE_VALID};
+    void testMinMaxExclusiveElt() {
+        MinMaxExclusiveEltDocument doc = 
MinMaxExclusiveEltDocument.Factory.newInstance();
+        String[] errExpected = {XmlErrorCodes.DATATYPE_MIN_EXCLUSIVE_VALID};
 
         doc.setMinMaxExclusiveElt(2);
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
         doc.setMinMaxExclusiveElt(3);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        doc.setMinMaxExclusiveElt(9);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
 
+        assertTrue(doc.validate(validateOptions));
+        doc.setMinMaxExclusiveElt(9);
+        assertTrue(doc.validate(validateOptions));
     }
 
     //valid range is 12-11 12-24-2003
     @Test
-    public void testMinMaxExclusiveDateElt() throws Throwable {
+    void testMinMaxExclusiveDateElt() {
         MinMaxExclusiveDateEltDocument doc = 
MinMaxExclusiveDateEltDocument.Factory.newInstance();
-        Calendar c = new GregorianCalendar(2003, 11, 25);
+        Calendar c = new GregorianCalendar(2003, Calendar.DECEMBER, 25);
         doc.setMinMaxExclusiveDateElt(c);
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_EXCLUSIVE_VALID};
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        String[] errExpected = {XmlErrorCodes.DATATYPE_MAX_EXCLUSIVE_VALID};
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
-        c = new GregorianCalendar(2003, 11, 11);
+        c = new GregorianCalendar(2003, Calendar.DECEMBER, 11);
         doc.setMinMaxExclusiveDateElt(c);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
-
+        assertTrue(doc.validate(validateOptions));
     }
 
     @Test
-    public void testLengthElt() throws Throwable {
+    void testLengthElt() {
         LengthEltDocument doc = LengthEltDocument.Factory.newInstance();
         doc.setLengthElt("foobar");
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_LENGTH_VALID$STRING};
+        String[] errExpected = new 
String[]{XmlErrorCodes.DATATYPE_LENGTH_VALID$STRING};
 
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         doc.setLengthElt("f");
-        clearErrors();
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         doc.setLengthElt("fo");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
     }
 
     @Test
-    public void testMinMaxLengthElt() throws Throwable {
+    void testMinMaxLengthElt() {
         MinMaxLengthEltDocument doc = 
MinMaxLengthEltDocument.Factory.newInstance();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_LENGTH_VALID$STRING};
+        String[] errExpected = 
{XmlErrorCodes.DATATYPE_MAX_LENGTH_VALID$STRING};
 
         doc.setMinMaxLengthElt("foobar");
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         doc.setMinMaxLengthElt("f");
-        errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MIN_LENGTH_VALID$STRING};
-        clearErrors();
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        errExpected = new 
String[]{XmlErrorCodes.DATATYPE_MIN_LENGTH_VALID$STRING};
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         doc.setMinMaxLengthElt("fo");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         doc.setMinMaxLengthElt("fooba");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
+        assertTrue(doc.validate(validateOptions));
     }
 
     @Test
-    public void testDigitsElt() throws Throwable {
+    void testDigitsElt() {
         DigitsEltDocument doc = DigitsEltDocument.Factory.newInstance();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_TOTAL_DIGITS_VALID};
+        String[] errExpected = {XmlErrorCodes.DATATYPE_TOTAL_DIGITS_VALID};
 
         doc.setDigitsElt(new BigDecimal("234.25"));
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         doc.setDigitsElt(new BigDecimal("12.13"));
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        clearErrors();
-        errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_FRACTION_DIGITS_VALID};
+        assertTrue(doc.validate(validateOptions));
+        validateOptions.getErrorListener().clear();
+        errExpected = new 
String[]{XmlErrorCodes.DATATYPE_FRACTION_DIGITS_VALID};
         doc.setDigitsElt(new BigDecimal(".145"));
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
-
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testWSElt() throws Throwable {
-        WSPreserveEltDocument doc = 
WSPreserveEltDocument.Factory.parse("<WSPreserveElt " +
-                "xmlns=\"http://xbean/scomp/derivation/facets/Facets\";>" +
-                "This is a\ttest.\nThe resulting string should preserve all 
whitespace     tabs and carriage returns as is\n" +
-                "</WSPreserveElt>");
+    void testWSElt() throws XmlException {
+        String input =
+            "<WSPreserveElt 
xmlns=\"http://xbean/scomp/derivation/facets/Facets\";>" +
+            "This is a\ttest.\nThe resulting string should preserve all 
whitespace     tabs and carriage returns as is\n" +
+            "</WSPreserveElt>";
+        WSPreserveEltDocument doc = WSPreserveEltDocument.Factory.parse(input);
 
-
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
 
         String expected = "This is a\ttest.\nThe resulting string should 
preserve all whitespace     tabs and carriage returns as is\n";
         assertEquals(expected, doc.getWSPreserveElt());
     }
 
     @Test
-    public void testEnumElt() throws Throwable {
-
+    void testEnumElt() throws XmlException {
         EnumEltDocument doc = EnumEltDocument.Factory.newInstance();
         doc.setEnumElt(EnumT.A);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        doc = EnumEltDocument.Factory.parse("<EnumElt 
xmlns=\"http://xbean/scomp/derivation/facets/Facets\";>" +
-                "foo" +
-                "</EnumElt>");
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_ENUM_VALID};
-
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
+        doc = EnumEltDocument.Factory.parse(
+            "<EnumElt 
xmlns=\"http://xbean/scomp/derivation/facets/Facets\";>foo</EnumElt>");
+        String[] errExpected = {XmlErrorCodes.DATATYPE_ENUM_VALID};
 
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testPatternElt() throws Throwable {
+    void testPatternElt() {
         PatternEltDocument doc = PatternEltDocument.Factory.newInstance();
         doc.setPatternElt("aedaedaed");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID};
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
+        String[] errExpected = new 
String[]{XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID};
 
         doc.setPatternElt("abdadad");
-        assertTrue(!doc.validate(validateOptions));
-        assertTrue(compareErrorCodes(errExpected));
-
-
+        assertFalse(doc.validate(validateOptions));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/ListRestriction.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/ListRestriction.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/ListRestriction.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/ListRestriction.java
 Sun Feb  6 01:51:55 2022
@@ -15,66 +15,57 @@
 package scomp.derivation.restriction.facets.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.facets.list.*;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 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 ListRestriction extends BaseCase {
+public class ListRestriction {
     @Test
-    public void testLengthFacet() throws Throwable {
+    void testLengthFacet() {
         LengthEltDocument doc = LengthEltDocument.Factory.newInstance();
         List<String> vals = new ArrayList<>();
         vals.add("lstsmall");
 
         doc.setLengthElt(vals);
         //this should be too short
+        XmlOptions validateOptions = createOptions();
         assertFalse(doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_LENGTH_VALID$LIST_LENGTH};
-        assertTrue(compareErrorCodes(errExpected));
+        String[] errExpected = 
{XmlErrorCodes.DATATYPE_LENGTH_VALID$LIST_LENGTH};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         vals.add("lstsmall");
         doc.setLengthElt(vals);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         //this should be too long
         vals.add("lstsmall");
         doc.setLengthElt(vals);
-        clearErrors();
+        validateOptions.getErrorListener().clear();
         assertFalse(doc.validate(validateOptions));
-        showErrors();
-        errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_LENGTH_VALID$LIST_LENGTH
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
+        errExpected = new 
String[]{XmlErrorCodes.DATATYPE_LENGTH_VALID$LIST_LENGTH};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testMinLengthFacet() throws Throwable {
+    void testMinLengthFacet() throws Throwable {
         String input =
-                "<MinLengthElt 
xmlns=\"http://xbean/scomp/derivation/facets/List\";>" +
-                "lstsmall lstlarge lstsmall" +
-                "</MinLengthElt>";
+            "<MinLengthElt 
xmlns=\"http://xbean/scomp/derivation/facets/List\";>" +
+            "lstsmall lstlarge lstsmall" +
+            "</MinLengthElt>";
         MinLengthEltDocument doc = MinLengthEltDocument.Factory.parse(input);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
 
         List vals = doc.getMinLengthElt();
         assertEquals(3, vals.size());
@@ -84,34 +75,26 @@ public class ListRestriction extends Bas
         assertEquals(1, newvals.size());
 
         doc.setMinLengthElt(newvals);
-        assertEquals(doc.getMinLengthElt().size(),
-                doc.xgetMinLengthElt().getListValue().size());
+        assertEquals(doc.getMinLengthElt().size(), 
doc.xgetMinLengthElt().getListValue().size());
         assertEquals(1, doc.xgetMinLengthElt().getListValue().size());
 
-        assertEquals("lstlarge",
-                (String) doc.xgetMinLengthElt().getListValue().get(0));
+        assertEquals("lstlarge", (String) 
doc.xgetMinLengthElt().getListValue().get(0));
         assertFalse(doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_LENGTH_VALID$LIST_LENGTH
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
-
+        String[] errExpected = 
{XmlErrorCodes.DATATYPE_LENGTH_VALID$LIST_LENGTH};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testMaxLengthFacet() throws Throwable {
+    void testMaxLengthFacet() throws XmlException {
         String input =
-                "<MaxLengthElt 
xmlns=\"http://xbean/scomp/derivation/facets/List\";>" +
-                "lstsmall lstlarge lstsmall" +
-                "</MaxLengthElt>";
+            "<MaxLengthElt 
xmlns=\"http://xbean/scomp/derivation/facets/List\";>" +
+            "lstsmall lstlarge lstsmall" +
+            "</MaxLengthElt>";
         MaxLengthEltDocument doc = MaxLengthEltDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
         assertFalse(doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_LENGTH_VALID$LIST_LENGTH};
-        assertTrue(compareErrorCodes(errExpected));
+        String[] errExpected = 
{XmlErrorCodes.DATATYPE_LENGTH_VALID$LIST_LENGTH};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         MaxLengthFacet elt = MaxLengthFacet.Factory.newInstance();
         List<String> vals = new ArrayList<>();
@@ -120,72 +103,43 @@ public class ListRestriction extends Bas
         //why is there no xsetListValue method here?
         elt.setListValue(vals);
         doc.xsetMaxLengthElt(elt);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
     }
 
     /**
      * Walmsley, p. 215...
      */
     @Test
-    public void testEnum() throws Throwable {
+    void testEnum() {
         EnumEltDocument doc = EnumEltDocument.Factory.newInstance();
-        List<Object> vals = new ArrayList<>();
-        vals.add("small");
-        vals.add("medium");
-        vals.add("large");
+        List<Object> vals = new ArrayList<>(Arrays.asList("small", "medium", 
"large"));
+
         doc.setEnumElt(vals);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
         vals.clear();
         vals.add(2);
         vals.add(3);
         vals.add(1);
         doc.setEnumElt(vals);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
 
         vals.clear();
         vals.add("small");
         vals.add(10);
         doc.setEnumElt(vals);
         assertFalse(doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_VALID$UNION
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
+        String[] errExpected = {XmlErrorCodes.DATATYPE_VALID$UNION};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testPattern() throws Throwable {
+    void testPattern() {
         PatternEltDocument doc = PatternEltDocument.Factory.newInstance();
-        List<Integer> vals = new ArrayList<>();
-        vals.add(152);
-        vals.add(154);
-        vals.add(156);
-        vals.add(918);
+        List<Integer> vals = Arrays.asList(152, 154, 156, 918, 342);
 
-        vals.add(342);
         doc.setPatternElt(vals);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/UnionRestriction.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/UnionRestriction.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/UnionRestriction.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/restriction/facets/detailed/UnionRestriction.java
 Sun Feb  6 01:51:55 2022
@@ -16,90 +16,56 @@
 package scomp.derivation.restriction.facets.detailed;
 
 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.facets.union.SmallEnumUnion;
 import xbean.scomp.derivation.facets.union.SmallPatternUnion;
 import xbean.scomp.derivation.facets.union.UnionEnumEltDocument;
 import xbean.scomp.derivation.facets.union.UnionPatternEltDocument;
 
-import static org.junit.Assert.assertFalse;
-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;
 
 /**
  * Only pattern and enumeration restrictions possible
  * Compile time tests for the rest
  */
-public class UnionRestriction extends BaseCase {
+public class UnionRestriction {
 
     @Test
-    public void testPatternRestriction() throws Throwable {
-        UnionPatternEltDocument doc =
-                UnionPatternEltDocument.Factory.newInstance();
+    void testPatternRestriction() {
+        UnionPatternEltDocument doc = 
UnionPatternEltDocument.Factory.newInstance();
         doc.setUnionPatternElt("small");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
         doc.setUnionPatternElt(1);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         SmallPatternUnion elt = SmallPatternUnion.Factory.newInstance();
         elt.setObjectValue(2);
         doc.xsetUnionPatternElt(elt);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         doc.setUnionPatternElt(-1);
         assertFalse(doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID
-        };
-        assertTrue(compareErrorCodes(errExpected));
+        String[] errExpected = {XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testEnumRestriction() throws Throwable {
+    void testEnumRestriction() {
         UnionEnumEltDocument doc = UnionEnumEltDocument.Factory.newInstance();
         doc.setUnionEnumElt("small");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
         doc.setUnionEnumElt(1);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         SmallEnumUnion elt = SmallEnumUnion.Factory.newInstance();
         elt.setObjectValue(-1);
         doc.xsetUnionEnumElt(elt);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         doc.setUnionEnumElt(2);
         assertFalse(doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_ENUM_VALID
-        };
-        assertTrue(compareErrorCodes(errExpected));
+        String[] errExpected = {XmlErrorCodes.DATATYPE_ENUM_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 }

Modified: xmlbeans/trunk/src/test/java/scomp/elements/detailed/AnyTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/elements/detailed/AnyTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/scomp/elements/detailed/AnyTest.java (original)
+++ xmlbeans/trunk/src/test/java/scomp/elements/detailed/AnyTest.java Sun Feb  
6 01:51:55 2022
@@ -14,23 +14,24 @@
  */
 package scomp.elements.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.apache.xmlbeans.XmlDate;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlString;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.element.any.AnyEltDocument;
 import xbean.scomp.element.any.AnySimpleDocument;
 import xbean.scomp.substGroup.wide.BusinessShirtType;
-import org.apache.xmlbeans.XmlString;
-import org.apache.xmlbeans.XmlDate;
 
 import java.math.BigInteger;
+import java.util.Calendar;
 import java.util.GregorianCalendar;
 
-import static org.junit.Assert.assertTrue;
-
-public class AnyTest extends BaseCase {
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static scomp.common.BaseCase.createOptions;
 
+public class AnyTest {
     @Test
-    public void testAny() throws Throwable {
+    void testAny() throws Throwable {
         AnyEltDocument doc = AnyEltDocument.Factory.newInstance();
         BusinessShirtType bst = BusinessShirtType.Factory.newInstance();
         bst.setName("shirt");
@@ -38,53 +39,30 @@ public class AnyTest extends BaseCase {
         bst.setColor("white");
         bst.setSize(new BigInteger("10"));
         doc.setAnyElt(bst);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-        clearErrors();
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
+        validateOptions.getErrorListener().clear();
 
         doc = AnyEltDocument.Factory.newInstance();
         XmlString val = XmlString.Factory.newInstance();
         val.setStringValue("foobar");
         doc.setAnyElt(val);
 
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
     }
 
     @Test
-    public void testAnySimple() throws Throwable {
-        AnySimpleDocument doc =
-                AnySimpleDocument.Factory.newInstance();
+    void testAnySimple() throws Throwable {
+        AnySimpleDocument doc = AnySimpleDocument.Factory.newInstance();
         XmlString str = XmlString.Factory.newInstance();
         str.setStringValue("foobar");
         doc.setAnySimple(str);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
         XmlDate date = XmlDate.Factory.newInstance();
-        date.setCalendarValue(new GregorianCalendar(2004, 8, 12));
+        date.setCalendarValue(new GregorianCalendar(2004, Calendar.SEPTEMBER, 
12));
         doc.setAnySimple(date);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
     }
 
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltDefault.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltDefault.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltDefault.java 
(original)
+++ xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltDefault.java 
Sun Feb  6 01:51:55 2022
@@ -15,48 +15,29 @@
 
 package scomp.elements.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.element.globalEltDefault.GlobalEltDefaultIntDocument;
 import xbean.scomp.element.globalEltDefault.GlobalEltDefaultStrDocument;
 
-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;
 
-public class GlobalEltDefault extends BaseCase {
+public class GlobalEltDefault {
     //empty string is OK considered , so default value is ignored
     @Test
-    public void testStringType() throws Throwable {
-        GlobalEltDefaultStrDocument testDoc = GlobalEltDefaultStrDocument
-            .Factory.newInstance();
-        assertEquals(null, testDoc.getGlobalEltDefaultStr());
-/*try{
-    assertTrue(testDoc.validate(validateOptions));
-}catch(Throwable t){
-    showErrors();
-    throw t;
-} */
+    void testStringType() throws Throwable {
+        GlobalEltDefaultStrDocument testDoc = 
GlobalEltDefaultStrDocument.Factory.newInstance();
+        assertNull(testDoc.getGlobalEltDefaultStr());
         testDoc.setGlobalEltDefaultStr("foo");
-        try {
-            assertTrue(testDoc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
+        assertTrue(testDoc.validate(createOptions()));
     }
 
     //default value is used
     @Test
-    public void testIntType() throws Throwable {
+    void testIntType() throws Throwable {
         GlobalEltDefaultIntDocument testDoc = 
GlobalEltDefaultIntDocument.Factory.newInstance();
         assertEquals(0, testDoc.getGlobalEltDefaultInt());
         testDoc.setGlobalEltDefaultInt(5);
-        try {
-            assertTrue(testDoc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(testDoc.validate(createOptions()));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltFixed.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltFixed.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltFixed.java 
(original)
+++ xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltFixed.java 
Sun Feb  6 01:51:55 2022
@@ -15,24 +15,23 @@
 
 package scomp.elements.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlOptions;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.element.globalEltFixed.GlobalEltFixedIntDocument;
 import xbean.scomp.element.globalEltFixed.GlobalEltFixedStrDocument;
-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 GlobalEltFixed extends BaseCase {
+public class GlobalEltFixed {
     @Test
-    public void testValidPresent() throws Exception {
-        GlobalEltFixedIntDocument testEltInt = 
GlobalEltFixedIntDocument.Factory.parse("<GlobalEltFixedInt " +
-                "xmlns=\"http://xbean/scomp/element/GlobalEltFixed\""; +
-                "> +01 </GlobalEltFixedInt>");
-        GlobalEltFixedStrDocument testEltStr = 
GlobalEltFixedStrDocument.Factory.parse("<GlobalEltFixedStr " +
-                "xmlns=\"http://xbean/scomp/element/GlobalEltFixed\""; +
-                ">XBean</GlobalEltFixedStr>");
+    void testValidPresent() throws Exception {
+        GlobalEltFixedIntDocument testEltInt = 
GlobalEltFixedIntDocument.Factory.parse(
+            "<GlobalEltFixedInt 
xmlns=\"http://xbean/scomp/element/GlobalEltFixed\";> +01 </GlobalEltFixedInt>");
+        GlobalEltFixedStrDocument testEltStr = 
GlobalEltFixedStrDocument.Factory.parse(
+            "<GlobalEltFixedStr 
xmlns=\"http://xbean/scomp/element/GlobalEltFixed\";>XBean</GlobalEltFixedStr>");
         assertTrue(testEltInt.validate());
         assertTrue(testEltStr.validate());
     }
@@ -40,48 +39,39 @@ public class GlobalEltFixed extends Base
     //document should be valid even if the values
     // are missing
     @Test
-    public void testValidMissing() throws Exception {
-        GlobalEltFixedIntDocument testEltInt = GlobalEltFixedIntDocument
-                .Factory.parse("<GlobalEltFixedInt " +
-                "xmlns=\"http://xbean/scomp/element/GlobalEltFixed\""; +
-                "/>");
+    void testValidMissing() throws Exception {
+        GlobalEltFixedIntDocument testEltInt = 
GlobalEltFixedIntDocument.Factory.parse(
+            "<GlobalEltFixedInt 
xmlns=\"http://xbean/scomp/element/GlobalEltFixed\"/>");
         assertTrue(testEltInt.validate());
     }
 
     @Test
-    public void testIntTypeInvalid() throws Exception {
-        GlobalEltFixedIntDocument testEltInt = GlobalEltFixedIntDocument
-                .Factory.parse("<GlobalEltFixedInt " +
-                "xmlns=\"http://xbean/scomp/element/GlobalEltFixed\""; +
-                "> foobar </GlobalEltFixedInt>");
-        assertTrue(!testEltInt.validate(validateOptions));
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DECIMAL
-        };
-        assertTrue(compareErrorCodes(errExpected));
+    void testIntTypeInvalid() throws Exception {
+        GlobalEltFixedIntDocument testEltInt = 
GlobalEltFixedIntDocument.Factory.parse(
+            "<GlobalEltFixedInt 
xmlns=\"http://xbean/scomp/element/GlobalEltFixed\";> foobar 
</GlobalEltFixedInt>");
+        XmlOptions validateOptions = createOptions();
+        assertFalse(testEltInt.validate(validateOptions));
+        String[] errExpected = {XmlErrorCodes.DECIMAL};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testIntValueInvalid() throws Exception {
-        GlobalEltFixedIntDocument testEltInt = 
GlobalEltFixedIntDocument.Factory.parse("<GlobalEltFixedInt " +
-                "xmlns=\"http://xbean/scomp/element/GlobalEltFixed\""; +
-                "> -1 </GlobalEltFixedInt>");
-        assertTrue(!testEltInt.validate(validateOptions));
-        assertEquals(1, errorList.size());
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_LOCALLY_VALID$FIXED_VALID_SIMPLE_TYPE};
-        assertTrue(compareErrorCodes(errExpected));
+    void testIntValueInvalid() throws Exception {
+        GlobalEltFixedIntDocument testEltInt = 
GlobalEltFixedIntDocument.Factory.parse(
+            "<GlobalEltFixedInt 
xmlns=\"http://xbean/scomp/element/GlobalEltFixed\";> -1 </GlobalEltFixedInt>");
+        XmlOptions validateOptions = createOptions();
+        assertFalse(testEltInt.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_LOCALLY_VALID$FIXED_VALID_SIMPLE_TYPE};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testStrValueInvalid() throws Exception {
-        GlobalEltFixedStrDocument testEltStr = 
GlobalEltFixedStrDocument.Factory.parse("<GlobalEltFixedStr " +
-                "xmlns=\"http://xbean/scomp/element/GlobalEltFixed\""; +
-                "> XBean </GlobalEltFixedStr>");
-        assertTrue(!testEltStr.validate(validateOptions));
-        assertEquals(1, errorList.size());
-        String[] errExpected = new String[]{
-             XmlErrorCodes.ELEM_LOCALLY_VALID$FIXED_VALID_SIMPLE_TYPE};
-        assertTrue(compareErrorCodes(errExpected));
+    void testStrValueInvalid() throws Exception {
+        GlobalEltFixedStrDocument testEltStr = 
GlobalEltFixedStrDocument.Factory.parse(
+            "<GlobalEltFixedStr 
xmlns=\"http://xbean/scomp/element/GlobalEltFixed\";> XBean 
</GlobalEltFixedStr>");
+        XmlOptions validateOptions = createOptions();
+        assertFalse(testEltStr.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_LOCALLY_VALID$FIXED_VALID_SIMPLE_TYPE};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 }

Modified: xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltId.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltId.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltId.java 
(original)
+++ xmlbeans/trunk/src/test/java/scomp/elements/detailed/GlobalEltId.java Sun 
Feb  6 01:51:55 2022
@@ -15,23 +15,17 @@
 
 package scomp.elements.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.element.globalEltDefault.IDElementDocument;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static scomp.common.BaseCase.createOptions;
 
-public class GlobalEltId extends BaseCase{
+public class GlobalEltId {
     @Test
-    public void testRun() throws Throwable {
-        IDElementDocument doc =
-            IDElementDocument.Factory.newInstance();
+    void testRun() throws Throwable {
+        IDElementDocument doc = IDElementDocument.Factory.newInstance();
         doc.addNewIDElement().setID("IDAttr");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
     }
 }



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

Reply via email to