Modified: 
xmlbeans/trunk/src/test/java/scomp/contentType/complex/modelGroup/detailed/NestSequenceChoiceTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/contentType/complex/modelGroup/detailed/NestSequenceChoiceTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/contentType/complex/modelGroup/detailed/NestSequenceChoiceTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/contentType/complex/modelGroup/detailed/NestSequenceChoiceTest.java
 Sun Feb  6 01:51:55 2022
@@ -15,38 +15,33 @@
 package scomp.contentType.complex.modelGroup.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.contentType.modelGroup.NestedChoiceInSequenceDocument;
 import xbean.scomp.contentType.modelGroup.NestedChoiceInSequenceT;
 
-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 NestSequenceChoiceTest extends BaseCase {
+public class NestSequenceChoiceTest {
     /**
      * Choice group is optional
      */
     @Test
-    public void testChoiceMissing() throws Throwable {
-        NestedChoiceInSequenceDocument doc =
-                NestedChoiceInSequenceDocument.Factory.newInstance();
+    void testChoiceMissing() {
+        NestedChoiceInSequenceDocument doc = 
NestedChoiceInSequenceDocument.Factory.newInstance();
         NestedChoiceInSequenceT elt = doc.addNewNestedChoiceInSequence();
         elt.setChildDouble(1.3);
         elt.setChildInt(2);
         elt.setChildStr("foo");
 
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
     }
 
     @Test
-    public void testAllPresent() throws Throwable {
-        NestedChoiceInSequenceDocument doc =
-                NestedChoiceInSequenceDocument.Factory.newInstance();
+    void testAllPresent() {
+        NestedChoiceInSequenceDocument doc = 
NestedChoiceInSequenceDocument.Factory.newInstance();
         NestedChoiceInSequenceT elt = doc.addNewNestedChoiceInSequence();
         elt.setChildDouble(1.3);
         elt.setChildInt(2);
@@ -54,40 +49,26 @@ public class NestSequenceChoiceTest exte
 
         elt.setOptchildDouble(1.4);
 
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
 
         //can't have both set
         elt.setOptchildInt(2);
         elt.setOptchildStr("boo");
-        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));
 
         elt.unsetOptchildDouble();
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
+        assertTrue(doc.validate(validateOptions));
     }
 
     /**
      * Missing elt. from the sequence in the choice
      */
     @Test
-    public void testIllegal() throws Throwable {
-        NestedChoiceInSequenceDocument doc =
-                NestedChoiceInSequenceDocument.Factory.newInstance();
+    void testIllegal() throws Throwable {
+        NestedChoiceInSequenceDocument doc = 
NestedChoiceInSequenceDocument.Factory.newInstance();
         NestedChoiceInSequenceT elt = doc.addNewNestedChoiceInSequence();
         elt.setChildDouble(1.3);
         elt.setChildInt(2);
@@ -95,64 +76,54 @@ public class NestSequenceChoiceTest exte
 
         elt.setOptchildInt(2);
         //optChildStr is missing
-        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.setOptchildStr("boo");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
     }
 
     /**
      * Incorrect order in inner sequence
      */
     @Test
-    public void testIllegalOrderInner() throws Throwable {
+    void testIllegalOrderInner() throws Throwable {
         String input =
-                "<pre:NestedChoiceInSequence  " +
-                "xmlns:pre=\"http://xbean/scomp/contentType/ModelGroup\";>" +
-                "<childStr>foo</childStr>" +
-                "<childInt>3</childInt>" +
-                "<optchildInt>0</optchildInt>" +
-                "<optchildStr>foo</optchildStr>" +
-                "</pre:NestedChoiceInSequence>";
-        NestedChoiceInSequenceDocument doc =
-                NestedChoiceInSequenceDocument.Factory.parse(input);
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-       // TODO: why are there 2 different errors: just the order is swapped
-        String[] errExpected = new String[]{
+            "<pre:NestedChoiceInSequence  " +
+            "xmlns:pre=\"http://xbean/scomp/contentType/ModelGroup\";>" +
+            "<childStr>foo</childStr>" +
+            "<childInt>3</childInt>" +
+            "<optchildInt>0</optchildInt>" +
+            "<optchildStr>foo</optchildStr>" +
+            "</pre:NestedChoiceInSequence>";
+        NestedChoiceInSequenceDocument doc = 
NestedChoiceInSequenceDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        // TODO: why are there 2 different errors: just the order is swapped
+        String[] errExpected = {
             
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT,
-             XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT
+            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT
         };
-        assertTrue(compareErrorCodes(errExpected));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     /**
      * Incorrect order in outer sequence
      */
     @Test
-    public void testIllegalOrderOuter() throws Throwable {
+    void testIllegalOrderOuter() throws Throwable {
         String input =
-                "<pre:NestedChoiceInSequence  " +
-                "xmlns:pre=\"http://xbean/scomp/contentType/ModelGroup\";>" +
-                "<childInt>3</childInt>" +
-                "<childStr>foo</childStr>" +
-                "<optchildStr>foo</optchildStr>" +
-                "<optchildInt>0</optchildInt>" +
-                "</pre:NestedChoiceInSequence>";
-        NestedChoiceInSequenceDocument doc =
-                NestedChoiceInSequenceDocument.Factory.parse(input);
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
+            "<pre:NestedChoiceInSequence  " +
+            "xmlns:pre=\"http://xbean/scomp/contentType/ModelGroup\";>" +
+            "<childInt>3</childInt>" +
+            "<childStr>foo</childStr>" +
+            "<optchildStr>foo</optchildStr>" +
+            "<optchildInt>0</optchildInt>" +
+            "</pre:NestedChoiceInSequence>";
+        NestedChoiceInSequenceDocument doc = 
NestedChoiceInSequenceDocument.Factory.parse(input);
+        assertFalse(doc.validate(createOptions()));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/contentType/complex/modelGroup/detailed/SequenceTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/contentType/complex/modelGroup/detailed/SequenceTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/contentType/complex/modelGroup/detailed/SequenceTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/contentType/complex/modelGroup/detailed/SequenceTest.java
 Sun Feb  6 01:51:55 2022
@@ -15,37 +15,38 @@
 package scomp.contentType.complex.modelGroup.detailed;
 
 import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.XmlString;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.contentType.modelGroup.SequenceEltDocument;
 import xbean.scomp.contentType.modelGroup.SequenceT;
 
 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 SequenceTest extends BaseCase {
+public class SequenceTest {
 
     @Test
-    public void testWrongOrder() throws Throwable {
-        SequenceEltDocument doc = SequenceEltDocument.Factory
-                .parse("<foo:SequenceElt 
xmlns:foo=\"http://xbean/scomp/contentType/ModelGroup\";>" +
-                "<child1>1</child1>" +
-                "<child3>2</child3>" +
-                "<child2>Foobar</child2>" +
-                "</foo:SequenceElt>   ");
-
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            
XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT};
-        assertTrue(compareErrorCodes(errExpected));
+    void testWrongOrder() throws Throwable {
+        String input =
+            "<foo:SequenceElt 
xmlns:foo=\"http://xbean/scomp/contentType/ModelGroup\";>" +
+            "<child1>1</child1>" +
+            "<child3>2</child3>" +
+            "<child2>Foobar</child2>" +
+            "</foo:SequenceElt>   ";
+        SequenceEltDocument doc = SequenceEltDocument.Factory.parse(input);
+
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testWrongCardinality() {
+    void testWrongCardinality() {
         SequenceEltDocument doc = SequenceEltDocument.Factory.newInstance();
         SequenceT elt = doc.addNewSequenceElt();
         XmlString valueStr = XmlString.Factory.newInstance();
@@ -56,17 +57,15 @@ public class SequenceTest extends BaseCa
         elt.addChild3(valueInt);
         elt.setChild3Array(1, new BigInteger("10"));
         assertEquals("<xml-fragment><child3>-3</child3>" +
-                "<child3>10</child3></xml-fragment>", elt.xmlText());
-        assertTrue(!elt.validate(validateOptions));
-        assertEquals(3, errorList.size());
+                                "<child3>10</child3></xml-fragment>", 
elt.xmlText());
+        XmlOptions validateOptions = createOptions();
+        assertFalse(elt.validate(validateOptions));
 
-        showErrors();
         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
+            
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));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/BuiltInType.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/BuiltInType.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/BuiltInType.java 
(original)
+++ 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/BuiltInType.java 
Sun Feb  6 01:51:55 2022
@@ -16,8 +16,8 @@
 package scomp.contentType.simple.detailed;
 
 import org.apache.xmlbeans.*;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.contentType.builtIn.date.*;
 import xbean.scomp.contentType.builtIn.number.*;
 import xbean.scomp.contentType.builtIn.string.*;
@@ -26,49 +26,36 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.*;
 
-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 BuiltInType extends BaseCase {
+public class BuiltInType {
     /**
      * testing types String, normalizedString and token
      */
     @Test
-    public void testStringBasedTypes1() throws Throwable {
-        String[] exp = new String[]{
-            "\tLead tab,A string on\n 2 lines with 2  spaces",
-            "  2 Lead spaces,A string on\n 2 lines with 2  spaces",
-            " Lead tab,A string on  2 lines with 2  spaces",
-            "  2 Lead spaces,A string on  2 lines with 2  spaces",
-            "Lead tab,A string on 2 lines with 2 spaces",
-            "2 Lead spaces,A string on 2 lines with 2 spaces"
-        };
+    void testStringBasedTypes1() throws Throwable {
+        String[] exp = new String[]{"\tLead tab,A string on\n 2 lines with 2  
spaces", "  2 Lead spaces,A string on\n 2 lines with 2  spaces", " Lead tab,A 
string on  2 lines with 2  spaces", "  2 Lead spaces,A string on  2 lines with 
2  spaces", "Lead tab,A string on 2 lines with 2 spaces", "2 Lead spaces,A 
string on 2 lines with 2 spaces"};
         StringEltDocument doc = 
StringEltDocument.Factory.parse(buildString("StringElt", false));
+        XmlOptions validateOptions = createOptions();
         assertTrue(doc.validate(validateOptions));
-        assertEquals("<StringElt" +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/String\";>" +
-                exp[0] +
-                "</StringElt>", doc.xmlText());
+        assertEquals("<StringElt 
xmlns=\"http://xbean/scomp/contentType/builtIn/String\";>" + exp[0] + 
"</StringElt>", doc.xmlText());
 
         doc = StringEltDocument.Factory.parse(buildString("StringElt", true));
         assertTrue(doc.validate(validateOptions));
-        assertEquals(
-                exp[1]
-                , doc.getStringElt());
+        assertEquals(exp[1], doc.getStringElt());
 
-        NormalizedStringEltDocument doc1 = NormalizedStringEltDocument.Factory
-                .parse(buildString("NormalizedStringElt", false));
+        NormalizedStringEltDocument doc1 = 
NormalizedStringEltDocument.Factory.parse(buildString("NormalizedStringElt", 
false));
         assertTrue(doc.validate(validateOptions));
         assertEquals(exp[2], doc1.getNormalizedStringElt());
-        doc1 =
-                NormalizedStringEltDocument.Factory
-                .parse(buildString("NormalizedStringElt", true));
+        doc1 = 
NormalizedStringEltDocument.Factory.parse(buildString("NormalizedStringElt", 
true));
         assertTrue(doc1.validate(validateOptions));
-        assertEquals(
-                exp[3] , doc1.getNormalizedStringElt());
+        assertEquals(exp[3], doc1.getNormalizedStringElt());
 
         TokenEltDocument doc2 = 
TokenEltDocument.Factory.parse(buildString("TokenElt", false));
         assertTrue(doc2.validate(validateOptions));
-        assertEquals(exp[4] , doc2.getTokenElt());
+        assertEquals(exp[4], doc2.getTokenElt());
         doc2 = TokenEltDocument.Factory.parse(buildString("TokenElt", true));
         assertTrue(doc2.validate(validateOptions));
         assertEquals(exp[5], doc2.getTokenElt());
@@ -78,7 +65,8 @@ public class BuiltInType extends BaseCas
      * testing types Name, NCName, Language
      */
     @Test
-    public void testStringBasedTypes2() {
+    void testStringBasedTypes2() {
+        XmlOptions validateOptions = createOptions();
         NameEltDocument nameDoc = NameEltDocument.Factory.newInstance();
         nameDoc.setNameElt("_eltName");
         assertTrue(nameDoc.validate(validateOptions));
@@ -87,23 +75,17 @@ public class BuiltInType extends BaseCas
         XmlName str = XmlName.Factory.newInstance();
         str.setStringValue("-eltName");
         nameDoc.xsetNameElt(str);
-        assertTrue(!nameDoc.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID
-        };
-        assertTrue(compareErrorCodes(errExpected));
+        assertFalse(nameDoc.validate(validateOptions));
+        String[] errExpected = {XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
 
         NCNameEltDocument ncNameDoc = NCNameEltDocument.Factory.newInstance();
         ncNameDoc.setNCNameElt(":eltName");
-        clearErrors();
-        assertTrue(!ncNameDoc.validate(validateOptions));
-        showErrors();
-        errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID
-        };
-        assertTrue(compareErrorCodes(errExpected));
+        validateOptions.getErrorListener().clear();
+        assertFalse(ncNameDoc.validate(validateOptions));
+        errExpected = new String[]{XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         XmlNCName ncn = XmlNCName.Factory.newInstance();
         ncn.setStringValue("_elt.Name");
@@ -116,246 +98,196 @@ public class BuiltInType extends BaseCas
 
         langDoc.setLanguageElt("en-US");
         assertTrue(langDoc.validate(validateOptions));
-        clearErrors();
-        langDoc.setLanguageElt("bulgarian");
-        assertTrue(!langDoc.validate(validateOptions));
-        showErrors();
-        errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
+        validateOptions.getErrorListener().clear();
 
+        langDoc.setLanguageElt("bulgarian");
+        assertFalse(langDoc.validate(validateOptions));
+        errExpected = new String[]{XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     private String buildString(String Elt, boolean leadSpace) {
         StringBuilder sb = new StringBuilder();
         sb.append("<" + Elt);
         sb.append(" xmlns=\"http://xbean/scomp/contentType/builtIn/String\";>");
-        if (leadSpace)
+        if (leadSpace) {
             sb.append("  2 Lead spaces,A string on\n 2 lines with 2  spaces");
-        else
+        } else {
             sb.append("\tLead tab,A string on\n 2 lines with 2  spaces");
+        }
         sb.append("</" + Elt + ">");
         return sb.toString();
     }
 
     @Test
-    public void testNumericypes() throws Throwable {
-        FloatEltDocument flDoc =
-                FloatEltDocument
-                .Factory.parse("<FloatElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">12.34e+5</FloatElt>");
+    void testNumericypes() throws Throwable {
+        String input = "<FloatElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>12.34e+5</FloatElt>";
+        FloatEltDocument flDoc = FloatEltDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
         assertTrue(flDoc.validate(validateOptions));
         flDoc.setFloatElt(13.5f);
         assertEquals(13.5f, flDoc.getFloatElt(), 0.0);
 
-        DoubleEltDocument doubDoc =
-                DoubleEltDocument.Factory.newInstance();
+        DoubleEltDocument doubDoc = DoubleEltDocument.Factory.newInstance();
         assertEquals(0, doubDoc.getDoubleElt(), 0.0);
         XmlDouble val = XmlDouble.Factory.newInstance();
         val.setDoubleValue(13.4d);
         doubDoc.xsetDoubleElt(val);
         assertTrue(doubDoc.validate(validateOptions));
 
-        DecimalEltDocument decDoc =
-                DecimalEltDocument.Factory.parse("<DecimalElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">12.34</DecimalElt>");
+        input = "<DecimalElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>12.34</DecimalElt>";
+        DecimalEltDocument decDoc = DecimalEltDocument.Factory.parse(input);
         assertTrue(decDoc.validate(validateOptions));
         BigDecimal bdval = new BigDecimal(new BigInteger("10"));
         decDoc.setDecimalElt(bdval);
-        assertSame(bdval, decDoc.getDecimalElt());
+        Assertions.assertSame(bdval, decDoc.getDecimalElt());
 
-        IntegerEltDocument integerDoc =
-                IntegerEltDocument.Factory.parse("<IntegerElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">124353</IntegerElt>");
+        input = "<IntegerElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>124353</IntegerElt>";
+        IntegerEltDocument integerDoc = 
IntegerEltDocument.Factory.parse(input);
         assertTrue(decDoc.validate(validateOptions));
         integerDoc.setIntegerElt(BigInteger.ONE);
-        assertSame(BigInteger.ONE, integerDoc.getIntegerElt());
+        Assertions.assertSame(BigInteger.ONE, integerDoc.getIntegerElt());
 
-        LongEltDocument longDoc =
-                LongEltDocument.Factory.newInstance();
+        LongEltDocument longDoc = LongEltDocument.Factory.newInstance();
         longDoc.setLongElt(2459871);
         assertTrue(longDoc.validate(validateOptions));
 
-        IntEltDocument intDoc = IntEltDocument.Factory.parse("<IntElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                "> -2147483648 </IntElt>");
+        input = "<IntElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";> -2147483648 </IntElt>";
+        IntEltDocument intDoc = IntEltDocument.Factory.parse(input);
         assertTrue(intDoc.validate(validateOptions));
         intDoc.setIntElt(2147483647);
         assertTrue(intDoc.validate(validateOptions));
-        /**
-         * short is derived from int by
-         * setting the value of maxInclusive
-         * to be 32767 and minInclusive to be -32768.
-         */
-        ShortEltDocument shDoc = ShortEltDocument.Factory.parse("<ShortElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">-32768</ShortElt>");
+        // short is derived from int by
+        // setting the value of maxInclusive
+        // to be 32767 and minInclusive to be -32768.
+        input = "<ShortElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>-32768</ShortElt>";
+        ShortEltDocument shDoc = ShortEltDocument.Factory.parse(input);
         assertTrue(shDoc.validate(validateOptions));
         assertEquals(-32768, shDoc.xgetShortElt().getShortValue());
         //largest short is 32767. Don't use set--it would wrap around
-        shDoc = ShortEltDocument.Factory.parse("<ShortElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">32768</ShortElt>");
-        assertTrue(!shDoc.validate(validateOptions));
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID
-        };
-        assertTrue(compareErrorCodes(errExpected));
+        input = "<ShortElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>32768</ShortElt>";
+        shDoc = ShortEltDocument.Factory.parse(input);
+        assertFalse(shDoc.validate(validateOptions));
+        String[] errExpected = new 
String[]{XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
 
         ByteEltDocument byteDoc = ByteEltDocument.Factory.newInstance();
         byteDoc.setByteElt((byte) -128);
         assertTrue(byteDoc.validate(validateOptions));
-        byteDoc = ByteEltDocument.Factory.parse("<ByteElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">128</ByteElt>");
-
-        clearErrors();
-        assertTrue(!byteDoc.validate(validateOptions));
-        showErrors();
-        errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
-        NonPosIntEltDocument nonposIntDoc =
-                NonPosIntEltDocument.Factory.parse("<NonPosIntElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">-0000000</NonPosIntElt>");
+        input = "<ByteElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>128</ByteElt>";
+        byteDoc = ByteEltDocument.Factory.parse(input);
+
+        validateOptions.getErrorListener().clear();
+        assertFalse(byteDoc.validate(validateOptions));
+        errExpected = new String[]{XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
+
+        input = "<NonPosIntElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>-0000000</NonPosIntElt>";
+        NonPosIntEltDocument nonposIntDoc = 
NonPosIntEltDocument.Factory.parse(input);
         assertEquals(0, nonposIntDoc.getNonPosIntElt().intValue());
         assertTrue(nonposIntDoc.validate(validateOptions));
         //should be valid but javac complains is setter is called
-        nonposIntDoc =
-                NonPosIntEltDocument.Factory.parse("<NonPosIntElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">-12678967543233</NonPosIntElt>");
+        input = "<NonPosIntElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>-12678967543233</NonPosIntElt>";
+        nonposIntDoc = NonPosIntEltDocument.Factory.parse(input);
         assertTrue(nonposIntDoc.validate(validateOptions));
 
-        NegativeIntEltDocument negIntDoc =
-                NegativeIntEltDocument.Factory.parse("<NegativeIntElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">-12678967543233</NegativeIntElt>");
+        input = "<NegativeIntElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>-12678967543233</NegativeIntElt>";
+        NegativeIntEltDocument negIntDoc = 
NegativeIntEltDocument.Factory.parse(input);
         assertTrue(negIntDoc.validate(validateOptions));
 
-        NonNegIntEltDocument nonnegIntDoc =
-                NonNegIntEltDocument.Factory.parse("<NonNegIntElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">12678967543233</NonNegIntElt>");
+        input = "<NonNegIntElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>12678967543233</NonNegIntElt>";
+        NonNegIntEltDocument nonnegIntDoc = 
NonNegIntEltDocument.Factory.parse(input);
         assertTrue(nonnegIntDoc.validate(validateOptions));
 
-        UnsignedLongEltDocument uLongDoc =
-                UnsignedLongEltDocument.Factory.parse("<UnsignedLongElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">18446744073709551615</UnsignedLongElt>");
-        assertTrue(nonnegIntDoc.validate(validateOptions));
+        input = "<UnsignedLongElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>18446744073709551615</UnsignedLongElt>";
+        UnsignedLongEltDocument uLongDoc = 
UnsignedLongEltDocument.Factory.parse(input);
+        assertTrue(uLongDoc.validate(validateOptions));
 
-        UnsignedIntEltDocument uInt =
-                UnsignedIntEltDocument.Factory.parse("<UnsignedIntElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">4294967295</UnsignedIntElt>");
+        input = "<UnsignedIntElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>4294967295</UnsignedIntElt>";
+        UnsignedIntEltDocument uInt = 
UnsignedIntEltDocument.Factory.parse(input);
         assertTrue(uInt.validate(validateOptions));
 
-        UnsignedShortEltDocument uShort =
-                UnsignedShortEltDocument.Factory.parse("<UnsignedShortElt " +
-                " xmlns=\"http://xbean/scomp/contentType/builtIn/Number\""; +
-                ">65535</UnsignedShortElt>");
+        input = "<UnsignedShortElt  
xmlns=\"http://xbean/scomp/contentType/builtIn/Number\";>65535</UnsignedShortElt>";
+        UnsignedShortEltDocument uShort = 
UnsignedShortEltDocument.Factory.parse(input);
 
         assertTrue(uShort.validate(validateOptions));
 
-        UnsignedByteEltDocument uByte =
-                UnsignedByteEltDocument.Factory.newInstance();
+        UnsignedByteEltDocument uByte = 
UnsignedByteEltDocument.Factory.newInstance();
         uByte.setUnsignedByteElt((short) 255);
         assertTrue(uByte.validate(validateOptions));
-
     }
 
     @Test
-    public void testDateTime() throws Throwable {
-        DateEltDocument date =
-                DateEltDocument.Factory.newInstance();
+    void testDateTime() throws Throwable {
+        DateEltDocument date = DateEltDocument.Factory.newInstance();
 
         date.setDateElt(getCalendar());
+        XmlOptions validateOptions = createOptions();
         assertTrue(date.validate(validateOptions));
 
-        TimeEltDocument time = TimeEltDocument.Factory.parse("<TimeElt 
xmlns=\"http://xbean/scomp/contentType/builtIn/Date\";>" +
-                "23:56:00</TimeElt>");
+        String input = "<TimeElt 
xmlns=\"http://xbean/scomp/contentType/builtIn/Date\";>23:56:00</TimeElt>";
+        TimeEltDocument time = TimeEltDocument.Factory.parse(input);
         assertTrue(time.validate(validateOptions));
 
-        DateTimeEltDocument
-                dateTime = DateTimeEltDocument.Factory.newInstance();
+        DateTimeEltDocument dateTime = 
DateTimeEltDocument.Factory.newInstance();
         dateTime.setDateTimeElt(getCalendar());
         assertTrue(date.validate(validateOptions));
 
-        GYearEltDocument
-                year = GYearEltDocument.Factory.parse("<gYearElt 
xmlns=\"http://xbean/scomp/contentType/builtIn/Date\";>" +
-                "2004</gYearElt>");
+        input = "<gYearElt 
xmlns=\"http://xbean/scomp/contentType/builtIn/Date\";>2004</gYearElt>";
+        GYearEltDocument year = GYearEltDocument.Factory.parse(input);
         assertTrue(year.validate(validateOptions));
 
-        GYearMonthEltDocument yrmo =
-                GYearMonthEltDocument.Factory.newInstance();
+        GYearMonthEltDocument yrmo = 
GYearMonthEltDocument.Factory.newInstance();
         XmlGYearMonth val = XmlGYearMonth.Factory.newInstance();
         GDate dt = new GDate(getCalendar());
         val.setGDateValue(dt);
         yrmo.xsetGYearMonthElt(val);
         assertTrue(yrmo.validate(validateOptions));
 
-        GMonthEltDocument mo =
-                GMonthEltDocument.Factory.newInstance();
+        GMonthEltDocument mo = GMonthEltDocument.Factory.newInstance();
         Calendar c = getCalendar();
-        c.set(1997, 10, 06);
+        c.set(1997, Calendar.NOVEMBER, 6);
         mo.setGMonthElt(c);
         assertTrue(mo.validate(validateOptions));
 
-        GMonthDayEltDocument moday =
-                GMonthDayEltDocument.Factory.newInstance();
+        GMonthDayEltDocument moday = 
GMonthDayEltDocument.Factory.newInstance();
         moday.setGMonthDayElt(getCalendar());
         assertTrue(moday.validate(validateOptions));
 
-        GDayEltDocument day = GDayEltDocument.Factory.parse("<gDayElt 
xmlns=\"http://xbean/scomp/contentType/builtIn/Date\";>" +
-                "32</gDayElt>");
-        assertTrue(!day.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATE
-        };
-        assertTrue(compareErrorCodes(errExpected));
+        input = "<gDayElt 
xmlns=\"http://xbean/scomp/contentType/builtIn/Date\";>32</gDayElt>";
+        GDayEltDocument day = GDayEltDocument.Factory.parse(input);
+        assertFalse(day.validate(validateOptions));
+
+        String[] errExpected = {XmlErrorCodes.DATE};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         day.setGDayElt(c);
         assertTrue(day.validate(validateOptions));
 
-
-        DurationEltDocument duration =
-                DurationEltDocument.Factory.newInstance();
+        DurationEltDocument duration = 
DurationEltDocument.Factory.newInstance();
         GDurationBuilder gdb = new GDurationBuilder();
         gdb.setDay(11);
         gdb.setMonth(5);
         gdb.setYear(2004);
         duration.setDurationElt(new GDuration(gdb));
         assertTrue(duration.validate(validateOptions));
-
     }
 
-    private Calendar getCalendar() {
-// get the supported ids for GMT-08:00 (Pacific Standard Time)
+    private static Calendar getCalendar() {
+        // get the supported ids for GMT-08:00 (Pacific Standard Time)
         String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
         // if no ids were returned, something is wrong. get out.
-        if (ids.length == 0)
+        if (ids.length == 0) {
             return null;
-
+        }
 
         // create a Pacific Standard Time time zone
         SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
 
         // set up rules for daylight savings time
-        pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY,
-                2 * 60 * 60 * 1000);
-        pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY,
-                2 * 60 * 60 * 1000);
+        pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 
1000);
+        pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 
1000);
 
         // create a GregorianCalendar with the Pacific Daylight time zone
         // and the current date and time

Modified: 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/ListType.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/ListType.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/ListType.java 
(original)
+++ 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/ListType.java 
Sun Feb  6 01:51:55 2022
@@ -16,158 +16,104 @@
 package scomp.contentType.simple.detailed;
 
 import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.XmlSimpleList;
 import org.apache.xmlbeans.impl.values.XmlValueNotSupportedException;
 import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
-import org.junit.Ignore;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.contentType.list.*;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.LinkedList;
 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 ListType extends BaseCase {
+public class ListType {
     @Test
-    public void testListTypeAnonymous() throws Throwable {
-        ListEltTokenDocument doc =
-                ListEltTokenDocument.Factory.newInstance();
+    void testListTypeAnonymous() throws Throwable {
+        ListEltTokenDocument doc = ListEltTokenDocument.Factory.newInstance();
         assertNull(doc.getListEltToken());
         List<Object> values = new LinkedList<>();
         values.add("lstsmall");
         values.add("lstmedium");
         doc.setListEltToken(values);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
         values.set(0, 4);
 
         // since the list has enumerations, it contains a fixed number of Java 
constants in the xobj
         // which are checked for types and an exception is expected 
irrespective of validateOnSet XmlOption
         // if the value being set is not one of them
-        boolean vneThrown = false;
-        try{
-        doc.setListEltToken(values);
-        }
-        catch(XmlValueNotSupportedException vne){
-            vneThrown = true;
-        }
-        finally{
-            if(!vneThrown)
-                fail("Expected XmlValueOutOfRangeException here");
-        }
-
+        assertThrows(XmlValueNotSupportedException.class, () -> 
doc.setListEltToken(values));
     }
 
     @Test
-    public void testListTypeGlobal() throws Throwable {
+    void testListTypeGlobal() throws Throwable {
         String input =
-                "<ListEltInt xmlns=\"http://xbean/scomp/contentType/List\""; +
-                " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; >" +
-                "-1 -3" +
-                "</ListEltInt>";
-        ListEltIntDocument doc =
-                ListEltIntDocument.Factory.parse(input);
+            "<ListEltInt xmlns=\"http://xbean/scomp/contentType/List\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; >" +
+            "-1 -3" +
+            "</ListEltInt>";
+        ListEltIntDocument doc = ListEltIntDocument.Factory.parse(input);
         List result = doc.getListEltInt();
         assertEquals(-1, ((Integer) result.get(0)).intValue());
         assertEquals(-3, ((Integer) result.get(1)).intValue());
         GlobalSimpleT gst = GlobalSimpleT.Factory.newInstance();
-        try {
-            result.set(0, "foobar");
-        }
-        catch (UnsupportedOperationException e) {
-            //immutable list
-            assertTrue(result instanceof XmlSimpleList);
-        }
+        assertTrue(result instanceof XmlSimpleList);
+        // immutable list
+        assertThrows(UnsupportedOperationException.class, () -> result.set(0, 
"foobar"));
+
         List<String> arrayList = new ArrayList<>();
         arrayList.add("foobar");
         List<String> newList = new XmlSimpleList<>(arrayList);
         assertThrows(XmlValueOutOfRangeException.class, () -> 
gst.setListValue(newList));
         doc.xsetListEltInt(gst);
-         try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
     }
 
-    @Ignore
+    @Disabled
     public void testListofLists() {
         //also,a list of union that contains a list is not OK
-        fail("Compile Time eror");
+        Assertions.fail("Compile Time eror");
     }
 
     /**
      * values should be in [small,medium,large,1-3,-3,-2,-1]
      */
     @Test
-    public void testListofUnions() throws Throwable {
-        ListUnionDocument doc =
-                ListUnionDocument.Factory.newInstance();
-        List<Object> arrayList = new ArrayList<>();
-        arrayList.add("small");
-        arrayList.add("large");
-        arrayList.add(-1);
-        arrayList.add(2);
+    void testListofUnions() throws Throwable {
+        ListUnionDocument doc = ListUnionDocument.Factory.newInstance();
+        List<Object> arrayList = Arrays.asList("small", "large", -1, 2);
         doc.setListUnion(arrayList);
-
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
     }
 
     @Test
-    public void testListofUnionsIllegal() throws Throwable {
+    void testListofUnionsIllegal() throws Throwable {
         String input =
-                "<ListUnion xmlns=\"http://xbean/scomp/contentType/List\""; +
-                " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; >" +
-                "small -3 11" +
-                "</ListUnion>";
-        ListUnionDocument doc =
-                ListUnionDocument.Factory.parse(input);
+            "<ListUnion xmlns=\"http://xbean/scomp/contentType/List\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; >" +
+            "small -3 11" +
+            "</ListUnion>";
+        ListUnionDocument doc = ListUnionDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
         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 testListofUnions2() throws Throwable {
-        ListUnion2Document doc =
-                ListUnion2Document.Factory.newInstance();
-        List<Object> arrayList = new ArrayList<>();
-        arrayList.add("small");
-        arrayList.add("large");
-        arrayList.add(-1);
-        arrayList.add(2);
-        arrayList.add("addVal1");
-        arrayList.add("addVal2");
-        arrayList.add("addVal3");
-        doc.setListUnion2(arrayList);
+    void testListofUnions2() throws Throwable {
+        ListUnion2Document doc = ListUnion2Document.Factory.newInstance();
+        List<Object> arrayList = Arrays.asList("small", "large", -1, 2, 
"addVal1", "addVal2", "addVal3");
 
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        doc.setListUnion2(arrayList);
+        assertTrue(doc.validate(createOptions()));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/SimpleType.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/SimpleType.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/SimpleType.java 
(original)
+++ 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/SimpleType.java 
Sun Feb  6 01:51:55 2022
@@ -14,43 +14,33 @@
  */
 package scomp.contentType.simple.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
-import xbean.scomp.contentType.simpleType.PantSizeEltDocument;
 import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlOptions;
+import org.junit.jupiter.api.Test;
+import xbean.scomp.contentType.simpleType.PantSizeEltDocument;
 
-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 SimpleType extends BaseCase {
+public class SimpleType {
     @Test
-    public void testPattern() throws Throwable {
+    void testPattern() throws Throwable {
         PantSizeEltDocument size = PantSizeEltDocument.Factory.newInstance();
         size.setPantSizeElt(16);
         //size> max inclusive
-        assertTrue(!size.validate(validateOptions));
-        showErrors();
-        String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID
-        };
-        assertTrue(compareErrorCodes(errExpected));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(size.validate(validateOptions));
+        String[] errExpected = {XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         size.setPantSizeElt(-1);
-        showErrors();
-        clearErrors();
-        assertTrue(!size.validate(validateOptions));
-        errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
+        validateOptions.getErrorListener().clear();
+        assertFalse(size.validate(validateOptions));
+        errExpected = new String[]{XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         size.setPantSizeElt(14);
-        try {
-            assertTrue(size.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
+        assertTrue(size.validate(validateOptions));
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/UnionType.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/UnionType.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/UnionType.java 
(original)
+++ 
xmlbeans/trunk/src/test/java/scomp/contentType/simple/detailed/UnionType.java 
Sun Feb  6 01:51:55 2022
@@ -18,97 +18,73 @@ package scomp.contentType.simple.detaile
 import org.apache.xmlbeans.XmlErrorCodes;
 import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.contentType.union.UnionEltDocument;
 import xbean.scomp.contentType.union.UnionOfListsDocument;
 import xbean.scomp.contentType.union.UnionOfUnionsDocument;
 import xbean.scomp.contentType.union.UnionOfUnionsT;
 
-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 UnionType extends BaseCase {
+public class UnionType {
     /**
      * should be a bunch of negative cases at compile time
      */
     @Test
-    public void testUnionType() throws Throwable {
+    void testUnionType() throws Throwable {
         UnionEltDocument doc = UnionEltDocument.Factory.newInstance();
         assertNull(doc.getUnionElt());
         doc.setUnionElt("small");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
         doc.setUnionElt(2);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         doc.setUnionElt(-2);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         doc.setUnionElt(5);
         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));
     }
 
     /**
      * valid instance w/ xsi:type hint
      */
     @Test
-    public void testParseInstanceValid() throws Throwable {
+    void testParseInstanceValid() throws Throwable {
         String input =
-                "<UnionElt xmlns=\"http://xbean/scomp/contentType/Union\""; +
-                " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; " +
-                " xsi:type=\"GlobalSimpleT2\">" +
-                "-2" +
-                "</UnionElt>";
+            "<UnionElt xmlns=\"http://xbean/scomp/contentType/Union\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; " +
+            " xsi:type=\"GlobalSimpleT2\">" +
+            "-2" +
+            "</UnionElt>";
         UnionEltDocument doc = UnionEltDocument.Factory.parse(input);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
     }
 
     /**
      * invalid instance w/ xsi:type hint
      */
     @Test
-    public void testParseInstanceInvalid() throws Throwable {
+    void testParseInstanceInvalid() throws Throwable {
         String input =
-                "<UnionElt xmlns=\"http://xbean/scomp/contentType/Union\""; +
-                " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; " +
-                " xsi:type=\"GlobalSimpleT1\">" +
-                "-2" +
-                "</UnionElt>";
+            "<UnionElt xmlns=\"http://xbean/scomp/contentType/Union\""; +
+            " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; " +
+            " xsi:type=\"GlobalSimpleT1\">" +
+            "-2" +
+            "</UnionElt>";
         UnionEltDocument doc = UnionEltDocument.Factory.parse(input);
+        XmlOptions validateOptions = createOptions();
         assertFalse(doc.validate(validateOptions));
-        showErrors();
         String[] errExpected = {XmlErrorCodes.DATATYPE_MIN_INCLUSIVE_VALID};
-        assertTrue(compareErrorCodes(errExpected));
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     /**
@@ -116,110 +92,46 @@ public class UnionType extends BaseCase
      * are enumerations and not basic XmlSchema types and hence get translated 
into enum types in the XmlObjects
      */
     @Test
-    public void testUnionOfUnions() throws Throwable {
+    void testUnionOfUnions() throws Throwable {
         UnionOfUnionsDocument doc = 
UnionOfUnionsDocument.Factory.newInstance();
         doc.setUnionOfUnions("large");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
         UnionOfUnionsT elt = UnionOfUnionsT.Factory.newInstance();
         elt.setObjectValue(-3);
         doc.xsetUnionOfUnions(elt);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         doc.setUnionOfUnions("addVal1");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         doc.setUnionOfUnions("addVal2");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         doc.setUnionOfUnions("addVal4");
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        assertTrue(doc.validate(validateOptions));
         // setting a value outside of the union should throw an exception as
         // type inside the Xmlobject is an enumeration and has a fixed number 
of constants in the type
         // This will fail irrespective of the setValidateOnSet() option
-        boolean voeThrown = false;
-        try
-        {
-            doc.setUnionOfUnions("foobar");
-
-            assertFalse(doc.validate(validateOptions));
-
-            showErrors();
-            String[] errExpected = new String[]{"cvc-attribute"};
-                        assertTrue(compareErrorCodes(errExpected));
-        }
-        catch (XmlValueOutOfRangeException voe)
-        {
-            voeThrown = true;
-        }
-
-        finally
-        {
-            if(!voeThrown)
-                fail("Expected XmlValueOutOfRangeException here");
-        }
-
+        assertThrows(XmlValueOutOfRangeException.class, () -> 
doc.setUnionOfUnions("foobar"));
 
+        assertTrue(doc.validate(validateOptions));
     }
 
     // for the above test (testUnionOfUnions), if the value set for the union 
type is AnyType (in the schema)
     // but the Java type defined as say Integer or Date then an Exception 
should be thrown only if
     // validateOnSet XmlOption is set and not otherwise.
     @Test
-    public void UnionOfUnions2()
-    {
+    void UnionOfUnions2() {
         UnionOfUnionsDocument doc = 
UnionOfUnionsDocument.Factory.newInstance();
         doc.setUnionOfUnions("4");
 
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-        }
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
 
         // now validate with setValidateOnSetoption
         XmlOptions optWithValidateOnSet = new XmlOptions();
         optWithValidateOnSet.setValidateOnSet();
 
         UnionOfUnionsDocument doc2 = 
UnionOfUnionsDocument.Factory.newInstance(optWithValidateOnSet);
-        boolean voeThrown = false;
-        try {
-            doc2.setUnionOfUnions("4");
-        }
-        catch (XmlValueOutOfRangeException voe) {
-            voeThrown = true;
-        }
-        finally{
-            if(!voeThrown)
-                fail("Expected XmlValueOutOfRangeException..");
-        }
+        assertThrows(XmlValueOutOfRangeException.class, () -> 
doc2.setUnionOfUnions("4"));
     }
 
     /**
@@ -227,60 +139,27 @@ public class UnionType extends BaseCase
      * or     (lstsmall, lstmed, lstlarge)
      */
     @Test
-    public void testUnionOfLists() throws Throwable {
+    void testUnionOfLists() throws Throwable {
         UnionOfListsDocument doc = UnionOfListsDocument.Factory.newInstance();
-        List<Object> vals = new ArrayList<>();
-        vals.add("small");
-        vals.add(-1);
-        vals.add(-2);
-        vals.add(-3);
-        vals.add(3);
-        vals.add("medium");
-        doc.setUnionOfLists(vals);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-
-        vals.clear();
-        vals.add("lstsmall");
-        vals.add("lstlarge");
+        List<Object> vals = Arrays.asList("small", -1, -2, -3, 3, "medium");
 
         doc.setUnionOfLists(vals);
-        try {
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
+        XmlOptions validateOptions = createOptions();
+        assertTrue(doc.validate(validateOptions));
 
-        vals.clear();
+        vals = Arrays.asList("lstsmall","lstlarge");
+
+        doc.setUnionOfLists(vals);
+        assertTrue(doc.validate(validateOptions));
 
         //mixing and matching should not be allowed
         //the list shoudl have exactly one of the 2 union types
-        vals.add("lstsmall");
-        vals.add(-1);
+        List<Object> vals2 = Arrays.asList("lstsmall", -1);
 
         // if the type in a union and cannot be converted into any of the 
union types, and in this case
         // since the list have enumerations, an exception is expected 
irrespective of validateOnSet XmlOption
         // being set. Refer testUnionOfUnions comment also
-        boolean voeThrown = false;
-        try{
-            doc.setUnionOfLists( vals );
-        }
-        catch (XmlValueOutOfRangeException voe){
-            voeThrown = true;
-        }
-        finally{
-            if(!voeThrown)
-                fail("Expected XmlValueOutOfRangeException here");
-        }
-
+        assertThrows(XmlValueOutOfRangeException.class, () -> 
doc.setUnionOfLists(vals2));
     }
-
 }
 

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/detailed/AbstractTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/detailed/AbstractTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/scomp/derivation/detailed/AbstractTest.java 
(original)
+++ xmlbeans/trunk/src/test/java/scomp/derivation/detailed/AbstractTest.java 
Sun Feb  6 01:51:55 2022
@@ -14,51 +14,52 @@
  */
 package scomp.derivation.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.apache.xmlbeans.XmlException;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.derivation.xabstract.AbstractT;
 import xbean.scomp.derivation.xabstract.EltAbstractDocument;
 import xbean.scomp.derivation.xabstract.EltConcreteDocument;
 
 import java.math.BigInteger;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static scomp.common.BaseCase.createOptions;
 
-public class AbstractTest extends BaseCase {
+public class AbstractTest {
 
     /**
      * This is an abstract element...no instance should ever be valid
      */
     @Test
-    public void testElementAbstract() throws Throwable {
+    void testElementAbstract() {
         EltAbstractDocument doc = EltAbstractDocument.Factory.newInstance();
         AbstractT elt = doc.addNewEltAbstract();
         elt.setAge(new BigInteger("15"));
         elt.setName("Ben");
-        assertTrue(elt != null);
-        assertTrue(!elt.validate());
+        assertNotNull(elt);
+        assertFalse(elt.validate());
     }
 
     @Test
-    public void testElementAbstractParse() throws Throwable {
-        EltAbstractDocument doc = EltAbstractDocument.Factory.parse(
+    void testElementAbstractParse() throws XmlException {
+        String input =
             "<foo:EltAbstract " +
-                "xmlns:foo=\"http://xbean/scomp/derivation/Abstract\";>" +
-                " <name>Bob</name><age>25</age><gender>G</gender>" +
-                "</foo:EltAbstract>");
-
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
+            "xmlns:foo=\"http://xbean/scomp/derivation/Abstract\";>" +
+            " <name>Bob</name><age>25</age><gender>G</gender>" +
+            "</foo:EltAbstract>";
+        EltAbstractDocument doc = EltAbstractDocument.Factory.parse(input);
+        assertFalse(doc.validate(createOptions()));
     }
 
     @Test
-    public void testElementConcrete() throws Throwable {
-        EltConcreteDocument doc = EltConcreteDocument.Factory.parse(
+    void testElementConcrete() throws Throwable {
+        String input =
             "<foo:EltConcrete " +
-                "xmlns:foo=\"http://xbean/scomp/derivation/Abstract\";>" +
-                " <name>Bob</name><age>25</age><gender>G</gender>" +
-                "</foo:EltConcrete>");
-        assertTrue(!doc.validate(validateOptions));
-        showErrors();
+            "xmlns:foo=\"http://xbean/scomp/derivation/Abstract\";>" +
+            " <name>Bob</name><age>25</age><gender>G</gender>" +
+            "</foo:EltConcrete>";
+        EltConcreteDocument doc = EltConcreteDocument.Factory.parse(input);
+        assertFalse(doc.validate(createOptions()));
     }
 }

Modified: xmlbeans/trunk/src/test/java/scomp/derivation/detailed/BlockTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/detailed/BlockTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/scomp/derivation/detailed/BlockTest.java 
(original)
+++ xmlbeans/trunk/src/test/java/scomp/derivation/detailed/BlockTest.java Sun 
Feb  6 01:51:55 2022
@@ -16,219 +16,171 @@ package scomp.derivation.detailed;
 
 import org.apache.xmlbeans.XmlErrorCodes;
 import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.junit.Test;
-import scomp.common.BaseCase;
+import org.apache.xmlbeans.XmlOptions;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.derivation.block.*;
 import xbean.scomp.derivation.finalBlockDefault.EltDefaultBlockDocument;
 import xbean.scomp.derivation.finalBlockDefault.EltNoBlockDocument;
 
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
+import static scomp.common.BaseCase.createOptions;
+import static scomp.common.BaseCase.getErrorCodes;
 
-public class BlockTest extends BaseCase {
+public class BlockTest {
     String restrContentValid = "<name>Bobby</name><age>20</age>";
     String restrContentInvalid = "<name>Bobby</name><age>40</age>";
     String extContent = "<name>Bobby</name><age>40</age><gender>f</gender>";
 
-    public String getInstance(String elt,
-                              String type,
-                              boolean ext,
-                              boolean valid) {
+    public String getInstance(String elt, String type, boolean ext, boolean 
valid) {
         StringBuilder sb = new StringBuilder();
-        sb.append("<ns:" + elt +
-                "  xmlns:ns=\"http://xbean/scomp/derivation/Block\"";);
+        sb.append("<ns:" + elt + "  
xmlns:ns=\"http://xbean/scomp/derivation/Block\"";);
         sb.append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";);
         sb.append(" xsi:type=\"ns:" + type + "\">");
-        if (ext)
+        if (ext) {
             sb.append(extContent);
-        else if (valid)
+        } else if (valid) {
             sb.append(restrContentValid);
-        else
+        } else {
             sb.append(restrContentInvalid);
+        }
 
         sb.append("</ns:" + elt + ">");
         return sb.toString();
-
     }
 
-    public String getInstanceDefault(String elt, String type, boolean ext,
-                                     boolean valid) {
+    public String getInstanceDefault(String elt, String type, boolean ext, 
boolean valid) {
         StringBuilder sb = new StringBuilder();
-        sb.append("<ns:" + elt +
-                "  
xmlns:ns=\"http://xbean/scomp/derivation/FinalBlockDefault\"";);
+        sb.append("<ns:" + elt + "  
xmlns:ns=\"http://xbean/scomp/derivation/FinalBlockDefault\"";);
         sb.append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";);
         sb.append(" xsi:type=\"ns:" + type + "\">");
-        if (ext)
+        if (ext) {
             sb.append(extContent);
-        else if (valid)
+        } else if (valid) {
             sb.append(restrContentValid);
-        else
+        } else {
             sb.append(restrContentInvalid);
+        }
 
         sb.append("</ns:" + elt + ">");
         return sb.toString();
-
     }
 
     @Test
-    public void testBlockAll() throws Throwable {
+    void testBlockAll() throws Throwable {
         //subst ext type: should not be possible
         EltAllBaseDocument doc = 
EltAllBaseDocument.Factory.parse(getInstance("EltAllBase", "extAllT", true, 
true));
-        assertTrue(!doc.validate());
+        assertFalse(doc.validate());
 
         //subst rest type:  should not be possible
         EltAllBaseDocument doc1 = 
EltAllBaseDocument.Factory.parse(getInstance("EltAllBase", "restAllT", false, 
false));
 
-        assertTrue(!doc.validate());
+        assertFalse(doc.validate());
 
         doc1 = EltAllBaseDocument.Factory.parse(getInstance("EltAllBase", 
"restAllT", false, true));
-        assertTrue(!doc.validate(validateOptions));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
         String[] errExpected = new String[]{
             XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_EXTENSION};
-        assertTrue(compareErrorCodes(errExpected));
-
-
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     @Test
-    public void testBlockExtension() throws Throwable {
+    void testBlockExtension() throws Throwable {
         //subst ext type: should not be possible
-        try {
-            EltEBaseDocument doc = 
EltEBaseDocument.Factory.parse(getInstance("EltExtE", "extET", true, true));
-            fail("Not a valid Substitution");
-        } catch (XmlException e) {
+        assertThrows(XmlException.class, () -> 
EltEBaseDocument.Factory.parse(getInstance("EltExtE", "extET", true, true)),
+            "Not a valid Substitution");
 
-        }
-        //subst rest type: should work
-        /**
-         * base type: blocked="extension" so rest. type should be a vald subst
-         */
-        EltEBaseDocument doc1 = null;
-        try {
-            doc1 = EltEBaseDocument.Factory.parse(getInstance("EltEBase", 
"restET", false, false));
-        } catch (XmlException e) {
-
-        }
+        // subst rest type: should work
+        // base type: blocked="extension" so rest. type should be a vald subst
+        EltEBaseDocument.Factory.parse(getInstance("EltEBase", "restET", 
false, false));
 
         String instance = getInstance("EltEBase", "restET", false, true);
-        doc1 = EltEBaseDocument.Factory.parse(instance);
-        validate(doc1);
+        EltEBaseDocument doc1 = EltEBaseDocument.Factory.parse(instance);
+        assertTrue(doc1.validate(createOptions()));
     }
 
     @Test
-    public void testBlockRestriction() throws Throwable {
+    void testBlockRestriction() throws Throwable {
+        XmlOptions validateOptions = createOptions();
         //subst ext type: should work
         EltRBaseDocument doc = 
EltRBaseDocument.Factory.parse(getInstance("EltRBase", "extRT", true, true));
-        validate(doc);
+        assertTrue(doc.validate(validateOptions));
         //subst rest type:  should not be possible
         EltRBaseDocument doc1 = 
EltRBaseDocument.Factory.parse(getInstance("EltRBase", "restRT", false, false));
-        assertTrue(!doc1.validate(validateOptions));
-        String[] errExpected = new String[]{
-            XmlErrorCodes
-                .ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
-               assertTrue(compareErrorCodes(errExpected));
-
-        doc1 = EltRBaseDocument.Factory
-                .parse(getInstance("EltRBase", "restRT", false, true));
-        clearErrors();
-        assertTrue(!doc1.validate(validateOptions));
-        errExpected = new String[]{
-            XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
-        assertTrue(compareErrorCodes(errExpected));
+        assertFalse(doc1.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
+        doc1 = EltRBaseDocument.Factory.parse(getInstance("EltRBase", 
"restRT", false, true));
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc1.validate(validateOptions));
+        errExpected = new 
String[]{XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
-    //should be equivaluent to final="#all"
+    //should be equivalent to final="#all"
     @Test
-    public void testBlockRE_ER() throws Throwable {
+    void testBlockRE_ER() throws Throwable {
         //subst ext type: should not be possible
         //ER
         EltERBaseDocument doc = 
EltERBaseDocument.Factory.parse(getInstance("EltERBase", "extERT", true, true));
         //RE
-        EltREBaseDocument doc1 =
-                EltREBaseDocument.Factory.parse(getInstance("EltREBase", 
"extRET", true, true));
-        assertTrue(!doc1.validate(validateOptions));
-        String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_EXTENSION};
-        assertTrue(compareErrorCodes(errExpected));
-
+        EltREBaseDocument doc1 = 
EltREBaseDocument.Factory.parse(getInstance("EltREBase", "extRET", true, true));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc1.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_EXTENSION};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         //subst rest type:  should not be possible
         //ER
-        EltERBaseDocument doc2 = EltERBaseDocument.Factory
-                .parse(getInstance("EltERBase",
-                        "restERT", false, false));
-        clearErrors();
-        assertTrue(!doc2.validate(validateOptions));
-        errExpected = new String[]{
-            XmlErrorCodes
-                .ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
-        assertTrue(compareErrorCodes(errExpected));
+        EltERBaseDocument doc2 = 
EltERBaseDocument.Factory.parse(getInstance("EltERBase", "restERT", false, 
false));
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc2.validate(validateOptions));
+        errExpected = new 
String[]{XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         doc2 = EltERBaseDocument.Factory.parse(getInstance("EltERBase", 
"restERT", false, true));
-        clearErrors();
-        assertTrue(!doc2.validate(validateOptions));
-        errExpected = new String[]{
-            XmlErrorCodes
-                .ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
-        assertTrue(compareErrorCodes(errExpected));
-
-        //RE
-        EltREBaseDocument doc3 = EltREBaseDocument.Factory
-                .parse(getInstance("EltREBase", "restRET", false, false));
-       clearErrors();
-        assertTrue(!doc3.validate(validateOptions));
-        errExpected = new String[]{
-            XmlErrorCodes
-                .ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
-        doc3 = EltREBaseDocument.Factory
-                .parse(getInstance("EltREBase", "restRET", false, true));
-        clearErrors();
-        assertTrue(!doc3.validate(validateOptions));
-        errExpected = new String[]{
-             XmlErrorCodes
-                .ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc2.validate(validateOptions));
+        errExpected = new 
String[]{XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
+
+        // RE
+        EltREBaseDocument doc3 = 
EltREBaseDocument.Factory.parse(getInstance("EltREBase", "restRET", false, 
false));
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc3.validate(validateOptions));
+        errExpected = new 
String[]{XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
+
+        doc3 = EltREBaseDocument.Factory.parse(getInstance("EltREBase", 
"restRET", false, true));
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc3.validate(validateOptions));
+        errExpected = new 
String[]{XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     /**
      * blockDefault="#all"
      */
     @Test
-    public void testBlockDefault() throws Throwable {
-        EltDefaultBlockDocument doc =
-                EltDefaultBlockDocument.Factory
-                .parse(getInstanceDefault("EltDefaultBlock", "extNoneT", true, 
true));
-        assertTrue(!doc.validate(validateOptions));
-        String[] errExpected = new String[]{
-            XmlErrorCodes
-                .ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_EXTENSION};
-        assertTrue(compareErrorCodes(errExpected));
-
-        doc = EltDefaultBlockDocument.Factory
-                .parse(getInstanceDefault("EltDefaultBlock", "restNoneT", 
false, false));
-        clearErrors();
-        assertTrue(!doc.validate(validateOptions));
-        errExpected = new String[]{
-            XmlErrorCodes
-                .ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION
-        };
-        assertTrue(compareErrorCodes(errExpected));
+    void testBlockDefault() throws Throwable {
+        EltDefaultBlockDocument doc = 
EltDefaultBlockDocument.Factory.parse(getInstanceDefault("EltDefaultBlock", 
"extNoneT", true, true));
+        XmlOptions validateOptions = createOptions();
+        assertFalse(doc.validate(validateOptions));
+        String[] errExpected = 
{XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_EXTENSION};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
+
+        doc = 
EltDefaultBlockDocument.Factory.parse(getInstanceDefault("EltDefaultBlock", 
"restNoneT", false, false));
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc.validate(validateOptions));
+        errExpected = new 
String[]{XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
 
         doc = 
EltDefaultBlockDocument.Factory.parse(getInstanceDefault("EltDefaultBlock", 
"restNoneT", false, true));
-       clearErrors();
-        assertTrue(!doc.validate(validateOptions));
-        errExpected = new String[]{
-            XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION
-        };
-        assertTrue(compareErrorCodes(errExpected));
-
+        validateOptions.getErrorListener().clear();
+        assertFalse(doc.validate(validateOptions));
+        errExpected = new 
String[]{XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION};
+        assertArrayEquals(errExpected, getErrorCodes(validateOptions));
     }
 
     /**
@@ -236,23 +188,14 @@ public class BlockTest extends BaseCase
      * local block=""
      */
     @Test
-    public void testBlockNone() throws Throwable {
+    void testBlockNone() throws Throwable {
+        XmlOptions validateOptions = createOptions();
         String instance = getInstanceDefault("EltNoBlock", "extAllT", true, 
true);
         EltNoBlockDocument doc = EltNoBlockDocument.Factory.parse(instance);
-        validate(doc);
+        assertTrue(doc.validate(validateOptions));
         doc = 
EltNoBlockDocument.Factory.parse(getInstanceDefault("EltNoBlock", "restAllT", 
false, false));
-        assertTrue(!doc.validate());
+        assertFalse(doc.validate());
         doc = 
EltNoBlockDocument.Factory.parse(getInstanceDefault("EltNoBlock", "restAllT", 
false, true));
-        validate(doc);
+        assertTrue(doc.validate(validateOptions));
     }
-
-    public void validate(XmlObject doc) throws Throwable {
-        try {
-            assertTrue(doc.validate(validateOptions));
-        } catch (Throwable t) {
-            showErrors();
-            throw t;
-        }
-    }
-
 }

Modified: 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/AttributeExtensionTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/AttributeExtensionTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/AttributeExtensionTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/scomp/derivation/extension/detailed/AttributeExtensionTest.java
 Sun Feb  6 01:51:55 2022
@@ -15,48 +15,38 @@
 
 package scomp.derivation.extension.detailed;
 
-import org.junit.Test;
-import scomp.common.BaseCase;
-import xbean.scomp.derivation.attributeExtension.ExtendedT;
+import org.junit.jupiter.api.Test;
 import xbean.scomp.derivation.attributeExtension.ExtendedElementDocument;
+import xbean.scomp.derivation.attributeExtension.ExtendedT;
 
 import java.math.BigInteger;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static scomp.common.BaseCase.createOptions;
 
-public class AttributeExtensionTest extends BaseCase{
+public class AttributeExtensionTest {
     /**
      * Attribute w/ same LN but diff NS in base type
      * Other scenarious are compile time errors
      */
     @Test
-    public void testAttribute()throws Throwable{
-       ExtendedElementDocument 
doc=ExtendedElementDocument.Factory.newInstance();
-        ExtendedT elt=doc.addNewExtendedElement();
-         try{
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-           throw t;
-        }
+    void testAttribute() throws Throwable {
+        ExtendedElementDocument doc = 
ExtendedElementDocument.Factory.newInstance();
+        ExtendedT elt = doc.addNewExtendedElement();
+        assertTrue(doc.validate(createOptions()));
+
         elt.setTestattribute("foo");
         elt.setTestattribute2("bar");
         elt.setTestattributeInt(new BigInteger("10"));
-          try{
-            assertTrue(doc.validate(validateOptions));
-        }
-        catch (Throwable t) {
-            showErrors();
-           throw t;
-        }
+        assertTrue(doc.validate(createOptions()));
+
         //make sure attr w/ value foo is in the imported NS
-       assertEquals("<att:ExtendedElement glob:testattribute=\"foo\" " +
-               "testattribute=\"bar\" glob:testattributeInt=\"10\" " +
-               "xmlns:att=\"http://xbean/scomp/derivation/AttributeExtension\"; 
" +
-               
"xmlns:glob=\"http://xbean/scomp/attribute/GlobalAttrDefault\"/>"
-               ,doc.xmlText());
+        String expected =
+            "<att:ExtendedElement glob:testattribute=\"foo\" " +
+            "testattribute=\"bar\" glob:testattributeInt=\"10\" " +
+            "xmlns:att=\"http://xbean/scomp/derivation/AttributeExtension\"; " +
+            "xmlns:glob=\"http://xbean/scomp/attribute/GlobalAttrDefault\"/>";
+        assertEquals(expected, doc.xmlText());
     }
-
 }



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

Reply via email to