Modified: xmlbeans/trunk/test/src/scomp/derivation/detailed/AbstractTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/detailed/AbstractTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/detailed/AbstractTest.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/detailed/AbstractTest.java Fri Jan 18 23:08:44 2019 @@ -14,53 +14,51 @@ */ package scomp.derivation.detailed; +import org.junit.Test; import scomp.common.BaseCase; -import xbean.scomp.derivation.xabstract.EltAbstractDocument; import xbean.scomp.derivation.xabstract.AbstractT; +import xbean.scomp.derivation.xabstract.EltAbstractDocument; import xbean.scomp.derivation.xabstract.EltConcreteDocument; import java.math.BigInteger; -/** - * - * - * - */ -public class AbstractTest extends BaseCase{ +import static org.junit.Assert.assertTrue; + +public class AbstractTest extends BaseCase { - /** - * This is an abstract element...no instance should ever be valid - * @throws Throwable - */ - - public void testElementAbstract() throws Throwable{ - EltAbstractDocument doc=EltAbstractDocument.Factory.newInstance(); - AbstractT elt=doc.addNewEltAbstract(); + /** + * This is an abstract element...no instance should ever be valid + */ + @Test + public void testElementAbstract() throws Throwable { + EltAbstractDocument doc = EltAbstractDocument.Factory.newInstance(); + AbstractT elt = doc.addNewEltAbstract(); elt.setAge(new BigInteger("15")); elt.setName("Ben"); - assertTrue(elt!=null); - assertTrue (! elt.validate() ); + assertTrue(elt != null); + assertTrue(!elt.validate()); } - public void testElementAbstractParse() throws Throwable{ - EltAbstractDocument doc=EltAbstractDocument.Factory.parse( - "<foo:EltAbstract " + - "xmlns:foo=\"http://xbean/scomp/derivation/Abstract\">"+ - " <name>Bob</name><age>25</age><gender>G</gender>" + - "</foo:EltAbstract>"); + @Test + public void testElementAbstractParse() throws Throwable { + EltAbstractDocument doc = EltAbstractDocument.Factory.parse( + "<foo:EltAbstract " + + "xmlns:foo=\"http://xbean/scomp/derivation/Abstract\">" + + " <name>Bob</name><age>25</age><gender>G</gender>" + + "</foo:EltAbstract>"); - assertTrue (! doc.validate(validateOptions) ); + assertTrue(!doc.validate(validateOptions)); showErrors(); } - public void testElementConcrete() throws Throwable{ - EltConcreteDocument doc=EltConcreteDocument.Factory.parse( - "<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(); - } - + @Test + public void testElementConcrete() throws Throwable { + EltConcreteDocument doc = EltConcreteDocument.Factory.parse( + "<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(); + } }
Modified: xmlbeans/trunk/test/src/scomp/derivation/detailed/BlockTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/detailed/BlockTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/detailed/BlockTest.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/detailed/BlockTest.java Fri Jan 18 23:08:44 2019 @@ -14,19 +14,18 @@ */ package scomp.derivation.detailed; -import xbean.scomp.derivation.finalBlockDefault.EltNoBlockDocument; -import xbean.scomp.derivation.finalBlockDefault.EltDefaultBlockDocument; -import xbean.scomp.derivation.block.*; -import scomp.common.BaseCase; -import org.apache.xmlbeans.XmlObject; -import org.apache.xmlbeans.XmlException; import org.apache.xmlbeans.XmlErrorCodes; +import org.apache.xmlbeans.XmlException; +import org.apache.xmlbeans.XmlObject; +import org.junit.Test; +import scomp.common.BaseCase; +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; -/** - * - * - * - */ public class BlockTest extends BaseCase { String restrContentValid = "<name>Bobby</name><age>20</age>"; String restrContentInvalid = "<name>Bobby</name><age>40</age>"; @@ -72,6 +71,7 @@ public class BlockTest extends BaseCase } + @Test public void testBlockAll() throws Throwable { //subst ext type: should not be possible EltAllBaseDocument doc = EltAllBaseDocument.Factory.parse(getInstance("EltAllBase", "extAllT", true, true)); @@ -91,6 +91,7 @@ public class BlockTest extends BaseCase } + @Test public void testBlockExtension() throws Throwable { //subst ext type: should not be possible try { @@ -115,6 +116,7 @@ public class BlockTest extends BaseCase validate(doc1); } + @Test public void testBlockRestriction() throws Throwable { //subst ext type: should work EltRBaseDocument doc = EltRBaseDocument.Factory.parse(getInstance("EltRBase", "extRT", true, true)); @@ -138,6 +140,7 @@ public class BlockTest extends BaseCase } //should be equivaluent to final="#all" + @Test public void testBlockRE_ER() throws Throwable { //subst ext type: should not be possible //ER @@ -196,9 +199,8 @@ public class BlockTest extends BaseCase /** * blockDefault="#all" - * - * @throws Throwable */ + @Test public void testBlockDefault() throws Throwable { EltDefaultBlockDocument doc = EltDefaultBlockDocument.Factory @@ -232,9 +234,8 @@ public class BlockTest extends BaseCase /** * blockDefault="#all" * local block="" - * - * @throws Throwable */ + @Test public void testBlockNone() throws Throwable { String instance = getInstanceDefault("EltNoBlock", "extAllT", true, true); EltNoBlockDocument doc = EltNoBlockDocument.Factory.parse(instance); Modified: xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/AttributeExtensionTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/AttributeExtensionTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/AttributeExtensionTest.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/AttributeExtensionTest.java Fri Jan 18 23:08:44 2019 @@ -15,22 +15,22 @@ package scomp.derivation.extension.detailed; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.derivation.attributeExtension.ExtendedT; import xbean.scomp.derivation.attributeExtension.ExtendedElementDocument; import java.math.BigInteger; -/** - * - * - * - */ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + public class AttributeExtensionTest extends BaseCase{ /** * 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(); Modified: xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/AttributeWCExtension.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/AttributeWCExtension.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/AttributeWCExtension.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/AttributeWCExtension.java Fri Jan 18 23:08:44 2019 @@ -14,23 +14,19 @@ */ package scomp.derivation.extension.detailed; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.derivation.attributeWCExtension.*; -/** - * - * - * - */ +import static org.junit.Assert.assertTrue; + public class AttributeWCExtension extends BaseCase { /** * Strict wildcard ##local * Base type didn't have wildcards - * - * @throws Throwable */ - + @Test public void testRestrictBaseWOWC() throws Throwable { String input = "<pre:BaseNoWC " + " xmlns:pre=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + @@ -43,14 +39,12 @@ public class AttributeWCExtension extend showErrors(); assertTrue(doc.validate(validateOptions)); - } /** * Strict validation: attr should be found AND valid - * - * @throws Throwable */ + @Test public void testAnyStrict() throws Throwable { String input = "<foo:AnyStrict " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + @@ -63,9 +57,8 @@ public class AttributeWCExtension extend /** * Lax validation:IF attr is found, it should be valid - * - * @throws Throwable */ + @Test public void testAnyLax() throws Throwable { String input = "<foo:AnyLax " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + @@ -74,9 +67,9 @@ public class AttributeWCExtension extend if (!doc.validate(validateOptions)) showErrors(); assertTrue(doc.validate(validateOptions)); - } + @Test public void testAnySkip() throws Throwable { String input = "<foo:AnySkip " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + @@ -90,6 +83,7 @@ public class AttributeWCExtension extend /** * target and local here too */ + @Test public void test2ListsLax() throws Throwable { String input = "<foo:UriListLax " + @@ -105,6 +99,7 @@ public class AttributeWCExtension extend * any valid XML should be OK, * as long as NS is other or target */ + @Test public void test2ListsSkip() throws Throwable { String input = "<foo:UriListSkip " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + @@ -115,6 +110,7 @@ public class AttributeWCExtension extend assertTrue(doc.validate(validateOptions)); } + @Test public void test2ListsStrict() throws Throwable { String input = "<foo:UriListStrict " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + @@ -129,6 +125,7 @@ public class AttributeWCExtension extend /** * target and local here too */ + @Test public void testOtherListLax() throws Throwable { String input = "<foo:OtherListLax " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + @@ -139,6 +136,7 @@ public class AttributeWCExtension extend assertTrue(doc.validate(validateOptions)); } + @Test public void testOtherListSkip() throws Throwable { String input = "<foo:OtherListSkip " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + @@ -149,6 +147,7 @@ public class AttributeWCExtension extend assertTrue(doc.validate(validateOptions)); } + @Test public void testOtherListStrict() throws Throwable { String input = "<foo:OtherListStrict " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + @@ -165,6 +164,7 @@ public class AttributeWCExtension extend * target and local here too * Other other should be equivalent to ##any */ + @Test public void testOtherOtherLax() throws Throwable { String input = "<foo:OtherOtherLax " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + @@ -176,6 +176,7 @@ public class AttributeWCExtension extend assertTrue(doc.validate(validateOptions)); } + @Test public void testOtherOtherSkip() throws Throwable { String input = "<foo:OtherOtherSkip " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + @@ -187,6 +188,7 @@ public class AttributeWCExtension extend assertTrue(doc.validate(validateOptions)); } + @Test public void testOtherOtherStrict() throws Throwable { String input = "<foo:OtherOtherStrict " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCExtension\"" + Modified: xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java Fri Jan 18 23:08:44 2019 @@ -14,6 +14,8 @@ */ package scomp.derivation.extension.detailed; +import org.apache.xmlbeans.*; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.derivation.complexExtension.ChoiceExtensionEltDocument; import xbean.scomp.derivation.complexExtension.ChoiceExtensionT; @@ -21,20 +23,14 @@ import xbean.scomp.derivation.complexExt import xbean.scomp.derivation.complexExtension.SequenceExtensionT; import java.math.BigInteger; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.ArrayList; -import org.apache.xmlbeans.*; +import static org.junit.Assert.*; -/** - * - * - * - */ public class ComplexContentExtensionTest extends BaseCase { - - + @Test public void testSequenceExtension() throws Throwable { SequenceExtensionEltDocument doc = SequenceExtensionEltDocument.Factory .newInstance(); @@ -76,6 +72,7 @@ public class ComplexContentExtensionTest * Valid sets: { (child1 xor child2 xor child3 )(extraEltStr xor extraEltStr) } * @throws Throwable */ + @Test public void testChoiceExtension() throws Throwable { ChoiceExtensionEltDocument doc = ChoiceExtensionEltDocument.Factory .newInstance(); @@ -149,6 +146,7 @@ public class ComplexContentExtensionTest * The follwing are test for the 'final' attribute used in a base type that affects extenstion/restriction * They are negative tests and test for #all, restriction, extenstion and 'extenstion restriction' values */ + @Test public void testFinalAll() { String inputXsd = " <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" + " <xsd:complexType name=\"BaseProductTypeFinalAll\" final=\"#all\">\n" + @@ -211,6 +209,7 @@ public class ComplexContentExtensionTest } + @Test public void testFinalExtension() { String inputXsd = " <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" + " <xsd:complexType name=\"BaseProductTypeFinalExtension\" final=\"extension\">\n" + @@ -247,6 +246,7 @@ public class ComplexContentExtensionTest } } + @Test public void testFinalRestriction() { String inputXsd = " <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" + " <xsd:complexType name=\"BaseProductTypeFinalRestriction\" final=\"restriction\">\n" + @@ -282,6 +282,7 @@ public class ComplexContentExtensionTest } } + @Test public void testFinalRestrExt() { String inputXsd = " <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" + " <xsd:complexType name=\"BaseProductTypeFinalAll\" final=\"restriction extension\">\n" + @@ -341,7 +342,5 @@ public class ComplexContentExtensionTest System.out.println("Err:" + eacherr.getMessage()); assertNotNull(eacherr.getErrorCode()); assertEquals(XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$FINAL, eacherr.getErrorCode()); - } - } Modified: xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/EmptyContentExtension.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/EmptyContentExtension.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/EmptyContentExtension.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/EmptyContentExtension.java Fri Jan 18 23:08:44 2019 @@ -14,16 +14,15 @@ */ package scomp.derivation.extension.detailed; +import org.junit.Test; +import scomp.common.BaseCase; import xbean.scomp.derivation.emtpy.ExtendedEmptyEltDocument; import xbean.scomp.derivation.emtpy.ExtendedEmptyT; -import scomp.common.BaseCase; -/** - * @owner: ykadiysk - * Date: Jul 21, 2004 - * Time: 10:18:48 AM - */ +import static org.junit.Assert.assertTrue; + public class EmptyContentExtension extends BaseCase{ + @Test public void testEmptyElementContent() throws Throwable{ ExtendedEmptyEltDocument doc=ExtendedEmptyEltDocument.Factory.newInstance(); ExtendedEmptyT elt=doc.addNewExtendedEmptyElt(); Modified: xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/MixedContentExtension.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/MixedContentExtension.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/MixedContentExtension.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/MixedContentExtension.java Fri Jan 18 23:08:44 2019 @@ -15,22 +15,20 @@ package scomp.derivation.extension.detailed; +import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlErrorCodes; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.derivation.complexExtension.ExtendedMixedEltDocument; import xbean.scomp.derivation.complexExtension.ExtendedMixedT; import java.math.BigInteger; -import org.apache.xmlbeans.XmlCursor; -import org.apache.xmlbeans.XmlErrorCodes; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; -/** - * - * - * - */ public class MixedContentExtension extends BaseCase { - + @Test public void testMixedContentInvalid() throws Throwable { ExtendedMixedEltDocument doc = ExtendedMixedEltDocument. Factory.newInstance(); @@ -73,7 +71,7 @@ public class MixedContentExtension exten } - + @Test public void testMixedContentValid() throws Throwable { ExtendedMixedEltDocument doc = ExtendedMixedEltDocument. Factory.newInstance(); Modified: xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/SimpleTypeExtensionTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/SimpleTypeExtensionTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/SimpleTypeExtensionTest.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/extension/detailed/SimpleTypeExtensionTest.java Fri Jan 18 23:08:44 2019 @@ -15,18 +15,17 @@ package scomp.derivation.extension.detailed; +import org.junit.Test; import xbean.scomp.derivation.simpleExtension.SimpleExtensionEltDocument; import xbean.scomp.derivation.simpleExtension.SimpleExtensionT; import scomp.common.BaseCase; import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException; -/** - * - * - * - */ +import static org.junit.Assert.*; + public class SimpleTypeExtensionTest extends BaseCase { + @Test public void testExtension() throws Throwable { SimpleExtensionEltDocument doc = SimpleExtensionEltDocument.Factory.newInstance(); SimpleExtensionT elt = doc.addNewSimpleExtensionElt(); Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/AttrWCRestriction.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/AttrWCRestriction.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/AttrWCRestriction.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/AttrWCRestriction.java Fri Jan 18 23:08:44 2019 @@ -15,19 +15,20 @@ package scomp.derivation.restriction.detailed; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.derivation.attributeWCRestriction.*; import org.apache.xmlbeans.XmlErrorCodes; -/** - * - */ +import static org.junit.Assert.assertTrue; + public class AttrWCRestriction extends BaseCase { String input; /** * Replace a wildcard with a concrete attribute * No other attr should be valid here */ + @Test public void testAny2Instance() throws Throwable{ input="<foo:Any2Concrete " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\"" + @@ -57,8 +58,8 @@ public class AttrWCRestriction extends B * attrs not in target ns are therefore illegal * Skip to strict * No namespace should be OK, any other namespace should be notOK - * @throws Throwable */ + @Test public void testAny2LocalStrict() throws Throwable{ input="<foo:Any2Local " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\"" + @@ -92,6 +93,7 @@ public class AttrWCRestriction extends B * lax to strict * @throws Throwable */ + @Test public void testList2SubsetStrict()throws Throwable{ input="<foo:List2Subset " + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\"" + @@ -108,11 +110,12 @@ public class AttrWCRestriction extends B //invalid case: give the attr a bad value, make sure it's being validated } + /** * should be able to ##other w/ spec. namespaces * skip to lax - * @throws Throwable */ + @Test public void testOther2ListLax()throws Throwable{ input="<foo:Other2List" + " xmlns:foo=\"http://xbean/scomp/derivation/AttributeWCRestriction\"" + Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/AttributeRestriction.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/AttributeRestriction.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/AttributeRestriction.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/AttributeRestriction.java Fri Jan 18 23:08:44 2019 @@ -15,6 +15,7 @@ package scomp.derivation.restriction.detailed; +import org.junit.Test; import xbean.scomp.derivation.attributeRestriction.AttrEltDocument; import xbean.scomp.derivation.attributeRestriction.RestrictedAttrT; @@ -24,16 +25,15 @@ import scomp.common.BaseCase; import org.apache.xmlbeans.XmlString; import org.apache.xmlbeans.XmlErrorCodes; -/** - * - * - */ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + public class AttributeRestriction extends BaseCase { - /** - * A should be positive - * B should be there by default - * @throws Throwable - */ + /** + * A should be positive + * B should be there by default + */ + @Test public void testAttributeABC() throws Throwable { AttrEltDocument doc = AttrEltDocument.Factory.newInstance(); RestrictedAttrT elt = doc.addNewAttrElt(); @@ -52,6 +52,7 @@ public class AttributeRestriction extend assertTrue ( expected.valueEquals(elt.xgetC()) ); } + @Test public void testAttributeDEF() throws Throwable { AttrEltDocument doc = AttrEltDocument.Factory.newInstance(); RestrictedAttrT elt = doc.addNewAttrElt(); @@ -79,33 +80,32 @@ public class AttributeRestriction extend throw t; } } - /** - * G is prohibited, X can appear even though not explicit in type - * @throws Throwable - */ + + /** + * G is prohibited, X can appear even though not explicit in type + */ + @Test public void testAttributeGX() throws Throwable { AttrEltDocument doc = AttrEltDocument.Factory.newInstance(); RestrictedAttrT elt = doc.addNewAttrElt(); elt.setG("foobar"); assertTrue(!doc.validate(validateOptions)); showErrors(); - //g prohibited, f missing - String[] errExpected = new String[]{ + //g prohibited, f missing + String[] errExpected = new String[]{ XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NO_WILDCARD, XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_REQUIRED_ATTRIBUTE - }; - assertTrue(compareErrorCodes(errExpected)); + }; + assertTrue(compareErrorCodes(errExpected)); elt.setX("myval"); elt.unsetG(); elt.setF("foobar"); - try { + try { assertTrue(doc.validate(validateOptions)); - } - catch (Throwable t) { + } catch (Throwable t) { showErrors(); throw t; } - } } Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/ElementRestriction.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/ElementRestriction.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/ElementRestriction.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/ElementRestriction.java Fri Jan 18 23:08:44 2019 @@ -14,6 +14,7 @@ */ package scomp.derivation.restriction.detailed; +import org.junit.Test; import xbean.scomp.derivation.elementRestriction.ElementDocument; import xbean.scomp.derivation.elementRestriction.RestrictedEltT; import org.apache.xmlbeans.XmlObject; @@ -22,9 +23,10 @@ import org.apache.xmlbeans.XmlErrorCodes import org.apache.xmlbeans.XmlDecimal; import scomp.common.BaseCase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + -/** - */ public class ElementRestriction extends BaseCase { /** * <xsd:complexType name="SequenceT"> @@ -45,6 +47,7 @@ public class ElementRestriction extends * </xsd:complexContent> * </xsd:complexType> */ + @Test public void testRestrictedElement() throws Throwable { ElementDocument doc = ElementDocument.Factory.newInstance(); RestrictedEltT elt = doc.addNewElement(); @@ -69,7 +72,7 @@ public class ElementRestriction extends XmlErrorCodes.ELEM_LOCALLY_VALID$FIXED_VALID_MIXED_CONTENT, XmlErrorCodes.DATATYPE_FRACTION_DIGITS_VALID, }; - assertTrue(compareErrorCodes(errExpected)); + assertTrue(compareErrorCodes(errExpected)); elt.removeA(2); Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/ElementWCRestriction.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/ElementWCRestriction.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/ElementWCRestriction.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/ElementWCRestriction.java Fri Jan 18 23:08:44 2019 @@ -15,9 +15,14 @@ package scomp.derivation.restriction.detailed; -import scomp.common.BaseCase; -import xbean.scomp.derivation.elementWCRestriction.*; import org.apache.xmlbeans.XmlErrorCodes; +import org.junit.Test; +import scomp.common.BaseCase; +import xbean.scomp.derivation.elementWCRestriction.ConcreteEltDocument; +import xbean.scomp.derivation.elementWCRestriction.OtherLaxDocument; +import xbean.scomp.derivation.elementWCRestriction.UriSkipDocument; + +import static org.junit.Assert.assertTrue; /** * @@ -27,6 +32,7 @@ import org.apache.xmlbeans.XmlErrorCodes public class ElementWCRestriction extends BaseCase { // max occurs is now 2, not 3 //NS restricted from any to other + @Test public void testMaxOccurs() throws Throwable { String input = "<OtherLax " + @@ -87,6 +93,7 @@ public class ElementWCRestriction extend //elt needs to occur exactly 2x //only URI allowed is GlobalElt + @Test public void testMinOccurs() throws Throwable { String input = "<UriSkip " + @@ -124,6 +131,7 @@ public class ElementWCRestriction extend //WC replaced by elt //maxOccurs is 1 + @Test public void testConcrete() throws Throwable { String input = "<foo:ConcreteElt " + Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/EmptyContentRestriction.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/EmptyContentRestriction.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/EmptyContentRestriction.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/EmptyContentRestriction.java Fri Jan 18 23:08:44 2019 @@ -14,17 +14,19 @@ */ package scomp.derivation.restriction.detailed; -import xbean.scomp.derivation.emtpy.RestrictedEmptyEltDocument; -import xbean.scomp.derivation.emtpy.RestrictedEmptyT; -import scomp.common.BaseCase; import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlErrorCodes; +import org.junit.Test; +import scomp.common.BaseCase; +import xbean.scomp.derivation.emtpy.RestrictedEmptyEltDocument; +import xbean.scomp.derivation.emtpy.RestrictedEmptyT; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; -/** - * - */ public class EmptyContentRestriction extends BaseCase { + @Test public void testRestriction() throws Throwable { RestrictedEmptyEltDocument doc = RestrictedEmptyEltDocument.Factory.newInstance(); @@ -60,7 +62,7 @@ public class EmptyContentRestriction ext errExpected = new String[]{ XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_NOT_ALLOWED }; - assertTrue(compareErrorCodes(errExpected)); + assertTrue(compareErrorCodes(errExpected)); } Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/EnumTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/EnumTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/EnumTest.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/EnumTest.java Fri Jan 18 23:08:44 2019 @@ -15,23 +15,25 @@ package scomp.derivation.restriction.detailed; -import scomp.common.BaseCase; -import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument; import org.apache.xmlbeans.*; +import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument; +import org.junit.Test; +import scomp.common.BaseCase; -import java.util.List; import java.util.ArrayList; import java.util.Collections; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; -/** - * - */ public class EnumTest extends BaseCase { /* * Refer CR199528, CR191369. * This fails in V1 and the case is added here to ensure compliance in v2. */ + @Test public void testEnumRestrictionScomp() throws Exception { String xsdAsString = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + "\n" + Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/GroupRestrictionTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/GroupRestrictionTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/GroupRestrictionTest.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/GroupRestrictionTest.java Fri Jan 18 23:08:44 2019 @@ -14,18 +14,21 @@ */ package scomp.derivation.restriction.detailed; +import org.apache.xmlbeans.XmlErrorCodes; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.derivation.groupRestriction.*; import java.math.BigInteger; -import org.apache.xmlbeans.XmlErrorCodes; +import static org.junit.Assert.assertTrue; /** * */ public class GroupRestrictionTest extends BaseCase { + @Test public void testRestrictSequence() throws Throwable { RestrictedSequenceEltDocument doc = RestrictedSequenceEltDocument.Factory .newInstance(); @@ -51,6 +54,7 @@ public class GroupRestrictionTest extend } + @Test public void testRestrictChoice() throws Throwable { RestrictedChoiceEltDocument doc = RestrictedChoiceEltDocument.Factory .newInstance(); @@ -73,6 +77,7 @@ public class GroupRestrictionTest extend } + @Test public void testRestrictAll() throws Throwable { RestrictedAllEltDocument doc = RestrictedAllEltDocument.Factory .newInstance(); @@ -95,6 +100,7 @@ public class GroupRestrictionTest extend } } + @Test public void testAllToSequence() throws Throwable { All2SeqEltDocument doc = All2SeqEltDocument.Factory.newInstance(); All2SequenceT elt = doc.addNewAll2SeqElt(); @@ -117,6 +123,7 @@ public class GroupRestrictionTest extend } + @Test public void testChoiceToSequence() throws Throwable { Choice2SeqEltDocument doc = Choice2SeqEltDocument.Factory.newInstance(); Choice2SequenceT elt = doc.addNewChoice2SeqElt(); Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/MixedContentRestriction.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/MixedContentRestriction.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/MixedContentRestriction.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/MixedContentRestriction.java Fri Jan 18 23:08:44 2019 @@ -14,6 +14,7 @@ */ package scomp.derivation.restriction.detailed; +import org.junit.Test; import xbean.scomp.derivation.mixedContentRestriction.*; import scomp.common.BaseCase; @@ -23,11 +24,10 @@ import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlErrorCodes; import org.apache.xmlbeans.impl.values.XmlValueNotSupportedException; -/** - * - */ -public class MixedContentRestriction extends BaseCase{ +import static org.junit.Assert.*; +public class MixedContentRestriction extends BaseCase{ + @Test public void testRestrictedMixed() throws Throwable{ MixedEltDocument doc=MixedEltDocument.Factory.newInstance(); RestrictedMixedT elt=doc.addNewMixedElt(); @@ -49,8 +49,9 @@ public class MixedContentRestriction ext 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(); @@ -87,8 +88,9 @@ public class MixedContentRestriction ext } + //seems that this is not a valid example p.329 top - //public void testRestrictedMixedToSimple() throws Throwable{} + @Test public void testRestrictedMixedToEmpty() throws Throwable{ Mixed2EmptyEltDocument doc=Mixed2EmptyEltDocument.Factory.newInstance(); Mixed2EmptyT elt=doc.addNewMixed2EmptyElt(); Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SimpleContentRestrictionTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SimpleContentRestrictionTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SimpleContentRestrictionTest.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SimpleContentRestrictionTest.java Fri Jan 18 23:08:44 2019 @@ -14,15 +14,16 @@ */ package scomp.derivation.restriction.detailed; +import org.apache.xmlbeans.XmlErrorCodes; +import org.junit.Test; +import scomp.common.BaseCase; import xbean.scomp.derivation.simpleExtension.SimpleRestrictionEltDocument; import xbean.scomp.derivation.simpleExtension.SimpleRestrictionT; -import scomp.common.BaseCase; -import org.apache.xmlbeans.XmlErrorCodes; -/** - * - */ +import static org.junit.Assert.assertTrue; + public class SimpleContentRestrictionTest extends BaseCase { + @Test public void testLegalValues() throws Throwable { SimpleRestrictionEltDocument doc = SimpleRestrictionEltDocument.Factory.newInstance(); SimpleRestrictionT elt = doc.addNewSimpleRestrictionElt(); @@ -33,9 +34,9 @@ public class SimpleContentRestrictionTes showErrors(); throw t; } - } + @Test public void testIllegalValues() throws Throwable { SimpleRestrictionEltDocument doc = SimpleRestrictionEltDocument.Factory.newInstance(); SimpleRestrictionT elt = doc.addNewSimpleRestrictionElt(); @@ -48,7 +49,5 @@ public class SimpleContentRestrictionTes XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID }; assertTrue(compareErrorCodes(errExpected)); - - } } Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SimpleTypeRestriction.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SimpleTypeRestriction.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SimpleTypeRestriction.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SimpleTypeRestriction.java Fri Jan 18 23:08:44 2019 @@ -16,35 +16,33 @@ package scomp.derivation.restriction.detailed; +import org.junit.Test; import scomp.common.BaseCase; -import xbean.scomp.derivation.simpleTypeRestriction.SmallPantSizeEltDocument; -import xbean.scomp.derivation.facets.dateTimePattern.DateTimesDocument; import xbean.scomp.derivation.facets.dateTimePattern.DateTimes; -import xbean.scomp.contentType.simpleType.PantSizeEltDocument; -import xbean.scomp.contentType.simpleType.PantSize; +import xbean.scomp.derivation.facets.dateTimePattern.DateTimesDocument; +import xbean.scomp.derivation.simpleTypeRestriction.SmallPantSizeEltDocument; import java.util.Calendar; import java.util.GregorianCalendar; -/** - * - */ +import static org.junit.Assert.assertTrue; + public class SimpleTypeRestriction extends BaseCase{ + @Test public void testPatternRestriction()throws Throwable{ - SmallPantSizeEltDocument doc=SmallPantSizeEltDocument.Factory.newInstance(); - doc.setSmallPantSizeElt(8); - //doc.setSmallPantSizeElt(6); - try { + SmallPantSizeEltDocument doc = SmallPantSizeEltDocument.Factory.newInstance(); + doc.setSmallPantSizeElt(8); + //doc.setSmallPantSizeElt(6); + try { assertTrue(doc.validate(validateOptions)); - } - catch (Throwable t) { + } catch (Throwable t) { showErrors(); throw t; } } - //user-list inspired + @Test public void testDateTimeRestriction() throws Throwable{ DateTimesDocument doc= DateTimesDocument.Factory.newInstance(); Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SubstitutionTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SubstitutionTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SubstitutionTest.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/detailed/SubstitutionTest.java Fri Jan 18 23:08:44 2019 @@ -15,15 +15,15 @@ package scomp.derivation.restriction.detailed; +import org.junit.Test; +import scomp.common.BaseCase; import xbean.scomp.contentType.modelGroup.ChoiceEltDocument; import xbean.scomp.contentType.simpleType.PantSizeEltDocument; -import scomp.common.BaseCase; -/** - * - */ -public class SubstitutionTest extends BaseCase - { +import static org.junit.Assert.assertTrue; + +public class SubstitutionTest extends BaseCase { + @Test public void testSubstitution() throws Throwable{ ChoiceEltDocument doc= ChoiceEltDocument.Factory.parse( @@ -35,7 +35,7 @@ public class SubstitutionTest extends Ba "<child3>50</child3>" + "</foo:ChoiceElt>" ); - try { + try { assertTrue(doc.validate(validateOptions)); } catch (Throwable t) { @@ -44,21 +44,21 @@ public class SubstitutionTest extends Ba } } - 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 { + @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) { + } catch (Throwable t) { showErrors(); throw t; } Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java Fri Jan 18 23:08:44 2019 @@ -15,19 +15,20 @@ package scomp.derivation.restriction.facets.detailed; import org.apache.xmlbeans.XmlErrorCodes; -import xbean.scomp.derivation.facets.facetRestriction.*; +import org.junit.Test; import scomp.common.BaseCase; +import xbean.scomp.derivation.facets.facetRestriction.*; -import java.util.TimeZone; +import java.math.BigDecimal; import java.util.Calendar; import java.util.GregorianCalendar; -import java.math.BigDecimal; +import java.util.TimeZone; -/** - * - */ -public class FacetRestrictionTest extends BaseCase { +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +public class FacetRestrictionTest extends BaseCase { + @Test public void testMinMaxInclusiveElt() throws Throwable { MinMaxInclusiveEltDocument doc = MinMaxInclusiveEltDocument.Factory.newInstance(); @@ -53,57 +54,60 @@ public class FacetRestrictionTest extend assertTrue(compareErrorCodes(errExpected)); } - public void testMinMaxInclusiveDateElt() throws Throwable { - MinMaxInclusiveDateEltDocument doc = - MinMaxInclusiveDateEltDocument.Factory.newInstance(); - TimeZone tz = TimeZone.getDefault(); - Calendar c = new GregorianCalendar(tz); - c.set(2003, 11, 22); - doc.setMinMaxInclusiveDateElt(c); - try { - assertTrue(doc.validate(validateOptions)); - } catch (Throwable t) { - showErrors(); - throw t; - } - c = new GregorianCalendar(2003, 11, 24); - doc.setMinMaxInclusiveDateElt(c); - String[] errExpected = new String[]{ - XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID}; - assertTrue(!doc.validate(validateOptions)); - assertTrue(compareErrorCodes(errExpected)); - + @Test + public void testMinMaxInclusiveDateElt() throws Throwable { + MinMaxInclusiveDateEltDocument doc = + MinMaxInclusiveDateEltDocument.Factory.newInstance(); + TimeZone tz = TimeZone.getDefault(); + Calendar c = new GregorianCalendar(tz); + c.set(2003, 11, 22); + doc.setMinMaxInclusiveDateElt(c); + try { + assertTrue(doc.validate(validateOptions)); + } catch (Throwable t) { + showErrors(); + throw t; + } + c = new GregorianCalendar(2003, 11, 24); + doc.setMinMaxInclusiveDateElt(c); + String[] errExpected = new String[]{ + XmlErrorCodes.DATATYPE_MAX_INCLUSIVE_VALID}; + assertTrue(!doc.validate(validateOptions)); + assertTrue(compareErrorCodes(errExpected)); + } - } + @Test public void testMinMaxExclusiveElt() throws Throwable { - MinMaxExclusiveEltDocument doc = - MinMaxExclusiveEltDocument.Factory.newInstance(); - String[] errExpected = new String[]{ - XmlErrorCodes.DATATYPE_MIN_EXCLUSIVE_VALID}; - - doc.setMinMaxExclusiveElt(3); - assertTrue(!doc.validate(validateOptions)); - assertTrue(compareErrorCodes(errExpected)); - clearErrors(); - - doc.setMinMaxExclusiveElt(4); - try { - assertTrue(doc.validate(validateOptions)); - } catch (Throwable t) { - showErrors(); - throw t; - } - doc.setMinMaxExclusiveElt(8); - try { - assertTrue(doc.validate(validateOptions)); - } catch (Throwable t) { - showErrors(); - throw t; - } + MinMaxExclusiveEltDocument doc = + MinMaxExclusiveEltDocument.Factory.newInstance(); + String[] errExpected = new String[]{ + XmlErrorCodes.DATATYPE_MIN_EXCLUSIVE_VALID}; - } - public void testMinMaxExclusiveDateElt() throws Throwable { + doc.setMinMaxExclusiveElt(3); + assertTrue(!doc.validate(validateOptions)); + assertTrue(compareErrorCodes(errExpected)); + clearErrors(); + + doc.setMinMaxExclusiveElt(4); + try { + assertTrue(doc.validate(validateOptions)); + } catch (Throwable t) { + showErrors(); + throw t; + } + doc.setMinMaxExclusiveElt(8); + try { + assertTrue(doc.validate(validateOptions)); + } catch (Throwable t) { + showErrors(); + throw t; + } + + } + + @Test + public void testMinMaxExclusiveDateElt() throws Throwable { MinMaxExclusiveDateEltDocument doc = MinMaxExclusiveDateEltDocument.Factory.newInstance(); Calendar c = new GregorianCalendar(2003, 11, 24); doc.setMinMaxExclusiveDateElt(c); @@ -111,7 +115,7 @@ public class FacetRestrictionTest extend XmlErrorCodes.DATATYPE_MAX_EXCLUSIVE_VALID}; assertTrue(!doc.validate(validateOptions)); assertTrue(compareErrorCodes(errExpected)); - clearErrors(); + clearErrors(); c = new GregorianCalendar(2003, 11, 23); doc.setMinMaxExclusiveDateElt(c); try { @@ -120,90 +124,68 @@ public class FacetRestrictionTest extend showErrors(); throw t; } - - } - /* - public void testLengthElt() throws Throwable { - LengthEltDocument doc = LengthEltDocument.Factory.newInstance(); - doc.setLengthElt("foobar"); + + @Test + public void testMinMaxLengthElt() throws Throwable { + MinMaxLengthEltDocument doc = MinMaxLengthEltDocument.Factory.newInstance(); String[] errExpected = new String[]{ - XmlErrorCodes.DATATYPE_LENGTH_VALID$STRING}; + XmlErrorCodes.DATATYPE_MAX_LENGTH_VALID$STRING}; + doc.setMinMaxLengthElt("fooba"); assertTrue(!doc.validate(validateOptions)); assertTrue(compareErrorCodes(errExpected)); - doc.setLengthElt("fo"); + doc.setMinMaxLengthElt("fo"); + errExpected = new String[]{ + XmlErrorCodes.DATATYPE_MIN_LENGTH_VALID$STRING}; clearErrors(); assertTrue(!doc.validate(validateOptions)); assertTrue(compareErrorCodes(errExpected)); - doc.setLengthElt("f"); + doc.setMinMaxLengthElt("foo"); try { assertTrue(doc.validate(validateOptions)); } catch (Throwable t) { showErrors(); throw t; } + doc.setMinMaxLengthElt("foob"); + try { + assertTrue(doc.validate(validateOptions)); + } catch (Throwable t) { + showErrors(); + throw t; + } + } - */ - public void testMinMaxLengthElt() throws Throwable { - MinMaxLengthEltDocument doc = MinMaxLengthEltDocument.Factory.newInstance(); - String[] errExpected = new String[]{ - XmlErrorCodes.DATATYPE_MAX_LENGTH_VALID$STRING}; - - doc.setMinMaxLengthElt("fooba"); - assertTrue(!doc.validate(validateOptions)); - assertTrue(compareErrorCodes(errExpected)); - - doc.setMinMaxLengthElt("fo"); - errExpected = new String[]{ - XmlErrorCodes.DATATYPE_MIN_LENGTH_VALID$STRING}; - clearErrors(); - assertTrue(!doc.validate(validateOptions)); - assertTrue(compareErrorCodes(errExpected)); - - doc.setMinMaxLengthElt("foo"); - try { - assertTrue(doc.validate(validateOptions)); - } catch (Throwable t) { - showErrors(); - throw t; - } - doc.setMinMaxLengthElt("foob"); - try { - assertTrue(doc.validate(validateOptions)); - } catch (Throwable t) { - showErrors(); - throw t; - } - } + @Test public void testDigitsElt() throws Throwable { - DigitsEltDocument doc = DigitsEltDocument.Factory.newInstance(); - String[] errExpected = new String[]{ - XmlErrorCodes.DATATYPE_TOTAL_DIGITS_VALID}; - - doc.setDigitsElt(new BigDecimal("122.2")); - assertTrue(!doc.validate(validateOptions)); - assertTrue(compareErrorCodes(errExpected)); - - 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}; - doc.setDigitsElt(new BigDecimal("2.45")); - assertTrue(!doc.validate(validateOptions)); - assertTrue(compareErrorCodes(errExpected)); + DigitsEltDocument doc = DigitsEltDocument.Factory.newInstance(); + String[] errExpected = new String[]{ + XmlErrorCodes.DATATYPE_TOTAL_DIGITS_VALID}; - } + doc.setDigitsElt(new BigDecimal("122.2")); + assertTrue(!doc.validate(validateOptions)); + assertTrue(compareErrorCodes(errExpected)); + + 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}; + doc.setDigitsElt(new BigDecimal("2.45")); + assertTrue(!doc.validate(validateOptions)); + assertTrue(compareErrorCodes(errExpected)); + } + @Test public void testWSElt() throws Throwable { // whiteSpace="replace" case @@ -235,7 +217,8 @@ public class FacetRestrictionTest extend } - public void testEnumElt() throws Throwable { + @Test + public void testEnumElt() throws Throwable { EnumEltDocument doc = EnumEltDocument.Factory.newInstance(); doc.setEnumElt(EnumT.A); try { @@ -245,9 +228,9 @@ public class FacetRestrictionTest extend throw t; } doc = EnumEltDocument.Factory.parse("<EnumElt " + - "xmlns=\"http://xbean/scomp/derivation/facets/FacetRestriction\">" + - "b" + - "</EnumElt>"); + "xmlns=\"http://xbean/scomp/derivation/facets/FacetRestriction\">" + + "b" + + "</EnumElt>"); String[] errExpected = new String[]{ XmlErrorCodes.DATATYPE_ENUM_VALID}; @@ -256,6 +239,7 @@ public class FacetRestrictionTest extend } + @Test public void testPatternElt() throws Throwable { // base pattern is (a[^bc]d){3}, derived pattern is (a[^ef]d){3} @@ -273,7 +257,5 @@ public class FacetRestrictionTest extend doc.setPatternElt("aedafdagd"); assertTrue(!doc.validate(validateOptions)); assertTrue(compareErrorCodes(errExpected)); - - } } Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetsTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetsTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetsTest.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetsTest.java Fri Jan 18 23:08:44 2019 @@ -14,30 +14,23 @@ */ package scomp.derivation.restriction.facets.detailed; +import org.apache.xmlbeans.XmlErrorCodes; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.derivation.facets.facets.*; -import xbean.scomp.derivation.facets.facets.DigitsEltDocument; -import xbean.scomp.derivation.facets.facets.EnumEltDocument; -import xbean.scomp.derivation.facets.facets.EnumT; -import xbean.scomp.derivation.facets.facets.LengthEltDocument; -import xbean.scomp.derivation.facets.facets.MinMaxExclusiveDateEltDocument; -import xbean.scomp.derivation.facets.facets.MinMaxExclusiveEltDocument; -import xbean.scomp.derivation.facets.facets.MinMaxInclusiveDateEltDocument; -import xbean.scomp.derivation.facets.facets.MinMaxInclusiveEltDocument; -import xbean.scomp.derivation.facets.facets.MinMaxLengthEltDocument; -import xbean.scomp.derivation.facets.facets.PatternEltDocument; import java.math.BigDecimal; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.TimeZone; -import org.apache.xmlbeans.XmlErrorCodes; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** */ public class FacetsTest extends BaseCase { - + @Test public void testMinMaxInclusiveElt() throws Throwable { MinMaxInclusiveEltDocument doc = MinMaxInclusiveEltDocument.Factory.newInstance(); @@ -64,6 +57,7 @@ public class FacetsTest extends BaseCase } + @Test public void testMinMaxInclusiveDateElt() throws Throwable { MinMaxInclusiveDateEltDocument doc = MinMaxInclusiveDateEltDocument.Factory.newInstance(); @@ -88,6 +82,7 @@ public class FacetsTest extends BaseCase } //valid range should be 3-9 + @Test public void testMinMaxExclusiveElt() throws Throwable { MinMaxExclusiveEltDocument doc = MinMaxExclusiveEltDocument.Factory.newInstance(); @@ -115,6 +110,7 @@ public class FacetsTest extends BaseCase } //valid range is 12-11 12-24-2003 + @Test public void testMinMaxExclusiveDateElt() throws Throwable { MinMaxExclusiveDateEltDocument doc = MinMaxExclusiveDateEltDocument.Factory.newInstance(); Calendar c = new GregorianCalendar(2003, 11, 25); @@ -136,6 +132,7 @@ public class FacetsTest extends BaseCase } + @Test public void testLengthElt() throws Throwable { LengthEltDocument doc = LengthEltDocument.Factory.newInstance(); doc.setLengthElt("foobar"); @@ -159,6 +156,7 @@ public class FacetsTest extends BaseCase } } + @Test public void testMinMaxLengthElt() throws Throwable { MinMaxLengthEltDocument doc = MinMaxLengthEltDocument.Factory.newInstance(); String[] errExpected = new String[]{ @@ -192,6 +190,7 @@ public class FacetsTest extends BaseCase } + @Test public void testDigitsElt() throws Throwable { DigitsEltDocument doc = DigitsEltDocument.Factory.newInstance(); String[] errExpected = new String[]{ @@ -217,6 +216,7 @@ public class FacetsTest extends BaseCase } + @Test public void testWSElt() throws Throwable { WSPreserveEltDocument doc = WSPreserveEltDocument.Factory.parse("<WSPreserveElt " + "xmlns=\"http://xbean/scomp/derivation/facets/Facets\">" + @@ -236,6 +236,7 @@ public class FacetsTest extends BaseCase assertEquals(expected, doc.getWSPreserveElt()); } + @Test public void testEnumElt() throws Throwable { EnumEltDocument doc = EnumEltDocument.Factory.newInstance(); @@ -257,6 +258,7 @@ public class FacetsTest extends BaseCase } + @Test public void testPatternElt() throws Throwable { PatternEltDocument doc = PatternEltDocument.Factory.newInstance(); doc.setPatternElt("aedaedaed"); Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/ListRestriction.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/ListRestriction.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/ListRestriction.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/ListRestriction.java Fri Jan 18 23:08:44 2019 @@ -14,17 +14,21 @@ */ package scomp.derivation.restriction.facets.detailed; +import org.apache.xmlbeans.XmlErrorCodes; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.derivation.facets.list.*; -import java.util.List; import java.util.ArrayList; +import java.util.List; -import org.apache.xmlbeans.XmlErrorCodes; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** */ public class ListRestriction extends BaseCase { + @Test public void testLengthFacet() throws Throwable { LengthEltDocument doc = LengthEltDocument.Factory.newInstance(); List vals = new ArrayList(); @@ -59,6 +63,7 @@ public class ListRestriction extends Bas } + @Test public void testMinLengthFacet() throws Throwable { String input = "<MinLengthElt xmlns=\"http://xbean/scomp/derivation/facets/List\">" + @@ -96,6 +101,7 @@ public class ListRestriction extends Bas } + @Test public void testMaxLengthFacet() throws Throwable { String input = "<MaxLengthElt xmlns=\"http://xbean/scomp/derivation/facets/List\">" + @@ -125,9 +131,8 @@ public class ListRestriction extends Bas /** * Walmsley, p. 215... - * - * @throws Throwable */ + @Test public void testEnum() throws Throwable { EnumEltDocument doc = EnumEltDocument.Factory.newInstance(); List vals = new ArrayList(); @@ -166,6 +171,7 @@ public class ListRestriction extends Bas } + @Test public void testPattern() throws Throwable { PatternEltDocument doc = PatternEltDocument.Factory.newInstance(); List vals = new ArrayList(); Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/UnionRestriction.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/UnionRestriction.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/UnionRestriction.java (original) +++ xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/UnionRestriction.java Fri Jan 18 23:08:44 2019 @@ -15,6 +15,7 @@ package scomp.derivation.restriction.facets.detailed; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.derivation.facets.union.UnionPatternEltDocument; import xbean.scomp.derivation.facets.union.SmallPatternUnion; @@ -22,12 +23,15 @@ import xbean.scomp.derivation.facets.uni import xbean.scomp.derivation.facets.union.SmallEnumUnion; import org.apache.xmlbeans.XmlErrorCodes; +import static org.junit.Assert.assertTrue; + /** * Only pattern and enumeration restrictions possible * Compile time tests for the rest */ public class UnionRestriction extends BaseCase { + @Test public void testPatternRestriction() throws Throwable { UnionPatternEltDocument doc = UnionPatternEltDocument.Factory.newInstance(); @@ -61,10 +65,9 @@ public class UnionRestriction extends Ba XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID }; assertTrue(compareErrorCodes(errExpected)); - - } + @Test public void testEnumRestriction() throws Throwable { UnionEnumEltDocument doc = UnionEnumEltDocument.Factory.newInstance(); doc.setUnionEnumElt("small"); @@ -97,7 +100,5 @@ public class UnionRestriction extends Ba XmlErrorCodes.DATATYPE_ENUM_VALID }; assertTrue(compareErrorCodes(errExpected)); - - } } Modified: xmlbeans/trunk/test/src/scomp/elements/detailed/AnyTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/elements/detailed/AnyTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/elements/detailed/AnyTest.java (original) +++ xmlbeans/trunk/test/src/scomp/elements/detailed/AnyTest.java Fri Jan 18 23:08:44 2019 @@ -14,6 +14,7 @@ */ package scomp.elements.detailed; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.element.any.AnyEltDocument; import xbean.scomp.element.any.AnySimpleDocument; @@ -24,12 +25,11 @@ import org.apache.xmlbeans.XmlDate; import java.math.BigInteger; import java.util.GregorianCalendar; -/** - * - * - */ +import static org.junit.Assert.assertTrue; + public class AnyTest extends BaseCase { + @Test public void testAny() throws Throwable { AnyEltDocument doc = AnyEltDocument.Factory.newInstance(); BusinessShirtType bst = BusinessShirtType.Factory.newInstance(); @@ -58,10 +58,9 @@ public class AnyTest extends BaseCase { showErrors(); throw t; } - - } + @Test public void testAnySimple() throws Throwable { AnySimpleDocument doc = AnySimpleDocument.Factory.newInstance(); Modified: xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltDefault.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltDefault.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltDefault.java (original) +++ xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltDefault.java Fri Jan 18 23:08:44 2019 @@ -15,20 +15,21 @@ package scomp.elements.detailed; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.element.globalEltDefault.GlobalEltDefaultIntDocument; import xbean.scomp.element.globalEltDefault.GlobalEltDefaultStrDocument; -/** - * - * - */ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + public class GlobalEltDefault extends BaseCase { //empty string is OK considered , so default value is ignored - public void testStringType()throws Throwable{ - GlobalEltDefaultStrDocument testDoc=GlobalEltDefaultStrDocument + @Test + public void testStringType() throws Throwable { + GlobalEltDefaultStrDocument testDoc = GlobalEltDefaultStrDocument .Factory.newInstance(); - assertEquals(null,testDoc.getGlobalEltDefaultStr()); + assertEquals(null, testDoc.getGlobalEltDefaultStr()); /*try{ assertTrue(testDoc.validate(validateOptions)); }catch(Throwable t){ @@ -36,26 +37,27 @@ public class GlobalEltDefault extends Ba throw t; } */ testDoc.setGlobalEltDefaultStr("foo"); - try{ + try { assertTrue(testDoc.validate(validateOptions)); - }catch(Throwable t){ + } catch (Throwable t) { showErrors(); throw t; } - } + } //default value is used - public void testIntType()throws Throwable{ - GlobalEltDefaultIntDocument testDoc - =GlobalEltDefaultIntDocument.Factory - .newInstance(); - assertEquals(0,testDoc.getGlobalEltDefaultInt()); - try{ - assertTrue(testDoc.validate(validateOptions)); -}catch(Throwable t){ - showErrors(); - throw t; -} + @Test + public void testIntType() throws Throwable { + GlobalEltDefaultIntDocument testDoc + = GlobalEltDefaultIntDocument.Factory + .newInstance(); + assertEquals(0, testDoc.getGlobalEltDefaultInt()); + try { + assertTrue(testDoc.validate(validateOptions)); + } catch (Throwable t) { + showErrors(); + throw t; + } } } Modified: xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltFixed.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltFixed.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltFixed.java (original) +++ xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltFixed.java Fri Jan 18 23:08:44 2019 @@ -15,17 +15,17 @@ package scomp.elements.detailed; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.element.globalEltFixed.GlobalEltFixedIntDocument; import xbean.scomp.element.globalEltFixed.GlobalEltFixedStrDocument; import org.apache.xmlbeans.XmlErrorCodes; -/** - * - * - */ -public class GlobalEltFixed extends BaseCase { +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +public class GlobalEltFixed extends BaseCase { + @Test public void testValidPresent() throws Exception { GlobalEltFixedIntDocument testEltInt = GlobalEltFixedIntDocument.Factory.parse("<GlobalEltFixedInt " + "xmlns=\"http://xbean/scomp/element/GlobalEltFixed\"" + @@ -39,6 +39,7 @@ 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 " + @@ -47,6 +48,7 @@ public class GlobalEltFixed extends Base assertTrue(testEltInt.validate()); } + @Test public void testIntTypeInvalid() throws Exception { GlobalEltFixedIntDocument testEltInt = GlobalEltFixedIntDocument .Factory.parse("<GlobalEltFixedInt " + @@ -57,9 +59,9 @@ public class GlobalEltFixed extends Base XmlErrorCodes.DECIMAL }; assertTrue(compareErrorCodes(errExpected)); - } + @Test public void testIntValueInvalid() throws Exception { GlobalEltFixedIntDocument testEltInt = GlobalEltFixedIntDocument.Factory.parse("<GlobalEltFixedInt " + "xmlns=\"http://xbean/scomp/element/GlobalEltFixed\"" + @@ -69,9 +71,9 @@ public class GlobalEltFixed extends Base String[] errExpected = new String[]{ XmlErrorCodes.ELEM_LOCALLY_VALID$FIXED_VALID_SIMPLE_TYPE}; assertTrue(compareErrorCodes(errExpected)); - } + @Test public void testStrValueInvalid() throws Exception { GlobalEltFixedStrDocument testEltStr = GlobalEltFixedStrDocument.Factory.parse("<GlobalEltFixedStr " + "xmlns=\"http://xbean/scomp/element/GlobalEltFixed\"" + @@ -81,8 +83,5 @@ public class GlobalEltFixed extends Base String[] errExpected = new String[]{ XmlErrorCodes.ELEM_LOCALLY_VALID$FIXED_VALID_SIMPLE_TYPE}; assertTrue(compareErrorCodes(errExpected)); - } - - } Modified: xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltId.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltId.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltId.java (original) +++ xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltId.java Fri Jan 18 23:08:44 2019 @@ -15,22 +15,21 @@ package scomp.elements.detailed; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.element.globalEltDefault.IDElementDocument; -/** - * - * - */ +import static org.junit.Assert.assertTrue; + public class GlobalEltId extends BaseCase{ - public void testRun()throws Throwable{ - IDElementDocument doc= - IDElementDocument.Factory.newInstance(); + @Test + public void testRun() throws Throwable { + IDElementDocument doc = + IDElementDocument.Factory.newInstance(); doc.addNewIDElement().setID("IDAttr"); - try { - assertTrue( doc.validate(validateOptions)) ; - } - catch (Throwable t) { + try { + assertTrue(doc.validate(validateOptions)); + } catch (Throwable t) { showErrors(); throw t; } Modified: xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltNillable.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltNillable.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltNillable.java (original) +++ xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltNillable.java Fri Jan 18 23:08:44 2019 @@ -15,20 +15,19 @@ package scomp.elements.detailed; -import scomp.common.BaseCase; -import xbean.scomp.element.globalEltNillable.*; -import org.apache.xmlbeans.impl.values.XmlValueNotNillableException; import org.apache.xmlbeans.XmlErrorCodes; import org.apache.xmlbeans.XmlOptions; +import org.apache.xmlbeans.impl.values.XmlValueNotNillableException; +import org.junit.Test; +import scomp.common.BaseCase; +import xbean.scomp.element.globalEltNillable.*; + +import static org.junit.Assert.*; -/** - * - * - */ public class GlobalEltNillable extends BaseCase { //xsi:nil illegal in instance if the elt is not nillable - + @Test public void testNillableFalse() throws Exception { GlobalEltNotNillableDocument testElt = GlobalEltNotNillableDocument .Factory.parse("<GlobalEltNotNillable" + @@ -40,8 +39,6 @@ public class GlobalEltNillable extends B String[] errExpected = new String[]{ XmlErrorCodes.ELEM_LOCALLY_VALID$NOT_NILLABLE}; assertTrue(compareErrorCodes(errExpected)); - - } /** @@ -51,11 +48,9 @@ public class GlobalEltNillable extends B * setXXX(null) will clear the value of the * XXX attribute/element and if the container is an * element, will also add the "xsi:nil" attribute. - - * - * @throws Exception */ - public void testNotNillable() throws Exception { + @Test + public void testNotNillable() { // XmlValueNotNillableException should be thrown only when validateOnSet property is set XmlOptions options = new XmlOptions(); @@ -70,7 +65,7 @@ public class GlobalEltNillable extends B catch (XmlValueNotNillableException e) { } - try { + try { testElt.set(null); fail("Expected XmlValueNotNillableException"); } @@ -91,10 +86,11 @@ public class GlobalEltNillable extends B new String[]{ XmlErrorCodes.ELEM_LOCALLY_VALID$NOT_NILLABLE}; assertTrue(compareErrorCodes(errExpected)); -} + } //for nillable, fixed value cannot be specified (instance error) : // Walmsley p.137 footnote + @Test public void testNillableFixed() throws Exception { GlobalEltNillableFixedDocument testElt = GlobalEltNillableFixedDocument .Factory.parse("<GlobalEltNillableFixed" + @@ -107,10 +103,9 @@ public class GlobalEltNillable extends B showErrors(); String[] errExpected = new String[]{XmlErrorCodes.ELEM_LOCALLY_VALID$NIL_WITH_FIXED}; assertTrue(compareErrorCodes(errExpected)); - - } + @Test public void testNillableInt() throws Exception { GlobalEltNillableIntDocument testElt = GlobalEltNillableIntDocument .Factory.parse("<GlobalEltNillableInt" + @@ -142,6 +137,7 @@ public class GlobalEltNillable extends B //default value not filled in for nillable elts when xsi:nil=true // $TODO: check w/ Kevin--what is the value of a nillable attr if it's a primitive type???? + @Test public void testNillableDefault() throws Exception { GlobalEltNillableDefaultDocument testElt = GlobalEltNillableDefaultDocument .Factory.parse("<GlobalEltNillableDefault" + @@ -160,6 +156,7 @@ public class GlobalEltNillable extends B // An element with xsi:nil="true" may not have any element content but it // may still carry attributes. + @Test public void testComplexNillable() throws Throwable { GlobalEltComplexDocument testElt = GlobalEltComplexDocument .Factory.parse("<GlobalEltComplex" + @@ -191,8 +188,8 @@ public class GlobalEltNillable extends B /** calling setNil should inserts * attr and delete value - * @throws Throwable */ + @Test public void testDelete() throws Throwable{ GlobalEltComplexDocument testElt = GlobalEltComplexDocument .Factory.parse("<pre:GlobalEltComplex" + Modified: xmlbeans/trunk/test/src/scomp/elements/detailed/LocalEltMinMaxOccurs.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/elements/detailed/LocalEltMinMaxOccurs.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/elements/detailed/LocalEltMinMaxOccurs.java (original) +++ xmlbeans/trunk/test/src/scomp/elements/detailed/LocalEltMinMaxOccurs.java Fri Jan 18 23:08:44 2019 @@ -14,10 +14,14 @@ */ package scomp.elements.detailed; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.element.localEltMinMaxOccurs.MinMaxOccursDocDocument; import org.apache.xmlbeans.XmlErrorCodes; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + /** * */ @@ -42,11 +46,13 @@ public class LocalEltMinMaxOccurs extend } + @Test public void testMinGTMaxOccurs() { //compile time error raised correctly. Same for neg values } // twoToFour occurs only once + @Test public void testInstanceLTMinOccurs() throws Exception { MinMaxOccursDocDocument testDoc = MinMaxOccursDocDocument .Factory.parse("<MinMaxOccursDoc" + @@ -56,16 +62,17 @@ public class LocalEltMinMaxOccurs extend "<twoToFour>1</twoToFour>" + "</MinMaxOccursDoc>"); assertTrue(!testDoc.validate(validateOptions)); - assertEquals(1,errorList.size()); + assertEquals(1, errorList.size()); showErrors(); String[] errExpected = new String[]{ XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT }; - assertTrue(compareErrorCodes(errExpected)); + assertTrue(compareErrorCodes(errExpected)); } // maxOccursOne occurs 2ce + @Test public void testInstanceGTMaxOccurs() throws Exception { MinMaxOccursDocDocument testDoc = MinMaxOccursDocDocument .Factory.parse("<MinMaxOccursDoc" + @@ -76,17 +83,17 @@ public class LocalEltMinMaxOccurs extend "<twoToFour>1</twoToFour>" + "<twoToFour>1</twoToFour>" + "</MinMaxOccursDoc>"); - assertEquals(0,errorList.size()); - assertTrue(!testDoc.validate(validateOptions)); - assertEquals(1,errorList.size()); - //TODO: why is this not element not allowed? + assertEquals(0, errorList.size()); + assertTrue(!testDoc.validate(validateOptions)); + assertEquals(1, errorList.size()); + //TODO: why is this not element not allowed? String[] errExpected = new String[]{ XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT}; - assertTrue(compareErrorCodes(errExpected)); + assertTrue(compareErrorCodes(errExpected)); - //fail("Error is incorrect: the dev infers the cause... incorrectly"); - showErrors(); + //fail("Error is incorrect: the dev infers the cause... incorrectly"); + showErrors(); } } Modified: xmlbeans/trunk/test/src/scomp/elements/detailed/NamedModelGroupsTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/elements/detailed/NamedModelGroupsTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/elements/detailed/NamedModelGroupsTest.java (original) +++ xmlbeans/trunk/test/src/scomp/elements/detailed/NamedModelGroupsTest.java Fri Jan 18 23:08:44 2019 @@ -14,35 +14,35 @@ */ package scomp.elements.detailed; +import org.junit.Test; import scomp.common.BaseCase; -import xbean.scomp.element.namedModelGroup.EmployeePerformanceDocument; import xbean.scomp.element.namedModelGroup.EmployeePerf; +import xbean.scomp.element.namedModelGroup.EmployeePerformanceDocument; import xbean.scomp.element.namedModelGroup.ManagerDocument; -import java.util.GregorianCalendar; import java.math.BigDecimal; import java.math.BigInteger; +import java.util.GregorianCalendar; + +import static org.junit.Assert.assertTrue; -/** - * - */ public class NamedModelGroupsTest extends BaseCase{ + @Test public void testValid() throws Throwable{ - EmployeePerformanceDocument doc= - EmployeePerformanceDocument.Factory.newInstance(); - EmployeePerf elt= doc.addNewEmployeePerformance(); - ManagerDocument.Manager m=elt.addNewManager(); - m.setDepartment("Marketing"); - m.setLastName("Smith"); + EmployeePerformanceDocument doc = + EmployeePerformanceDocument.Factory.newInstance(); + EmployeePerf elt = doc.addNewEmployeePerformance(); + ManagerDocument.Manager m = elt.addNewManager(); + m.setDepartment("Marketing"); + m.setLastName("Smith"); - elt.setComment("Horrible performance by employee Potatohead"); - elt.setDate(new GregorianCalendar(2004,8,12)); - elt.setGrade(new BigDecimal(new BigInteger("10"))); - elt.setManager(m); - try { - assertTrue( doc.validate(validateOptions)) ; - } - catch (Throwable t) { + elt.setComment("Horrible performance by employee Potatohead"); + elt.setDate(new GregorianCalendar(2004, 8, 12)); + elt.setGrade(new BigDecimal(new BigInteger("10"))); + elt.setManager(m); + try { + assertTrue(doc.validate(validateOptions)); + } catch (Throwable t) { showErrors(); throw t; } Modified: xmlbeans/trunk/test/src/scomp/elements/detailed/NillTest.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/elements/detailed/NillTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/elements/detailed/NillTest.java (original) +++ xmlbeans/trunk/test/src/scomp/elements/detailed/NillTest.java Fri Jan 18 23:08:44 2019 @@ -14,12 +14,13 @@ */ package scomp.elements.detailed; +import org.apache.xmlbeans.XmlOptions; +import org.apache.xmlbeans.impl.values.XmlValueNotNillableException; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.element.nillTest.*; -import org.apache.xmlbeans.impl.values.XmlValueNotNillableException; -import org.apache.xmlbeans.XmlOptions; -import java.math.BigInteger; +import static org.junit.Assert.*; /** @@ -37,6 +38,7 @@ public class NillTest extends BaseCase { * element, will also add the "xsi:nil" attribute. */ // for all nillable tests, the validation falls thro only if the ValidateOnSet option is turned on + @Test public void testNotNillableLocalElem() { XmlOptions options = new XmlOptions(); @@ -68,6 +70,7 @@ public class NillTest extends BaseCase { } + @Test public void testNotNillableGlobalElem() { XmlOptions options = new XmlOptions(); options.setValidateOnSet(); @@ -98,6 +101,7 @@ public class NillTest extends BaseCase { cityNameWithValidateOff.xmlText()); } + @Test public void testNillableGlobalElement() { XmlOptions options = new XmlOptions(); @@ -134,10 +138,9 @@ public class NillTest extends BaseCase { "xmlns:nil=\"http://xbean/scomp/element/NillTest\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>", testElt.xmlText()); - - } + @Test public void testNillableLocalElement() { XmlOptions options = new XmlOptions(); @@ -172,10 +175,9 @@ public class NillTest extends BaseCase { "xsi:nil=\"true\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>", contactWithValidationOff.xmlText()); - - } + @Test public void testDefaultValElement() { XmlOptions options = new XmlOptions(); @@ -195,6 +197,7 @@ public class NillTest extends BaseCase { } } + @Test public void testNotNillableFixedValueElement() { XmlOptions options = new XmlOptions(); Modified: xmlbeans/trunk/test/src/scomp/idConstraint/detailed/KeyKeyref.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/scomp/idConstraint/detailed/KeyKeyref.java?rev=1851656&r1=1851655&r2=1851656&view=diff ============================================================================== --- xmlbeans/trunk/test/src/scomp/idConstraint/detailed/KeyKeyref.java (original) +++ xmlbeans/trunk/test/src/scomp/idConstraint/detailed/KeyKeyref.java Fri Jan 18 23:08:44 2019 @@ -15,18 +15,17 @@ package scomp.idConstraint.detailed; +import org.apache.xmlbeans.XmlErrorCodes; +import org.apache.xmlbeans.XmlString; +import org.junit.Test; import scomp.common.BaseCase; import xbean.scomp.idConstraint.constraint.*; -import org.apache.xmlbeans.XmlString; -import org.apache.xmlbeans.XmlErrorCodes; -/** - * - * - * - */ +import static org.junit.Assert.assertTrue; + public class KeyKeyref extends BaseCase { + @Test public void testUnique() throws Throwable { String input = "<con:productList xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\">" + @@ -52,9 +51,8 @@ public class KeyKeyref extends BaseCase /** * field combo not unique in instance (a and c are the same) - * - * @throws Throwable */ + @Test public void testUniqueIllegal() throws Throwable { ProductListDocument doc = ProductListDocument.Factory.newInstance(); ProductListType products = ProductListType.Factory.newInstance(); @@ -90,9 +88,8 @@ public class KeyKeyref extends BaseCase /** * Selector selects a non-unique field in instance * Only one dept can appear in the first product - * - * @throws Throwable */ + @Test public void testUniqueIllegal2() throws Throwable { String input = "<con:productList xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\">" + @@ -115,6 +112,7 @@ public class KeyKeyref extends BaseCase } + @Test public void testKey() throws Throwable { String input = "<con:KeyProductList xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\">" + @@ -139,9 +137,8 @@ public class KeyKeyref extends BaseCase /** * null key in instance:missing dept in first product - * - * @throws Throwable */ + @Test public void testKeyIllegal() throws Throwable { String input = "<xs:KeyProductList xmlns:xs=\"http://xbean/scomp/idConstraint/Constraint\">" + @@ -168,6 +165,7 @@ public class KeyKeyref extends BaseCase } + @Test public void testKeyRef() throws Throwable { String input = "<con:CompanyDB xmlns:con=\"http://xbean/scomp/idConstraint/Constraint\">" + @@ -209,6 +207,7 @@ public class KeyKeyref extends BaseCase // Invalid xml instance with 2 problems : // a) the values for the key & key ref elems are not the same // b) The keyref/key elems are duplicated + @Test public void testKeyRefIllegal() throws Throwable { String input = --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
