poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1851656 [18/28] - in /xmlbeans/trunk: ./ external/ lib/ resources/ resources/typeimpl/ resources/typeimpl/org/ resources/typeimpl/org/apache/ resources/typeimpl/org/apache/xmlbeans/ resources/typeimpl/org/apache/xmlbeans/impl/ resources/ty...
Date Fri, 18 Jan 2019 23:08:48 GMT
Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/CursorGeneratedTypedObjectTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/CursorGeneratedTypedObjectTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/CursorGeneratedTypedObjectTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/CursorGeneratedTypedObjectTest.java Fri Jan 18 23:08:44 2019
@@ -13,17 +13,13 @@
  *  limitations under the License.
  */
 
-package  xmlcursor.detailed;
+package xmlcursor.detailed;
 
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlCursor.TokenType;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import tools.util.JarUtil;
-import xmlcursor.common.Common;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.Test;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument;
 import org.tranxml.tranXML.version40.CodeList309;
 import org.tranxml.tranXML.version40.GeographicLocationDocument;
@@ -31,67 +27,52 @@ import org.tranxml.tranXML.version40.Loc
 import person.Person;
 import person.PersonDocument;
 import test.xbean.xmlcursor.location.LocationDocument;
+import tools.util.JarUtil;
+import xmlcursor.common.Common;
 
 import javax.xml.namespace.QName;
 
+import static org.junit.Assert.*;
 
-/**
- * 
- *
- */
-public class CursorGeneratedTypedObjectTest extends TestCase {
-    public CursorGeneratedTypedObjectTest(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(CursorGeneratedTypedObjectTest.class);
-    }
-
-    public void testClassPath() throws Exception {
-        String sClassPath = System.getProperty("java.class.path");
-        int i = sClassPath.indexOf(Common.CARLOCATIONMESSAGE_JAR);
-        assertTrue(i >= 0);
-        i = sClassPath.indexOf(Common.XMLCURSOR_JAR);
-        assertTrue(i >= 0);
-    }
 
+public class CursorGeneratedTypedObjectTest {
+    @Test
     public void testGetObjectValidateLocation() throws Exception {
         String sNamespace = "xmlns:loc=\"http://xbean.test/xmlcursor/Location\"";
         String sXml =
-                "<loc:Location " + sNamespace + ">" +
-                "<loc:CityName>DALLAS</loc:CityName>" +
-                "<loc:StateCode>TX</loc:StateCode>" +
-                "</loc:Location>";
+            "<loc:Location " + sNamespace + ">" +
+            "<loc:CityName>DALLAS</loc:CityName>" +
+            "<loc:StateCode>TX</loc:StateCode>" +
+            "</loc:Location>";
         LocationDocument locDoc = LocationDocument.Factory.parse(sXml);
         XmlCursor xc = locDoc.newCursor();
         xc.toFirstChild();
         LocationDocument.Location loc = (LocationDocument.Location) xc.getObject();
-        assertEquals(true, loc.validate());
+        assertTrue(loc.validate());
         XmlCursor xc0 = xc.newCursor();
 
         xc0.toEndDoc();
         xc0.toPrevToken();
-      //  xc0.insertElementWithText("SubdivisionCode", "xyz");
+        //  xc0.insertElementWithText("SubdivisionCode", "xyz");
         xc0.insertElementWithText(
-                new QName("http://xbean.test/xmlcursor/Location","SubdivisionCode","loc"),
-                "xyz");
+            new QName("http://xbean.test/xmlcursor/Location", "SubdivisionCode", "loc"),
+            "xyz");
         xc0.toCursor(xc);
 
 
         String sExpectedXML =
-                "<loc:Location " + sNamespace + ">" +
-                "<loc:CityName>DALLAS</loc:CityName>" +
-                "<loc:StateCode>TX</loc:StateCode>" +
-                "<loc:SubdivisionCode>xyz</loc:SubdivisionCode>" +
-                "</loc:Location>";
+            "<loc:Location " + sNamespace + ">" +
+            "<loc:CityName>DALLAS</loc:CityName>" +
+            "<loc:StateCode>TX</loc:StateCode>" +
+            "<loc:SubdivisionCode>xyz</loc:SubdivisionCode>" +
+            "</loc:Location>";
 
         String sOExpectedXML =
-                "<xml-fragment " + sNamespace + ">" +
-               "<loc:CityName>DALLAS</loc:CityName>" +
-                "<loc:StateCode>TX</loc:StateCode>" +
-               "<loc:SubdivisionCode>xyz</loc:SubdivisionCode>" +
-        "</xml-fragment>";
+            "<xml-fragment " + sNamespace + ">" +
+            "<loc:CityName>DALLAS</loc:CityName>" +
+            "<loc:StateCode>TX</loc:StateCode>" +
+            "<loc:SubdivisionCode>xyz</loc:SubdivisionCode>" +
+            "</xml-fragment>";
         XmlOptions map = new XmlOptions();
         //map.put(XmlOptions.SAVE_PRETTY_PRINT, "");
         //map.put(XmlOptions.SAVE_PRETTY_PRINT_INDENT, new Integer(-1));
@@ -99,30 +80,30 @@ public class CursorGeneratedTypedObjectT
             assertEquals(sExpectedXML, xc0.xmlText(map));
             loc = (LocationDocument.Location) xc0.getObject();
             assertEquals(sOExpectedXML, loc.xmlText());
-            assertEquals(true, loc.validate());
+            assertTrue(loc.validate());
             assertEquals("DALLAS", loc.getCityName());
             assertEquals("TX", loc.getStateCode());
             assertEquals("xyz", loc.getSubdivisionCode());
-        }
-        finally {
+        } finally {
             xc.dispose();
             xc0.dispose();
         }
 
     }
 
+    @Test
     public void testGetObjectGL() throws Exception {
         String sNamespace = "xmlns=\"http://www.tranxml.org/TranXML/Version4.0\" xmlns:xsi=\"http://www.w3.org/2000/10/XMLSchema-instance\"";
         CarLocationMessageDocument clm = CarLocationMessageDocument.Factory.parse(
-                JarUtil.getResourceFromJar(
-                        Common.TRANXML_FILE_CLM));
+            JarUtil.getResourceFromJar(
+                Common.TRANXML_FILE_CLM));
         XmlCursor xc = clm.newCursor();
         xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT +
-                "$this//GeographicLocation");
+                      "$this//GeographicLocation");
         xc.toNextSelection();
 
         GeographicLocationDocument.GeographicLocation gl0 = (GeographicLocationDocument.GeographicLocation) xc.getObject();
-        assertEquals(true, gl0.validate());
+        assertTrue(gl0.validate());
 
         XmlCursor xc0 = xc.newCursor();
         try {
@@ -135,40 +116,40 @@ public class CursorGeneratedTypedObjectT
             assertEquals(TokenType.END, xc0.currentTokenType());
 
             xc0.beginElement("LocationIdentifier",
-                    "http://www.tranxml.org/TranXML/Version4.0");
+                "http://www.tranxml.org/TranXML/Version4.0");
             xc0.insertAttributeWithValue("Qualifier", "FR");
             xc0.toEndToken();
             xc0.toNextToken();//move past the end token
             xc0.insertElementWithText("CountrySubdivisionCode",
-                    "http://www.tranxml.org/TranXML/Version4.0", "xyz");
+                "http://www.tranxml.org/TranXML/Version4.0", "xyz");
             xc0.toCursor(xc);
 
             String sExpectedXML =
-                    "<GeographicLocation "+sNamespace+">\n" +
-                    "\t\t\t<CityName>DALLAS</CityName>\n" +
-                    "\t\t\t<StateOrProvinceCode>TX</StateOrProvinceCode>\n"+
-                   "\t\t<LocationIdentifier Qualifier=\"FR\"/><CountrySubdivisionCode>xyz</CountrySubdivisionCode>" +
-                    "</GeographicLocation>";
-
-                    XmlOptions map = new XmlOptions();
-          //  map.put(XmlOptions.SAVE_PRETTY_PRINT, "");
-          //  map.put(XmlOptions.SAVE_PRETTY_PRINT_INDENT, new Integer(-1));
+                "<GeographicLocation " + sNamespace + ">\n" +
+                "\t\t\t<CityName>DALLAS</CityName>\n" +
+                "\t\t\t<StateOrProvinceCode>TX</StateOrProvinceCode>\n" +
+                "\t\t<LocationIdentifier Qualifier=\"FR\"/><CountrySubdivisionCode>xyz</CountrySubdivisionCode>" +
+                "</GeographicLocation>";
+
+            XmlOptions map = new XmlOptions();
+            //  map.put(XmlOptions.SAVE_PRETTY_PRINT, "");
+            //  map.put(XmlOptions.SAVE_PRETTY_PRINT_INDENT, new Integer(-1));
             assertEquals(sExpectedXML, xc0.xmlText());
 
             String sOExpectedXML =
-                    "<xml-fragment xmlns:xsi=\"http://www.w3.org/2000/10/XMLSchema-instance\">\n" +
-                    "\t\t\t<ver:CityName xmlns:ver=\"http://www.tranxml.org/TranXML/Version4.0\">" +
-                    "DALLAS</ver:CityName>\n" +
-                    "\t\t\t<ver:StateOrProvinceCode xmlns:ver=\"http://www.tranxml.org/TranXML/Version4.0\">" +
-                    "TX</ver:StateOrProvinceCode>\n" +
-                    "\t\t<ver:LocationIdentifier Qualifier=\"FR\" " +
-                    "xmlns:ver=\"http://www.tranxml.org/TranXML/Version4.0\"/>" +
-                    "<ver:CountrySubdivisionCode xmlns:ver=\"http://www.tranxml.org/TranXML/Version4.0\">xyz" +
-                    "</ver:CountrySubdivisionCode></xml-fragment>";
+                "<xml-fragment xmlns:xsi=\"http://www.w3.org/2000/10/XMLSchema-instance\">\n" +
+                "\t\t\t<ver:CityName xmlns:ver=\"http://www.tranxml.org/TranXML/Version4.0\">" +
+                "DALLAS</ver:CityName>\n" +
+                "\t\t\t<ver:StateOrProvinceCode xmlns:ver=\"http://www.tranxml.org/TranXML/Version4.0\">" +
+                "TX</ver:StateOrProvinceCode>\n" +
+                "\t\t<ver:LocationIdentifier Qualifier=\"FR\" " +
+                "xmlns:ver=\"http://www.tranxml.org/TranXML/Version4.0\"/>" +
+                "<ver:CountrySubdivisionCode xmlns:ver=\"http://www.tranxml.org/TranXML/Version4.0\">xyz" +
+                "</ver:CountrySubdivisionCode></xml-fragment>";
 
             GeographicLocationDocument.GeographicLocation gl = (GeographicLocationDocument.GeographicLocation) xc0.getObject();
             assertEquals(sOExpectedXML, gl.xmlText(map));
-            assertEquals(true, gl.validate());
+            assertTrue(gl.validate());
 
 
             assertEquals("DALLAS", gl.getCityName().getStringValue());
@@ -176,25 +157,20 @@ public class CursorGeneratedTypedObjectT
             LocationIdentifierDocument.LocationIdentifier li = gl.getLocationIdentifier();
             assertNotNull("LocationIdentifier unexpectedly null", li);
             assertEquals(CodeList309.FR,
-                    gl.getLocationIdentifier().getQualifier());
+                gl.getLocationIdentifier().getQualifier());
             assertEquals("xyz", gl.getCountrySubdivisionCode());
-        }
-        finally {
+        } finally {
             xc.dispose();
             xc0.dispose();
         }
     }
 
 
-    /**
-     * Method testGetObjectPerson
-     *
-     * @throws Exception
-     */
+    @Test
     public void testGetObjectPerson() throws Exception {
         String sFF = "<First>Fred</First><Last>Flintstone</Last>";
         String sXml = "<Person xmlns=\"person\"><Name>" + sFF +
-                "</Name></Person>";
+                      "</Name></Person>";
         XmlCursor xc = XmlObject.Factory.parse(sXml).newCursor();
         PersonDocument pdoc = (PersonDocument) xc.getObject();
 
@@ -203,7 +179,7 @@ public class CursorGeneratedTypedObjectT
 
         try {
             Person p = (Person) xc.getObject();
-            assertEquals(true, p.validate());
+            assertTrue(p.validate());
             // move to </Person>
             xc.toEndToken();
 
@@ -215,7 +191,7 @@ public class CursorGeneratedTypedObjectT
             xc.insertElementWithText("Last", "person", "Rubble");
 
             p = (Person) xcPlaceHolder.getObject();
-            assertEquals(true, p.validate());
+            assertTrue(p.validate());
 
             assertEquals("Fred", p.getName().getFirst());
             assertEquals("Flintstone", p.getName().getLast());
@@ -223,13 +199,9 @@ public class CursorGeneratedTypedObjectT
             assertEquals(1, ap.length);
             assertEquals("Barney", ap[0].getName().getFirst());
             assertEquals("Rubble", ap[0].getName().getLast());
-        }
-        finally {
+        } finally {
             xc.dispose();
             xcPlaceHolder.dispose();
         }
     }
-
-
 }
-

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/CursorLocations.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/CursorLocations.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/CursorLocations.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/CursorLocations.java Fri Jan 18 23:08:44 2019
@@ -16,11 +16,10 @@
 
 package xmlcursor.detailed;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlCursor.TokenType;
 import org.apache.xmlbeans.XmlObject;
+import org.junit.Test;
 import test.xbean.xmlcursor.purchaseOrder.PurchaseOrderDocument;
 import test.xbean.xmlcursor.purchaseOrder.PurchaseOrderType;
 import test.xbean.xmlcursor.purchaseOrder.USAddress;
@@ -30,22 +29,13 @@ import xmlcursor.common.Common;
 
 import java.math.BigDecimal;
 
-/**
- *
- *
- */
+import static org.junit.Assert.*;
+
 public class CursorLocations extends BasicCursorTestCase {
 
     private Bookmark0 _theBookmark0 = new Bookmark0("value0");
 
-    public CursorLocations(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(CursorLocations.class);
-    }
-
+    @Test(expected = IllegalArgumentException.class)
     public void testLocation() throws Exception {
         XmlCursor xc1, xc2, xc3, xc4;
         XmlObject m_xo1;
@@ -68,11 +58,11 @@ public class CursorLocations extends Bas
        //start w/ xc1 at beg of doc
         //xc2 at end of first elt (po:name)
         while (xc1.isLeftOf(xc2)) {
-            assertEquals(false, xc1.isRightOf(xc2));
-            assertEquals(true, xc2.isRightOf(xc1));
-            assertEquals(true, xc1.isInSameDocument(xc2));
-            assertEquals(false, xc2.isAtSamePositionAs(xc1));
-            assertEquals(false, xc1.isAtSamePositionAs(xc2));
+            assertFalse(xc1.isRightOf(xc2));
+            assertTrue(xc2.isRightOf(xc1));
+            assertTrue(xc1.isInSameDocument(xc2));
+            assertFalse(xc2.isAtSamePositionAs(xc1));
+            assertFalse(xc1.isAtSamePositionAs(xc2));
             assertEquals(1, xc2.comparePosition(xc1));
             assertEquals(-1, xc1.comparePosition(xc2));
             //	System.out.println(xc1.currentTokenType() + "       " +  xc2.currentTokenType());
@@ -94,29 +84,29 @@ public class CursorLocations extends Bas
         assertEquals(xc1.getChars(), xc1.getTextValue());
         assertEquals(xc1.getChars(), xc2.getTextValue());
 
-        assertEquals(true, xc1.isAtSamePositionAs(xc2));
+        assertTrue(xc1.isAtSamePositionAs(xc2));
         xc2.toNextChar(10);
 
 
 //comparing two cursors in the middle of text
 
         assertEquals(xc2.toPrevChar(4), xc1.toNextChar(4));
-        assertEquals(true, xc2.isRightOf(xc1));
-        assertEquals(false, xc1.isRightOf(xc2));
-        assertEquals(false, xc2.isLeftOf(xc1));
-        assertEquals(false, xc1.isAtSamePositionAs(xc2));
+        assertTrue(xc2.isRightOf(xc1));
+        assertFalse(xc1.isRightOf(xc2));
+        assertFalse(xc2.isLeftOf(xc1));
+        assertFalse(xc1.isAtSamePositionAs(xc2));
         assertEquals(1, xc2.comparePosition(xc1));
-        assertEquals(true, xc1.isInSameDocument(xc2));
+        assertTrue(xc1.isInSameDocument(xc2));
         xc1.toNextChar(2);
         assertEquals(0, xc2.comparePosition(xc1));
         assertEquals(xc1.currentTokenType(), xc2.currentTokenType());
 
-//Comparing the same cursor to itself
+        //Comparing the same cursor to itself
         xc1.toNextChar(1);
-        assertEquals(false, xc1.isRightOf(xc1));
+        assertFalse(xc1.isRightOf(xc1));
         assertEquals(0, xc2.comparePosition(xc2));
-        assertEquals(true, xc2.isInSameDocument(xc2));
-        assertEquals(true, xc2.isAtSamePositionAs(xc2));
+        assertTrue(xc2.isInSameDocument(xc2));
+        assertTrue(xc2.isAtSamePositionAs(xc2));
 
         xc2.toPrevToken();
         //xc2 on Alice
@@ -126,37 +116,35 @@ public class CursorLocations extends Bas
 
         //moving xml and bookmark to a
         // different location
-        assertEquals(true, xc1.moveXml(xc3));
+        assertTrue(xc1.moveXml(xc3));
         xc4 = _theBookmark0.createCursor();
+        assertNotNull(xc4);
 
         XmlCursor debug=xc4.newCursor();
         XmlCursor debug1=xc1.newCursor();
 
-         toPrevTokenOfType(debug1,TokenType.START);
-        assertEquals(true, xc4.isInSameDocument(xc3));
+        toPrevTokenOfType(debug1,TokenType.START);
+        assertTrue(xc4.isInSameDocument(xc3));
         assertEquals(-1, xc4.comparePosition(xc3));
-      //  assertEquals(TokenType.TEXT, xc3.toPrevToken());
+        // assertEquals(TokenType.TEXT, xc3.toPrevToken());
         assertEquals(4,xc3.toPrevChar(4));
         assertEquals(0, xc4.comparePosition(xc3));
 
-//comparing in  two different documents
-        assertEquals(false, xc2.isInSameDocument(xc3));
+        //comparing in  two different documents
+        assertFalse(xc2.isInSameDocument(xc3));
 
 
         try {
             xc4.isLeftOf(xc2);
-            fail("Expecting Illegal Argument Exception");
+        } finally {
+            xc1.dispose();
+            xc2.dispose();
+            xc3.dispose();
+            xc4.dispose();
         }
-        catch (IllegalArgumentException ie) {
-        }
-
-        xc1.dispose();
-        xc2.dispose();
-        xc3.dispose();
-        xc4.dispose();
-
     }
 
+    @Test
     public void testLocationATTR() throws Exception {
         XmlCursor xc1, xc2;
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_5ATTR_TEXT);
@@ -176,22 +164,22 @@ public class CursorLocations extends Bas
         assertEquals(5, i);
         xc2.toPrevToken();
 
-//moving betweenAttributes. one cursor is at the last ATTR and other is at first ATTR.
+        //moving betweenAttributes. one cursor is at the last ATTR and other is at first ATTR.
         while (xc1.isLeftOf(xc2)) {
-            assertEquals(false, xc1.isRightOf(xc2));
-            assertEquals(true, xc2.isRightOf(xc1));
-            assertEquals(true, xc1.isInSameDocument(xc2));
-            assertEquals(false, xc2.isAtSamePositionAs(xc1));
-            assertEquals(false, xc1.isAtSamePositionAs(xc2));
+            assertFalse(xc1.isRightOf(xc2));
+            assertTrue(xc2.isRightOf(xc1));
+            assertTrue(xc1.isInSameDocument(xc2));
+            assertFalse(xc2.isAtSamePositionAs(xc1));
+            assertFalse(xc1.isAtSamePositionAs(xc2));
             assertEquals(1, xc2.comparePosition(xc1));
             assertEquals(-1, xc1.comparePosition(xc2));
             //	System.out.println(xc1.currentTokenType() + "       " +  xc2.currentTokenType());
             xc1.toNextToken();
             xc2.toPrevToken();
         }
-        assertEquals(true, xc1.isAtSamePositionAs(xc2));
+        assertTrue(xc1.isAtSamePositionAs(xc2));
 
-//inserting and then comparing to make sure cursors move properly.
+        //inserting and then comparing to make sure cursors move properly.
         xc2.insertAttributeWithValue("attr5", "val5");
         assertEquals(0, xc1.comparePosition(xc2));
 
@@ -203,6 +191,7 @@ public class CursorLocations extends Bas
 
     }
 
+    @Test
     public void testLocationTEXTMiddle() throws Exception {
         XmlCursor xc1, xc2, xc3;
         m_xo = XmlObject.Factory.parse(Common.XML_TEXT_MIDDLE);
@@ -218,7 +207,8 @@ public class CursorLocations extends Bas
         //    xc2.toNextToken();
         // }
 
-//moving cursor to right locations. one is in middle of mixed content. the others is in middle of text of first node and last node
+        // moving cursor to right locations. one is in middle of mixed content.
+        // the others is in middle of text of first node and last node
 
         toNextTokenOfType(xc1, TokenType.TEXT);
         toNextTokenOfType(xc2, TokenType.TEXT);
@@ -229,34 +219,34 @@ public class CursorLocations extends Bas
         xc3.toEndToken();
         xc3.toPrevToken();
         xc3.toPrevChar(3);
-//comparing positions
+
+        //comparing positions
         assertEquals(-1, xc2.comparePosition(xc3));
-        assertEquals(true, xc2.isRightOf(xc1));
-        assertEquals(true, xc1.isInSameDocument(xc2));
-        assertEquals(false, xc2.isAtSamePositionAs(xc3));
+        assertTrue(xc2.isRightOf(xc1));
+        assertTrue(xc1.isInSameDocument(xc2));
+        assertFalse(xc2.isAtSamePositionAs(xc3));
 
-//moving cursors
+        //moving cursors
         xc3.toPrevChar(2);
         xc2.toNextChar(1);
-//comparing position once again
+
+        //comparing position once again
         assertEquals(-1, xc2.comparePosition(xc3));
-        assertEquals(true, xc2.isRightOf(xc1));
-        assertEquals(true, xc1.isInSameDocument(xc2));
-        assertEquals(false, xc2.isAtSamePositionAs(xc3));
+        assertTrue(xc2.isRightOf(xc1));
+        assertTrue(xc1.isInSameDocument(xc2));
+        assertFalse(xc2.isAtSamePositionAs(xc3));
 
-//moving and bringing them to identical positions
+        //moving and bringing them to identical positions
         xc3.toPrevToken();
         xc2.toNextChar(2);
-        assertEquals(true, xc2.isAtSamePositionAs(xc3));
+        assertTrue(xc2.isAtSamePositionAs(xc3));
 
         xc1.dispose();
         xc2.dispose();
         xc3.dispose();
-
-
     }
 
-
+    @Test
     public void testXmlObjectUsingCursor() throws Exception {
         XmlCursor xc1, xc2, xc3;
 
@@ -286,14 +276,14 @@ public class CursorLocations extends Bas
         toPrevTokenOfType(xc2, TokenType.TEXT);
         toPrevTokenOfType(xc3, TokenType.TEXT);
         toPrevTokenOfType(xc3, TokenType.TEXT);
-       //all cursors are now at: 90952
+        //all cursors are now at: 90952
         assertEquals(xc1.getChars(), xc2.getChars(), xc3.getChars());
-       //at 52
+        //at 52
         xc2.toNextChar(3);
         //after 90952
         xc3.toNextChar(5);
-        assertEquals(false, xc2.isAtSamePositionAs(xc3));
-        assertEquals(false, xc3.isAtSamePositionAs(xc1));
+        assertFalse(xc2.isAtSamePositionAs(xc3));
+        assertFalse(xc3.isAtSamePositionAs(xc1));
 
 
         //setting zip value through the object .
@@ -302,16 +292,17 @@ public class CursorLocations extends Bas
         USAddress usa = pt.getShipTo();
         usa.setZip(new BigDecimal(500));
 
-      assertEquals(500,usa.getZip().intValue());
-       //Any cursors in the value of an Element/attr should be positioned
+        assertEquals(500,usa.getZip().intValue());
+         //Any cursors in the value of an Element/attr should be positioned
         // at the end of the elem/attr after the strong setter
-        assertEquals(true, xc2.isAtSamePositionAs(xc3));
-        assertEquals(true, xc3.isAtSamePositionAs(xc1));
+        assertTrue(xc2.isAtSamePositionAs(xc3));
+        assertTrue(xc3.isAtSamePositionAs(xc1));
 
         assertEquals(TokenType.END,xc1.currentTokenType());
 
 
-//inserting an element through the cursor under zip and then doing a set of a valid value through object..
+        // inserting an element through the cursor under zip and then doing
+        // a set of a valid value through object..
 
         xc1.insertElementWithText("foo", "text");
         toPrevTokenOfType(xc1, TokenType.START);
@@ -323,8 +314,8 @@ public class CursorLocations extends Bas
         xc1.toNextChar(2);
         usa.setZip(new BigDecimal(90852));
 
-        assertEquals(true, xc2.isAtSamePositionAs(xc3));
-        assertEquals(true, xc3.isAtSamePositionAs(xc1));
+        assertTrue(xc2.isAtSamePositionAs(xc3));
+        assertTrue(xc3.isAtSamePositionAs(xc1));
         //cursors at the end of element
         xc1.toPrevToken();
         //assertEquals(5,xc1.toPrevChar(5));
@@ -334,19 +325,15 @@ public class CursorLocations extends Bas
         xc1.dispose();
         xc2.dispose();
         xc3.dispose();
-
-
     }
 
 
     public class Bookmark0 extends XmlCursor.XmlBookmark {
         public String text;
 
-        public Bookmark0(String text) {
+        Bookmark0(String text) {
             this.text = text;
         }
     }
-
-
 }
 

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectAttributeTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectAttributeTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectAttributeTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectAttributeTest.java Fri Jan 18 23:08:44 2019
@@ -20,36 +20,19 @@ import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlCursor.TokenType;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import tools.util.JarUtil;
-import xmlcursor.common.Common;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.Test;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument.CarLocationMessage;
+import tools.util.JarUtil;
+import xmlcursor.common.Common;
 
 import javax.xml.namespace.QName;
 
+import static org.junit.Assert.*;
 
-/**
- *
- *
- */
-public class CursorVsObjectAttributeTest extends TestCase {
-    public CursorVsObjectAttributeTest(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(CursorVsObjectAttributeTest.class);
-    }
-
-    public void testClassPath() throws Exception {
-        String sClassPath = System.getProperty("java.class.path");
-        int i = sClassPath.indexOf(Common.CARLOCATIONMESSAGE_JAR);
-        assertTrue(i >= 0);
-    }
 
+public class CursorVsObjectAttributeTest {
+    @Test
     public void testAttributeSet() throws Exception {
         CarLocationMessageDocument clmDoc = CarLocationMessageDocument.Factory.parse(
                 JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
@@ -64,6 +47,7 @@ public class CursorVsObjectAttributeTest
         assertEquals("012", clm.getVersion());
     }
 
+    @Test
     public void testAttributeUnsetRemove() throws Exception {
         CarLocationMessageDocument clmDoc =
                 (CarLocationMessageDocument) XmlObject.Factory.parse(
@@ -74,13 +58,14 @@ public class CursorVsObjectAttributeTest
         QName name = new QName("Version");
         assertEquals("CLM", xc.getAttributeText(name));
         clm.unsetVersion();
-        assertEquals(null, xc.getAttributeText(name));
+        assertNull(xc.getAttributeText(name));
         xc.setAttributeText(name, "012");
         assertEquals("012", clm.getVersion());
         xc.removeAttribute(name);
-        assertEquals(null, clm.getVersion());
+        assertNull(clm.getVersion());
     }
 
+    @Test
     public void testAttributeInsert() throws Exception {
         XmlOptions map = new XmlOptions();
         map.put(XmlOptions.LOAD_STRIP_WHITESPACE, "");
@@ -94,12 +79,10 @@ public class CursorVsObjectAttributeTest
         QName name = new QName("Version");
         assertEquals("CLM", xc.getAttributeText(name));
         clm.unsetVersion();
-        assertEquals(null, xc.getAttributeText(name));
+        assertNull(xc.getAttributeText(name));
         xc.toFirstChild();
         assertEquals(TokenType.START, xc.currentTokenType());
         xc.insertAttributeWithValue(name, "012");
         assertEquals("012", clm.getVersion());
     }
-
 }
-

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectInsertRemoveTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectInsertRemoveTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectInsertRemoveTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectInsertRemoveTest.java Fri Jan 18 23:08:44 2019
@@ -14,43 +14,26 @@
  */
 
 
-package  xmlcursor.detailed;
+package xmlcursor.detailed;
 
-import junit.framework.*;
-
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlCursor.TokenType;
-import xmlcursor.common.Common;
-
-import tools.util.JarUtil;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Test;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument;
 import org.tranxml.tranXML.version40.EventStatusDocument.EventStatus;
 import org.tranxml.tranXML.version40.GeographicLocationDocument.GeographicLocation;
+import tools.util.JarUtil;
+import xmlcursor.common.Common;
 
-/**
- *
- *
- */
-public class CursorVsObjectInsertRemoveTest extends TestCase {
-    public CursorVsObjectInsertRemoveTest(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(CursorVsObjectInsertRemoveTest.class);
-    }
-
-    public void testClassPath() throws Exception {
-        String sClassPath = System.getProperty("java.class.path");
-        int i = sClassPath.indexOf(Common.CARLOCATIONMESSAGE_JAR);
-        assertTrue(i >= 0);
-    }
+import static org.junit.Assert.*;
 
+public class CursorVsObjectInsertRemoveTest {
+    @Test
     public void testInsertRemove() throws Exception {
         CarLocationMessageDocument clm =
-                (CarLocationMessageDocument) XmlObject.Factory.parse(
-                        JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
+            (CarLocationMessageDocument) XmlObject.Factory.parse(
+                JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
         assertNotNull(clm);
         XmlCursor xc = clm.newCursor();
         xc.toFirstChild();

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectSetGetTextTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectSetGetTextTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectSetGetTextTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/CursorVsObjectSetGetTextTest.java Fri Jan 18 23:08:44 2019
@@ -16,36 +16,20 @@
 
 package  xmlcursor.detailed;
 
-import junit.framework.*;
-
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor;
-import tools.util.JarUtil;
-import xmlcursor.common.Common;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Test;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument;
-import org.tranxml.tranXML.version40.GeographicLocationDocument.GeographicLocation;
 import org.tranxml.tranXML.version40.CityNameDocument.CityName;
+import org.tranxml.tranXML.version40.GeographicLocationDocument.GeographicLocation;
+import tools.util.JarUtil;
+import xmlcursor.common.Common;
 
+import static org.junit.Assert.*;
 
-/**
- *
- *
- */
-public class CursorVsObjectSetGetTextTest extends TestCase {
-    public CursorVsObjectSetGetTextTest(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(CursorVsObjectSetGetTextTest.class);
-    }
-
-    public void testClassPath() throws Exception {
-        String sClassPath = System.getProperty("java.class.path");
-        int i = sClassPath.indexOf(Common.CARLOCATIONMESSAGE_JAR);
-        assertTrue(i >= 0);
-    }
 
+public class CursorVsObjectSetGetTextTest {
+    @Test
     public void testSetGet() throws Exception {
         CarLocationMessageDocument clm =
                 (CarLocationMessageDocument) XmlObject.Factory.parse(
@@ -74,7 +58,7 @@ public class CursorVsObjectSetGetTextTes
             xc.toNextSelection();
 
             for (int i = 0; i < 3; i++) {
-                assertEquals(true, xc.toFirstChild());
+                assertTrue(xc.toFirstChild());
                 assertEquals("SEATTLE", xc.getTextValue());
                 xc.setTextValue("PORTLAND");
                 xc.toNextSelection();
@@ -89,10 +73,10 @@ public class CursorVsObjectSetGetTextTes
     }
 
 
-    public class Bookmark extends XmlCursor.XmlBookmark {
+    class Bookmark extends XmlCursor.XmlBookmark {
         public String text;
 
-        public Bookmark(String text) {
+        Bookmark(String text) {
             this.text = text;
         }
     }

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/GetTextTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/GetTextTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/GetTextTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/GetTextTest.java Fri Jan 18 23:08:44 2019
@@ -16,38 +16,17 @@
 
 package xmlcursor.detailed;
 
-import org.apache.xmlbeans.XmlOptions;
-import junit.framework.*;
-import junit.framework.Assert.*;
-
-import java.io.*;
-
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlBeans;
 import org.apache.xmlbeans.XmlCursor.TokenType;
-
-import javax.xml.namespace.QName;
-
-import xmlcursor.common.*;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Test;
 import tools.util.JarUtil;
+import xmlcursor.common.BasicCursorTestCase;
+import xmlcursor.common.Common;
 
-import java.net.URL;
-
+import static org.junit.Assert.assertEquals;
 
-/**
- *
- *
- */
 public class GetTextTest extends BasicCursorTestCase {
-    public GetTextTest(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(GetTextTest.class);
-    }
-
+    @Test(expected = IllegalStateException.class)
     public void testGetTextFromEND() throws Exception {
         m_xo = XmlObject.Factory.parse(
                  JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
@@ -57,14 +36,10 @@ public class GetTextTest extends BasicCu
         assertEquals(TokenType.END, m_xc.currentTokenType());
         //assertEquals(null, m_xc.getTextValue());
 
-        try {
-            m_xc.getTextValue();
-            fail("Expecting Illegal State Exception");
-        } catch (IllegalStateException ie) {
-        }
-
+        m_xc.getTextValue();
     }
 
+    @Test
     public void testGetTextFromPROCINST() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_PROCINST);
         m_xc = m_xo.newCursor();
@@ -72,6 +47,7 @@ public class GetTextTest extends BasicCu
         assertEquals("type=\"text/xsl\" xmlns=\"http://openuri.org/shipping/\"", m_xc.getTextValue());
     }
 
+    @Test
     public void testGetTextFromCOMMENT() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_COMMENT);
         m_xc = m_xo.newCursor();
@@ -79,6 +55,7 @@ public class GetTextTest extends BasicCu
         assertEquals(" comment text ", m_xc.getTextValue());
     }
 
+    @Test
     public void testGetTextFromNAMESPACE() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_NS);
         m_xc = m_xo.newCursor();
@@ -89,24 +66,19 @@ public class GetTextTest extends BasicCu
         //filed bug on API
            String text= m_xc.getTextValue();
         assertEquals("http://www.foo.org", text);
-
-
     }
 
+    @Test(expected = IllegalStateException.class)
     public void testGetTextFromENDDOC() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO);
         m_xc = m_xo.newCursor();
         toNextTokenOfType(m_xc, TokenType.ENDDOC);
         //assertEquals(null, m_xc.getTextValue());
-        try {
-            m_xc.getTextValue();
-            fail("Expecting Illegal State Exception");
-        } catch (IllegalStateException ie) {
-        }
-
+        m_xc.getTextValue();
     }
 
 
+    @Test
     public void testGetTextFromTEXT() throws Exception {
         //  m_xo = XmlObject.Factory.parse(Common.XML_FOO_TEXT);
 
@@ -115,13 +87,14 @@ public class GetTextTest extends BasicCu
         toNextTokenOfType(m_xc, TokenType.TEXT);
         assertEquals(TokenType.TEXT, m_xc.currentTokenType());
         assertEquals("text", m_xc.getChars());
-	assertEquals("text", m_xc.getTextValue());
+        assertEquals("text", m_xc.getTextValue());
 
-	m_xc.toNextChar(2);
-	assertEquals(TokenType.TEXT, m_xc.currentTokenType());
+        m_xc.toNextChar(2);
+        assertEquals(TokenType.TEXT, m_xc.currentTokenType());
         assertEquals("xt", m_xc.getTextValue());
     }
 
+    @Test
     public void testGetTextFromSTART_NotNested() throws Exception {
         m_xo = XmlObject.Factory.parse(
                 JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
@@ -133,6 +106,7 @@ public class GetTextTest extends BasicCu
         assertEquals("FLEETNAME", m_xc.getTextValue());
     }
 
+    @Test
     public void testGetTextFromSTART_Nested() throws Exception {
         m_xo = XmlObject.Factory.parse(
                  JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
@@ -142,6 +116,7 @@ public class GetTextTest extends BasicCu
         assertEquals("\n\t\t\tGATX\n\t\t\t123456\n\t\t\tL\n\t\t", m_xc.getTextValue());
     }
 
+    @Test
     public void testGetTextFromSTART_TextAferEND() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_BAR_TEXT_EXT);
         m_xc = m_xo.newCursor();
@@ -150,6 +125,7 @@ public class GetTextTest extends BasicCu
         assertEquals("text", m_xc.getTextValue());
     }
 
+    @Test
     public void testGetTextFromSTART_TextAferEND_WS() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_BAR_WS_TEXT);
         m_xc = m_xo.newCursor();
@@ -158,6 +134,7 @@ public class GetTextTest extends BasicCu
         assertEquals(" text ", m_xc.getTextValue());
     }
 
+    @Test
     public void testGetTextFromATTR_Nested() throws Exception {
         m_xo = XmlObject.Factory.parse(
                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
@@ -170,12 +147,14 @@ public class GetTextTest extends BasicCu
         assertEquals("US", m_xc.getTextValue());
     }
 
+    @Test
     public void testGetTextFromSTARTDOC() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_BAR_TEXT_EXT);
         m_xc = m_xo.newCursor();
         assertEquals("textextended", m_xc.getTextValue());
     }
 
+    @Test
     public void testGetTextEmptyElementSTART() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_BAR);
         m_xc = m_xo.newCursor();
@@ -183,12 +162,12 @@ public class GetTextTest extends BasicCu
         assertEquals("", m_xc.getTextValue());
     }
 
+    @Test
     public void testGetTextWhitespaceOnlyFromSTART() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_BAR_WS_ONLY);
         m_xc = m_xo.newCursor();
         m_xc.toFirstChild();
         assertEquals("   ", m_xc.getTextValue());
     }
-
 }
 

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/GetTextValueTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/GetTextValueTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/GetTextValueTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/GetTextValueTest.java Fri Jan 18 23:08:44 2019
@@ -15,32 +15,23 @@
 
 package xmlcursor.detailed;
 
-import junit.framework.*;
-
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor.TokenType;
-import xmlcursor.common.*;
-
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Before;
+import org.junit.Test;
+import xmlcursor.common.BasicCursorTestCase;
+import xmlcursor.common.Common;
 
-/**
- *
- *
- */
-public class GetTextValueTest extends BasicCursorTestCase {
+import static org.junit.Assert.*;
 
 
-    String sDoc = Common.XML_FOO_NS_PREFIX;
+public class GetTextValueTest extends BasicCursorTestCase {
 
-    public GetTextValueTest(String sName) {
-        super(sName);
-    }
 
-    public static Test suite() {
-        return new TestSuite(GetTextValueTest.class);
-    }
+    private String sDoc = Common.XML_FOO_NS_PREFIX;
 
     // Depth first concatenation of all text leaves
-     
+    @Test
     public void testNormalCase() {
         String sExpected = "  32.18";
         char[] buffer = new char[100];
@@ -49,24 +40,18 @@ public class GetTextValueTest extends Ba
         assertEquals(sExpected, new String(buffer).substring(0, nCopied));
     }
 
+    @Test(expected = IllegalArgumentException.class)
     public void testGetNull() {
-        try {
-            m_xc.getTextValue(null, 0, 10);
-            fail("Buffer was Null");
-        } catch (IllegalArgumentException ie) {
-        }
+        m_xc.getTextValue(null, 0, 10);
     }
 
+    @Test(expected = IllegalArgumentException.class)
     public void testNegativeOffset() {
         char[] buffer = new char[100];
-        try {
-            m_xc.getTextValue(buffer, -1, 100);
-            fail("Offset < 0");
-        } catch (IllegalArgumentException ie) {
-        }
-
+        m_xc.getTextValue(buffer, -1, 100);
     }
 
+    @Test
     public void testNonZeroOffset() {
         String sExpected = "T\0  32.18";
         char[] buffer = new char[10];
@@ -79,20 +64,17 @@ public class GetTextValueTest extends Ba
         assertEquals("",
                 new String(buffer).substring(nOffset + nCopied, buffer.length)
                 .trim());
-
     }
 
+    @Test(expected = IllegalArgumentException.class)
     public void testLargeOffset() {
         char[] buffer = new char[100];
-        try {
-            m_xc.getTextValue(buffer, 101, 1);
-            fail("Offset Past end");
-        } catch (IllegalArgumentException ie) {
-        }
+        m_xc.getTextValue(buffer, 101, 1);
     }
 
     //charCount<=0: should be a noop
     //BUT: Assumption is that <0=infinity, so all is copies
+    @Test
     public void testNegativeCharCount() {
         char[] buffer = new char[100];
         String sExpected = m_xc.getTextValue();
@@ -101,6 +83,7 @@ public class GetTextValueTest extends Ba
         assertEquals(sExpected, new String(buffer, 0, nCount));
     }
 
+    @Test
     public void testZeroCharCount() {
         char[] buffer = new char[10];
         int nCopied = m_xc.getTextValue(buffer, 0, 0);
@@ -108,18 +91,20 @@ public class GetTextValueTest extends Ba
         assertEquals("", new String(buffer).trim());
     }
 
+    @Test
     public void testLargeCharCount() {
         String sExpected = "  32.18";
         char[] buffer = new char[200];
         int nCharCount = 300;
-        assertEquals(true, sDoc.length() < nCharCount);
-        assertEquals(false, buffer.length >= nCharCount);
+        assertTrue(sDoc.length() < nCharCount);
+        assertFalse(buffer.length >= nCharCount);
         int nCopied = m_xc.getTextValue(buffer, 0, nCharCount);
         assertEquals(sExpected.length(), nCopied);
         assertEquals(sExpected, new String(buffer).substring(0, nCopied));
     }
 
     //offset+selection>buffer
+    @Test
     public void testSelectionPastEnd() {
         String sExpected = "  3";
         char[] buffer = new char[100];
@@ -133,6 +118,7 @@ public class GetTextValueTest extends Ba
     //End,Enddoc,Namespace should
     //return 0 as per spec
     //NB: Design changed, should work now
+    @Test
     public void testGetNonTextElement() {
         char[] buffer = new char[100];
         toNextTokenOfType(m_xc, TokenType.NAMESPACE);
@@ -154,11 +140,10 @@ public class GetTextValueTest extends Ba
             fail("Operation not allowed");
         } catch (java.lang.IllegalStateException e) {
         }
-
-
     }
 
     //test text of comment, PI or Attr
+    @Test
     public void testCommentPIAttr() throws Exception {
         String sExpected = "http://ecommerce.org/schema";
         int nSize = sExpected.length();
@@ -191,11 +176,10 @@ public class GetTextValueTest extends Ba
         assertEquals(sExpected, new String(buffer)
                 .substring(0, nCopied));
         assertEquals(sExpected.length(), nCopied);
-
     }
 
+    @Before
     public void setUp() throws Exception {
-        m_xc = XmlObject.Factory.parse(sDoc)
-                .newCursor();
+        m_xc = XmlObject.Factory.parse(sDoc).newCursor();
     }
 }

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/InsertAttributeTest2.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/InsertAttributeTest2.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/InsertAttributeTest2.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/InsertAttributeTest2.java Fri Jan 18 23:08:44 2019
@@ -16,67 +16,46 @@
 
 package xmlcursor.detailed;
 
-import org.apache.xmlbeans.XmlOptions;
-import junit.framework.*;
-import junit.framework.Assert.*;
-
-import java.io.*;
-
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlBeans;
 import org.apache.xmlbeans.XmlCursor.TokenType;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import xmlcursor.common.BasicCursorTestCase;
+import xmlcursor.common.Common;
 
 import javax.xml.namespace.QName;
 
-import xmlcursor.common.*;
-
-import java.net.URL;
+import static org.junit.Assert.*;
 
 
-/**
- *
- *
- */
 public class InsertAttributeTest2 extends BasicCursorTestCase {
+	@Test
+	public void testNormalCase() {
+		for (int i = 0; i < 50; i++) {
+			m_xc.insertAttribute("at" + i, "com.bea.foo");
+			//System.out.println(i);
+		}
+		toPrevTokenOfType(m_xc, TokenType.ATTR);
+
+		int i = 0;
+		do {
+			i++;
+			//System.out.println(m_xc.xmlText());
+		} while (m_xc.toPrevAttribute());
 
+		assertEquals(i, 50);
+	}
 
-    static String sDoc=Common.XML_FOO_TEXT;
-
-    public InsertAttributeTest2(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(InsertAttributeTest2.class);
-    }
-
-
-
-    public void testNormalCase(){
-	for (int i=0;i<50;i++){
-	    m_xc.insertAttribute("at"+i,"com.bea.foo");
-	    //System.out.println(i);
-	}
-	toPrevTokenOfType(m_xc, TokenType.ATTR);
-
-	int i=0;
-	do{
-	    i++;
-        //System.out.println(m_xc.xmlText());
-	}while(m_xc.toPrevAttribute());
-
-	assertEquals(i,50);
-    }
+	@Test(expected = Exception.class)
+	public void testIllegalCursorPos() {
+		//position curor at text
+		toNextTokenOfType(m_xc, XmlCursor.TokenType.END);
+		// Shoild not be able to insert at attr here
+		m_xc.insertAttribute("at", "com.bea.foo");
+	}
 
-    public void testIllegalCursorPos(){
-	//position curor at text
-	toNextTokenOfType(m_xc,XmlCursor.TokenType.END);
-	try{
-	    m_xc.insertAttribute("at","com.bea.foo");
-	    fail("Shoild not be able to insert at attr here ");
-	}catch(Exception e){}
-    }
     /**
        No xml tag can contain 2 attrib such that:
        1. have identical names, or
@@ -85,17 +64,16 @@ public class InsertAttributeTest2 extend
        ** According to Eric he will perform the insert but
        * check upon serialization that only the first token with a given name is printed
        */
-    public void testLocalNameCollision(){
-	m_xc.insertAttributeWithValue("at","v1");
-	m_xc.insertAttributeWithValue("at","v2");
-	toPrevTokenOfType(m_xc,TokenType.START);
-	m_xc.toFirstAttribute();
-	assertEquals(m_xc.getName().getLocalPart(),"at");
-	assertEquals(true, m_xc.toNextAttribute());
-	assertEquals(m_xc.getName().getLocalPart(),"at");
-
-
-    }
+	@Test
+	public void testLocalNameCollision() {
+		m_xc.insertAttributeWithValue("at", "v1");
+		m_xc.insertAttributeWithValue("at", "v2");
+		toPrevTokenOfType(m_xc, TokenType.START);
+		m_xc.toFirstAttribute();
+		assertEquals(m_xc.getName().getLocalPart(), "at");
+		assertTrue(m_xc.toNextAttribute());
+		assertEquals(m_xc.getName().getLocalPart(), "at");
+	}
 
     /**
      * The idea was to try to force the following:
@@ -106,97 +84,86 @@ public class InsertAttributeTest2 extend
      * it seems impossible to force a binding of the same URI with two
      * different prefixes
      */
-    /*
-      public void testUriCollision(){
-      m_xc.insertAttribute("at0","com.bea.foo");
-      try{
-      m_xc.insertAttribute("at1","com.bea.foo");
-      toPrevTokenOfType(m_xc,TokenType.START);
-      System.out.println(m_xc.xmlText());
-      fail("Should not be able to insert at attr with colliding name ");
-      }catch(Exception e){}
-      }
-    */
-    public void testUriLocalNameOK(){
-	m_xc.insertAttribute("at","");
-	m_xc.insertAttribute("at","com.bea.foo");
-	toPrevTokenOfType(m_xc,XmlCursor.TokenType.START);
-	m_xc.toFirstAttribute();
-	int i=1;
-//	System.out.println(m_xc.xmlText());
-	while(m_xc.toNextAttribute()) i++;
-	assertEquals(i,2);
-    }
-
-    public void testUriNull(){
-	m_xc.insertAttribute("at",null);
-	toPrevTokenOfType(m_xc, TokenType.ATTR);
-	assertEquals(m_xc.getName(),new QName("at"));
-    }
-    public void testLocalnameNull(){
-	try{
-	    m_xc.insertAttribute(null,"");
-	    fail("Null Localname");
-	}catch(Exception e){}
-    }
-    public void testUriEmpty(){
-	m_xc.insertAttribute("myat","");
-	toPrevTokenOfType(m_xc, TokenType.START);
-	m_xc.toFirstAttribute();
-	assertEquals(m_xc.getName(),new QName(null,"myat"));
-    }
-    public void testLocalnameEmpty(){
-	try{
-	    m_xc.insertAttribute("","");
-	    fail("No Localname");
-	}catch(Exception e){}
-    }
+	@Test(expected = Exception.class)
+	@Ignore
+	public void testUriCollision() {
+		m_xc.insertAttribute("at0", "com.bea.foo");
+		m_xc.insertAttribute("at1", "com.bea.foo");
+		toPrevTokenOfType(m_xc, TokenType.START);
+		// Should not be able to insert at attr with colliding name
+		System.out.println(m_xc.xmlText());
+	}
 
-    public void testInsertAttributeWithValue(){
-	StringBuffer sb=new StringBuffer();
-	String value0="test"+"\n\t\r";
-	String value1="'QuotedText'";
-	String value2="\"QuotedText2\"";
-
-	int nStressBound=20000;//Integer.MAX_VALUE
-	for (int i=0;i<nStressBound;i++)
-	    sb.append('a');
-	m_xc.insertAttributeWithValue("at0",value0);
-	m_xc.insertAttributeWithValue("at1",value1);
-	m_xc.insertAttributeWithValue("at2",value2);
-	m_xc.insertAttributeWithValue("at3",sb.toString());
+	@Test
+	public void testUriLocalNameOK() {
+		m_xc.insertAttribute("at", "");
+		m_xc.insertAttribute("at", "com.bea.foo");
+		toPrevTokenOfType(m_xc, XmlCursor.TokenType.START);
+		m_xc.toFirstAttribute();
+		int i = 1;
+		while (m_xc.toNextAttribute()) i++;
+		assertEquals(i, 2);
+	}
 
-	toPrevTokenOfType(m_xc,TokenType.START);
+	@Test
+	public void testUriNull() {
+		m_xc.insertAttribute("at", null);
+		toPrevTokenOfType(m_xc, TokenType.ATTR);
+		assertEquals(m_xc.getName(), new QName("at"));
+	}
 
-	assertEquals(m_xc.getAttributeText(new QName("at3")).length(),nStressBound);
-	assertEquals(m_xc.getAttributeText(new QName("at2")),value2);
+	@Test(expected = Exception.class)
+	public void testLocalnameNull() {
+		m_xc.insertAttribute(null, "");
+	}
 
-	assertEquals(m_xc.getAttributeText(new QName("at1")),value1);
-	assertEquals(m_xc.getAttributeText(new QName("at0")),value0);
+	@Test
+	public void testUriEmpty() {
+		m_xc.insertAttribute("myat", "");
+		toPrevTokenOfType(m_xc, TokenType.START);
+		m_xc.toFirstAttribute();
+		assertEquals(m_xc.getName(), new QName(null, "myat"));
+	}
 
-    }
+	@Test(expected = Exception.class)
+	public void testLocalnameEmpty() {
+		m_xc.insertAttribute("", "");
+	}
 
-    public void testInsertAttributeWithValueNull(){
-	m_xc.insertAttributeWithValue("at0",null);
-	assertEquals(m_xc.getAttributeText(new QName("at0")),null);
-    }
+	@Test
+	public void testInsertAttributeWithValue() {
+		StringBuilder sb = new StringBuilder();
+		String value0 = "test" + "\n\t\r";
+		String value1 = "'QuotedText'";
+		String value2 = "\"QuotedText2\"";
+
+		int nStressBound = 20000;//Integer.MAX_VALUE
+		for (int i = 0; i < nStressBound; i++)
+			sb.append('a');
+		m_xc.insertAttributeWithValue("at0", value0);
+		m_xc.insertAttributeWithValue("at1", value1);
+		m_xc.insertAttributeWithValue("at2", value2);
+		m_xc.insertAttributeWithValue("at3", sb.toString());
 
+		toPrevTokenOfType(m_xc, TokenType.START);
 
-    public void setUp()throws Exception{
-	m_xc= XmlObject.Factory.parse(sDoc).newCursor();
-	toNextTokenOfType(m_xc,XmlCursor.TokenType.TEXT);//prepare for atts
-    }
+		assertEquals(m_xc.getAttributeText(new QName("at3")).length(), nStressBound);
+		assertEquals(m_xc.getAttributeText(new QName("at2")), value2);
 
+		assertEquals(m_xc.getAttributeText(new QName("at1")), value1);
+		assertEquals(m_xc.getAttributeText(new QName("at0")), value0);
+	}
 
-    public static void main(String[] rgs){
-	try{
-	    InsertAttributeTest2 t= (new InsertAttributeTest2(""));
-	    t.setUp();
-	    t.testInsertAttributeWithValue();
-
-	}catch (Exception e){
-	    System.err.println("Error "+e.getMessage());
-	    e.printStackTrace();
+	@Test
+	public void testInsertAttributeWithValueNull() {
+		m_xc.insertAttributeWithValue("at0", null);
+		assertNull(m_xc.getAttributeText(new QName("at0")));
 	}
+
+	@Before
+    public void setUp()throws Exception{
+		String sDoc = Common.XML_FOO_TEXT;
+		m_xc= XmlObject.Factory.parse(sDoc).newCursor();
+		toNextTokenOfType(m_xc,XmlCursor.TokenType.TEXT);//prepare for atts
     }
 }

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/InsertNamespaceTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/InsertNamespaceTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/InsertNamespaceTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/InsertNamespaceTest.java Fri Jan 18 23:08:44 2019
@@ -16,39 +16,19 @@
 
 package xmlcursor.detailed;
 
-import org.apache.xmlbeans.XmlOptions;
-import junit.framework.*;
-import junit.framework.Assert.*;
-
-import java.io.*;
-
+import org.apache.xmlbeans.XmlCursor.TokenType;
 import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlBeans;
 import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlCursor.TokenType;
-
-import javax.xml.namespace.QName;
+import org.junit.Ignore;
+import org.junit.Test;
+import xmlcursor.common.BasicCursorTestCase;
+import xmlcursor.common.Common;
 
-import xmlcursor.common.*;
+import static org.junit.Assert.*;
 
-import java.util.*;
-import java.net.URL;
 
-
-/**
- *
- *
- */
 public class InsertNamespaceTest extends BasicCursorTestCase {
-    public InsertNamespaceTest(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(InsertNamespaceTest.class);
-    }
-
+    @Test
     public void testInsertNamespaceAfterSTART() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_2ATTR_TEXT);
         m_xc = m_xo.newCursor();
@@ -60,6 +40,7 @@ public class InsertNamespaceTest extends
         assertEquals("<foo xmlns:prefix=\"value\" attr0=\"val0\" attr1=\"val1\">text</foo>", m_xc.xmlText(map));
     }
 
+    @Test
     public void testInsertNamespaceAfterATTR() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_2ATTR_TEXT);
         m_xc = m_xo.newCursor();
@@ -72,44 +53,33 @@ public class InsertNamespaceTest extends
         assertEquals("<foo xmlns:prefix=\"value\" attr0=\"val0\" attr1=\"val1\">text</foo>", m_xc.xmlText(map));
     }
 
+    @Test(expected = IllegalArgumentException.class)
     public void testInsertNamespaceInsideTEXT() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_2ATTR_TEXT);
         m_xc = m_xo.newCursor();
         toNextTokenOfType(m_xc, TokenType.TEXT);
         m_xc.toNextChar(2);
         assertEquals("xt", m_xc.getChars());
-        try {
-            m_xc.insertNamespace("prefix", "value");
-            fail("Expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-        }
-        assertTrue(true);
+        m_xc.insertNamespace("prefix", "value");
     }
 
+    @Test(expected = IllegalArgumentException.class)
     public void testInsertNamespaceFromSTARTDOC() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_2ATTR_TEXT);
         m_xc = m_xo.newCursor();
-        try {
-            m_xc.insertNamespace("prefix", "value");
-            fail("Expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-        }
-        assertTrue(true);
+        m_xc.insertNamespace("prefix", "value");
     }
 
+    @Test(expected = IllegalArgumentException.class)
     public void testInsertNamespaceAfterPROCINST() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_PROCINST);
         m_xc = m_xo.newCursor();
         toNextTokenOfType(m_xc, TokenType.PROCINST);
         m_xc.toNextToken();
-        try {
-            m_xc.insertNamespace("prefix", "value");
-            fail("Expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-        }
-        assertTrue(true);
+        m_xc.insertNamespace("prefix", "value");
     }
 
+    @Test
     public void testInsertNamespaceAfterNAMESPACE() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_NS);
         m_xc = m_xo.newCursor();
@@ -120,6 +90,7 @@ public class InsertNamespaceTest extends
         assertEquals("<foo xmlns=\"http://www.foo.org\" xmlns:prefix=\"value\"/>", m_xc.xmlText());
     }
 
+    @Test
     public void testInsertDuplicateNamespace() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_TEXT);
         m_xc = m_xo.newCursor();
@@ -130,6 +101,8 @@ public class InsertNamespaceTest extends
         assertEquals("<foo xmlns:prefix=\"http://www.foo.org\">text</foo>", m_xc.xmlText());
     }
 
+    @Test
+    @Ignore
     public void testInsertNamespaceWithNullPrefix() throws Exception {
         // According to Eric V...  This test is not valid
         // Eric's comments:
@@ -150,29 +123,26 @@ public class InsertNamespaceTest extends
         // assertEquals("<foo xmlns=\"http://www.foo.org\"/>", m_xc.xmlText());
     }
 
+    @Test
     public void testInsertNamespaceWithNullValue() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO);
         m_xc = m_xo.newCursor();
         toNextTokenOfType(m_xc, TokenType.END);
 
-       //EricV: this should be OK, but make sure the saver
+        //EricV: this should be OK, but make sure the saver
         // doesn't serialize it since it's not legal XML
 
-         m_xc.insertNamespace("prefix", null);
-         m_xc.toStartDoc();
+        m_xc.insertNamespace("prefix", null);
+        m_xc.toStartDoc();
         assertEquals("<foo/>", m_xc.xmlText());
     }
 
+    @Test(expected = IllegalArgumentException.class)
     public void testInsertEmptyNamespace() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_TEXT);
         m_xc = m_xo.newCursor();
         toNextTokenOfType(m_xc, TokenType.END);
-        try {
-            m_xc.insertNamespace("", "");
-            fail("Expected IllegalArgumentException");
-        } catch (IllegalArgumentException iae) {
-        }
+        m_xc.insertNamespace("", "");
     }
-
 }
 

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/MoveXmlTest2.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/MoveXmlTest2.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/MoveXmlTest2.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/MoveXmlTest2.java Fri Jan 18 23:08:44 2019
@@ -16,37 +16,23 @@
 
 package xmlcursor.detailed;
 
-import junit.framework.*;
-
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlCursor.TokenType;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import xmlcursor.common.BasicCursorTestCase;
 
-import xmlcursor.common.*;
-
+import static org.junit.Assert.*;
 
-/**
- *
- *
- */
 public class MoveXmlTest2 extends BasicCursorTestCase
         {
 
-    static String sTestXml = "<bk:book xmlns:bk='urn:loc.gov:books' at0=\"value0\"><!--BOOK COMMENT-->text0<author at0=\"v0\" at1=\"value1\"/></bk:book>";
-    static String sTargetXml = "<target></target>";
-    static XmlCursor m_xc1;
-
-    public MoveXmlTest2(String sName)
-    {
-        super(sName);
-    }
-
-    public static Test suite()
-    {
-        return new TestSuite(MoveXmlTest2.class);
-    }
-
+    private static String sTestXml = "<bk:book xmlns:bk='urn:loc.gov:books' at0=\"value0\"><!--BOOK COMMENT-->text0<author at0=\"v0\" at1=\"value1\"/></bk:book>";
+    private static XmlCursor m_xc1;
 
+    @Test
     public void testNormalCase()
     {
         String sExpectedTrg1 = "<!--BOOK COMMENT--><target/>";
@@ -87,6 +73,7 @@ public class MoveXmlTest2 extends BasicC
     }
 
     //to here at END
+    @Test(expected = IllegalArgumentException.class)
     public void testMoveNoop()
     {
 
@@ -101,17 +88,15 @@ public class MoveXmlTest2 extends BasicC
 
         toNextTokenOfType(m_xc1, TokenType.START);
         toNextTokenOfType(m_xc, TokenType.ENDDOC);
-        try {
-            m_xc.moveXml(m_xc1);
-            fail(" need IllegalArgumentException");
-        } catch (IllegalArgumentException e) {}
+        m_xc.moveXml(m_xc1);
     }
 
+    @Test
     public void testInvalidToCursorPos()
     {
         //position the cursor within a tag <a <movedXML/>...</a>
         toNextTokenOfType(m_xc, TokenType.START);//m_xc on book at0
-        assertEquals(true, m_xc.toFirstAttribute()); //at0 in book
+        assertTrue(m_xc.toFirstAttribute()); //at0 in book
         toNextTokenOfType(m_xc1, TokenType.START);
         try {
             if (m_xc1.moveXml(m_xc)) {
@@ -123,6 +108,7 @@ public class MoveXmlTest2 extends BasicC
         }
     }
 
+    @Test
     public void testMovedAttrNameCollision() throws Exception
     {
 
@@ -131,13 +117,13 @@ public class MoveXmlTest2 extends BasicC
         toNextTokenOfType(m_xc1, TokenType.START);
         toNextTokenOfType(m_xc1, TokenType.START);
         //toNextTokenOfType(m_xc1,TokenType.END);//to author
-        assertEquals(true, m_xc1.toFirstAttribute());
-        assertEquals(true, m_xc.toFirstAttribute()); //at0 in book
+        assertTrue(m_xc1.toFirstAttribute());
+        assertTrue(m_xc.toFirstAttribute()); //at0 in book
         if (m_xc.moveXml(m_xc1)) {
             toPrevTokenOfType(m_xc1, TokenType.START);
             m_xc1.toFirstAttribute();
             assertEquals(m_xc1.getName().getLocalPart(), "at0");
-            assertEquals(true, m_xc1.toNextAttribute());
+            assertTrue(m_xc1.toNextAttribute());
             assertEquals(m_xc1.getName().getLocalPart(), "at0");
         }
         m_xc1.dispose();
@@ -148,14 +134,15 @@ public class MoveXmlTest2 extends BasicC
      * seems to be illegal semantics judging from beginElement
      * $NOTE: legal here
      */
+    @Test
     public void testInvalidXml()
     {
         toNextTokenOfType(m_xc, TokenType.START);
         toNextTokenOfType(m_xc1, TokenType.START);
-        assertEquals(true, m_xc.moveXml(m_xc1));
+        assertTrue(m_xc.moveXml(m_xc1));
     }
 
-
+    @Test
     public void testNull()
     {
         toNextTokenOfType(m_xc, TokenType.START);
@@ -167,7 +154,7 @@ public class MoveXmlTest2 extends BasicC
         }
     }
 
-
+    @Test
     public void testSelf()
     {
         String sExpectedResult = m_xc.xmlText();
@@ -183,12 +170,15 @@ public class MoveXmlTest2 extends BasicC
         }
     }
 
+    @Before
     public void setUp() throws Exception
     {
         m_xc = XmlObject.Factory.parse(sTestXml).newCursor();
+        String sTargetXml = "<target></target>";
         m_xc1 = XmlObject.Factory.parse(sTargetXml).newCursor();
     }
 
+    @After
     public void tearDown() throws Exception
     {
         super.tearDown();
@@ -197,18 +187,4 @@ public class MoveXmlTest2 extends BasicC
             m_xc1 = null;
         }
     }
-
-    public static void main(String[] rgs)
-    {
-        try {
-            MoveXmlTest2 t = new MoveXmlTest2("");
-            t.setUp();
-            t.testSelf();
-        } catch (Exception e) {
-            System.err.println("Error " + e.getMessage());
-            e.printStackTrace();
-        }
-    }
-
-
 }

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCopyFromCursorTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCopyFromCursorTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCopyFromCursorTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCopyFromCursorTest.java Fri Jan 18 23:08:44 2019
@@ -14,53 +14,33 @@
  */
 
 
+package xmlcursor.detailed;
 
-package  xmlcursor.detailed;
-
-import junit.framework.*;
-
-
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlError;
 import org.apache.xmlbeans.XmlCursor.TokenType;
-
-
-import xmlcursor.common.*;
-
-import tools.util.JarUtil;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.junit.Test;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument;
-import org.tranxml.tranXML.version40.GeographicLocationDocument.GeographicLocation;
 import org.tranxml.tranXML.version40.CodeList309;
+import org.tranxml.tranXML.version40.GeographicLocationDocument.GeographicLocation;
 import org.tranxml.tranXML.version40.LocationIdentifierDocument.LocationIdentifier;
+import tools.util.JarUtil;
+import xmlcursor.common.Common;
 
 import java.util.ArrayList;
 
+import static org.junit.Assert.*;
 
-/**
- *
- *
- */
-public class MultipleCopyFromCursorTest extends TestCase {
-    public MultipleCopyFromCursorTest(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(MultipleCopyFromCursorTest.class);
-    }
-
-    public void testClassPath() throws Exception {
-        String sClassPath = System.getProperty("java.class.path");
-        int i = sClassPath.indexOf(Common.CARLOCATIONMESSAGE_JAR);
-        assertTrue(i >= 0);
-    }
 
+public class MultipleCopyFromCursorTest {
+
+    @Test
     public void testMultipleCopy() throws Exception {
         CarLocationMessageDocument clm =
-                (CarLocationMessageDocument) XmlObject.Factory.parse(
-                        JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
+            (CarLocationMessageDocument) XmlObject.Factory.parse(
+                JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
         assertNotNull(clm);
         XmlCursor xc = clm.newCursor();
         XmlCursor[] aCursors = new XmlCursor[3];
@@ -75,8 +55,8 @@ public class MultipleCopyFromCursorTest
             xc.toStartDoc();
             xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT +
                           "$this//GeographicLocation");
-            assertTrue( xc.getSelectionCount() > 0 );
-            assertTrue( xc.toNextSelection());
+            assertTrue(xc.getSelectionCount() > 0);
+            assertTrue(xc.toNextSelection());
             aCursors[0].toLastChild();
             assertEquals("TX", aCursors[0].getTextValue());
 
@@ -87,31 +67,31 @@ public class MultipleCopyFromCursorTest
             assertEquals(TokenType.END, aCursors[0].currentTokenType());
 
             aCursors[0].beginElement("LocationIdentifier",
-                                      "http://www.tranxml.org/TranXML/Version4.0");
+                "http://www.tranxml.org/TranXML/Version4.0");
             aCursors[0].insertAttributeWithValue("Qualifier", "FR");
-             aCursors[0].toEndToken();
+            aCursors[0].toEndToken();
             aCursors[0].toNextToken();//move past the end token
             aCursors[0].insertElementWithText("CountrySubdivisionCode",
-                                              "http://www.tranxml.org/TranXML/Version4.0",
-                                              "xyz");
+                "http://www.tranxml.org/TranXML/Version4.0",
+                "xyz");
             aCursors[0].toCursor(xc);
             GeographicLocation gl = (GeographicLocation) aCursors[0].getObject();
-            XmlOptions validateOptions=new XmlOptions();
-            ArrayList errors=new ArrayList();
+            XmlOptions validateOptions = new XmlOptions();
+            ArrayList errors = new ArrayList();
             validateOptions.setErrorListener(errors);
-            try{
-            assertEquals(true, gl.validate(validateOptions));
-            }catch (Throwable t){
-                StringBuffer sb=new StringBuffer();
-               for (int i = 0; i < errors.size(); i++) {
-                XmlError error = (XmlError) errors.get(i);
-
-                sb.append("Message: " + error.getMessage() + "\n");
-                if (error.getCursorLocation() != null)
-                    System.out.println("Location of invalid XML: " +
-                            error.getCursorLocation().xmlText() + "\n");
-            }
-                throw new Exception(" Validation failed "+sb.toString());
+            try {
+                assertTrue(gl.validate(validateOptions));
+            } catch (Throwable t) {
+                StringBuilder sb = new StringBuilder();
+                for (int i = 0; i < errors.size(); i++) {
+                    XmlError error = (XmlError) errors.get(i);
+
+                    sb.append("Message: " + error.getMessage() + "\n");
+                    if (error.getCursorLocation() != null)
+                        System.out.println("Location of invalid XML: " +
+                                           error.getCursorLocation().xmlText() + "\n");
+                }
+                throw new Exception(" Validation failed " + sb.toString());
             }
 
             assertEquals("DALLAS", gl.getCityName().getStringValue());

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCopyTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCopyTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCopyTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCopyTest.java Fri Jan 18 23:08:44 2019
@@ -14,45 +14,27 @@
  */
 
 
-package  xmlcursor.detailed;
+package xmlcursor.detailed;
 
-import junit.framework.*;
-
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor;
-import xmlcursor.common.*;
-
-
-import tools.util.JarUtil;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Test;
 import org.tranxml.tranXML.version40.CarLocationMessageDocument;
-import org.tranxml.tranXML.version40.GeographicLocationDocument.GeographicLocation;
 import org.tranxml.tranXML.version40.CodeList309;
+import org.tranxml.tranXML.version40.GeographicLocationDocument.GeographicLocation;
 import org.tranxml.tranXML.version40.LocationIdentifierDocument.LocationIdentifier;
+import tools.util.JarUtil;
+import xmlcursor.common.Common;
 
+import static org.junit.Assert.*;
 
-/**
- *
- *
- */
-public class MultipleCopyTest extends TestCase {
-    public MultipleCopyTest(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(MultipleCopyTest.class);
-    }
-
-    public void testClassPath() throws Exception {
-        String sClassPath = System.getProperty("java.class.path");
-        int i = sClassPath.indexOf(Common.CARLOCATIONMESSAGE_JAR);
-        assertTrue(i >= 0);
-    }
 
+public class MultipleCopyTest {
+    @Test
     public void testMultipleCopy() throws Exception {
         CarLocationMessageDocument clm =
-                (CarLocationMessageDocument) XmlObject.Factory.parse(
-                        JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
+            (CarLocationMessageDocument) XmlObject.Factory.parse(
+                JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
         assertNotNull(clm);
         XmlCursor xc = clm.newCursor();
         XmlCursor[] aCursors = new XmlCursor[3];

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCursorSetTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCursorSetTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCursorSetTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/MultipleCursorSetTest.java Fri Jan 18 23:08:44 2019
@@ -16,35 +16,19 @@
 
 package  xmlcursor.detailed;
 
-import junit.framework.*;
-
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlString;
 import org.apache.xmlbeans.XmlCursor.TokenType;
-import xmlcursor.common.*;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlString;
+import org.junit.Test;
 import tools.util.JarUtil;
+import xmlcursor.common.Common;
 
+import static org.junit.Assert.*;
 
-/**
- *
- *
- */
-public class MultipleCursorSetTest extends TestCase {
-    public MultipleCursorSetTest(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(MultipleCursorSetTest.class);
-    }
-
-    public void testClassPath() throws Exception {
-        String sClassPath = System.getProperty("java.class.path");
-        int i = sClassPath.indexOf(Common.CARLOCATIONMESSAGE_JAR);
-        assertTrue(i >= 0);
-    }
 
+public class MultipleCursorSetTest {
+    @Test
     public void testMultipleCursorSet() throws Exception {
         XmlCursor xc = XmlObject.Factory.parse(JarUtil.getResourceFromJar(
                 Common.TRANXML_FILE_CLM)).newCursor();
@@ -61,13 +45,13 @@ public class MultipleCursorSetTest exten
         }
         for (int i = 0; i < 6; i++) {
             for (int j = 0; j != i && j < 6; j++) {
-                assertEquals(false, aCursors[i].isAtSamePositionAs(aCursors[j]));
+                assertFalse(aCursors[i].isAtSamePositionAs(aCursors[j]));
             }
         }
         xs.setStringValue("XYZ");
         for (int i = 0; i < 6; i++) {
             for (int j = 0; j < 6; j++) {
-                assertEquals(true, aCursors[i].isAtSamePositionAs(aCursors[j]));
+                assertTrue(aCursors[i].isAtSamePositionAs(aCursors[j]));
             }
             // System.out.println(aCursors[i].currentTokenType());
             // assertEquals(null, aCursors[i].getTextValue());

Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/NamespaceForPrefixTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/NamespaceForPrefixTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/NamespaceForPrefixTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/NamespaceForPrefixTest.java Fri Jan 18 23:08:44 2019
@@ -16,45 +16,18 @@
 
 package xmlcursor.detailed;
 
-import org.apache.xmlbeans.XmlOptions;
-import junit.framework.*;
-import junit.framework.Assert.*;
-
-import java.io.*;
-
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlBeans;
 import org.apache.xmlbeans.XmlCursor.TokenType;
-import org.apache.xmlbeans.XmlOptions;
-
-import java.util.Map;
-import java.util.HashMap;
-import javax.xml.namespace.QName;
-
-import java.util.Vector;
-
-import xmlcursor.common.*;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Test;
 import tools.util.JarUtil;
+import xmlcursor.common.BasicCursorTestCase;
+import xmlcursor.common.Common;
 
-import java.net.URL;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 
-import org.apache.xmlbeans.xml.stream.XMLInputStream;
-
-
-/**
- *
- *
- */
 public class NamespaceForPrefixTest extends BasicCursorTestCase {
-    public NamespaceForPrefixTest(String sName) {
-        super(sName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(NamespaceForPrefixTest.class);
-    }
-
+    @Test
     public void testNamespaceForPrefixFromSTARTDOC() throws Exception {
         m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\">text</foo>");
         m_xc = m_xo.newCursor();
@@ -69,6 +42,7 @@ public class NamespaceForPrefixTest exte
         assertEquals("uri3", m_xc.namespaceForPrefix("pre3"));
     }
 
+    @Test
     public void testNamespaceForPrefixFromSTARTDOCInvalid() throws Exception {
         m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\">text</foo>");
         m_xc = m_xo.newCursor();
@@ -78,9 +52,10 @@ public class NamespaceForPrefixTest exte
         m_xc.insertNamespace("pre3", "uri3");
         m_xc.insertNamespace(null, "uridefault");
         m_xc.toStartDoc();
-        assertEquals(null, m_xc.namespaceForPrefix("pre4"));
+        assertNull(m_xc.namespaceForPrefix("pre4"));
     }
 
+    @Test
     public void testNamespaceForPrefixFromSTARTDOCNull() throws Exception {
         m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\">text</foo>");
         m_xc = m_xo.newCursor();
@@ -93,6 +68,7 @@ public class NamespaceForPrefixTest exte
         assertEquals("uridefault", m_xc.namespaceForPrefix(null));
     }
 
+    @Test
     public void testNamespaceForPrefixFromSTARTDOCEmptyString() throws Exception {
         m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\">text</foo>");
         m_xc = m_xo.newCursor();
@@ -105,6 +81,7 @@ public class NamespaceForPrefixTest exte
         assertEquals("uridefault", m_xc.namespaceForPrefix(""));
     }
 
+    @Test
     public void testNamespaceForPrefixFromSTART() throws Exception {
         m_xo = XmlObject.Factory.parse(
                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
@@ -114,6 +91,7 @@ public class NamespaceForPrefixTest exte
                      m_xc.namespaceForPrefix("xsi"));
     }
 
+    @Test
     public void testNamespaceForPrefixFromSTARTdefaultNamespace() throws Exception {
         m_xo = XmlObject.Factory.parse(
                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
@@ -123,6 +101,7 @@ public class NamespaceForPrefixTest exte
                      m_xc.namespaceForPrefix(""));
     }
 
+    @Test(expected = IllegalStateException.class)
     public void testNamespaceForPrefixFromATTR() throws Exception {
         m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\"><bar attr0=\"val0\">text</bar></foo>");
         m_xc = m_xo.newCursor();
@@ -136,15 +115,12 @@ public class NamespaceForPrefixTest exte
         m_xc.toNextSelection();
         m_xc.toFirstAttribute();
 
-        try {
-            m_xc.namespaceForPrefix(null);
-            fail("Expected IllegalStateException");
-        } catch (IllegalStateException iae) {
-        }
+        m_xc.namespaceForPrefix(null);
         //assertEquals("nsa", m_xc.namespaceForPrefix(null));
         // assertEquals("uri1", m_xc.namespaceForPrefix("pre1"));
     }
 
+    @Test(expected = IllegalStateException.class)
     public void testNamespaceForPrefixFromEND() throws Exception {
         m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\"><bar attr0=\"val0\">text</bar></foo>");
         m_xc = m_xo.newCursor();
@@ -155,11 +131,7 @@ public class NamespaceForPrefixTest exte
         m_xc.insertNamespace("pre3", "uri3");
         m_xc.insertNamespace(null, "uridefault");
         toNextTokenOfType(m_xc, TokenType.END);
-        try {
-            m_xc.namespaceForPrefix(null);
-            fail("Expected IllegalStateException");
-        } catch (IllegalStateException iae) {
-        }
+        m_xc.namespaceForPrefix(null);
         //  assertEquals("nsa", m_xc.namespaceForPrefix(null));
         // assertEquals("uri1", m_xc.namespaceForPrefix("pre1"));
     }



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


Mime
View raw message