You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2019/01/18 23:08:48 UTC

svn commit: r1851656 [20/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...

Modified: xmlbeans/trunk/test/src/xmlcursor/jsr173/common/ElementTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/jsr173/common/ElementTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/jsr173/common/ElementTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/jsr173/common/ElementTest.java Fri Jan 18 23:08:44 2019
@@ -19,23 +19,26 @@ package xmlcursor.jsr173.common;
 
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
 
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamConstants;
 import javax.xml.namespace.QName;
-
 import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
 
-import junit.framework.*;
-import junit.framework.Assert.*;
+import static org.junit.Assert.*;
 
-/**
- *
-  *
- */
-public abstract class ElementTest extends TestCase {
+@Ignore("abstract class")
+public abstract class ElementTest {
+
+    private XMLStreamReader m_stream;
+    private XmlCursor cur;
 
-     public abstract XMLStreamReader getStream(XmlCursor c)throws Exception;
+    public abstract XMLStreamReader getStream(XmlCursor c) throws Exception;
+
+    @Test
     public void testGetElementText() throws Exception {
         cur.toFirstChild(); //first element?
         m_stream = getStream(cur);
@@ -43,25 +46,26 @@ public abstract class ElementTest extend
         assertEquals("some text", m_stream.getElementText());
     }
 
+    @Test
     public void testGetElementTextEmptyElt() throws Exception {
         cur.toFirstChild(); //first element?
         cur.toNextSibling();
-        m_stream = getStream( cur );
+        m_stream = getStream(cur);
 
         assertEquals("", m_stream.getElementText());
     }
 
+    @Test
     public void testGetElementTextMixedContent() throws Exception {
         cur.toFirstChild(); //first element?
         cur.toNextSibling();
         cur.toNextSibling();
-        m_stream =getStream( cur );
+        m_stream = getStream(cur);
         assertEquals(new QName("foo.org", "foo", ""), m_stream.getName());
         try {
             assertEquals("\thooa", m_stream.getElementText());
             fail("Mixed content needs exception");
-        }
-        catch (javax.xml.stream.XMLStreamException e) {
+        } catch (javax.xml.stream.XMLStreamException e) {
         }
 
         //mixed content txt1, PI, COMMENT,txt2:
@@ -74,58 +78,57 @@ public abstract class ElementTest extend
         cur.insertProcInst("xml-stylesheet", "http://foobar");
         cur.insertChars("txt1\t");
         cur.toStartDoc();
-         m_stream = getStream( cur );
-         assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next() );
+        m_stream = getStream(cur);
+        assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
         assertEquals("  \n txt1\t", m_stream.getElementText());
-
-
     }
 
+    @Test
     public void testGetNameAtStartElt() throws Exception {
         cur.toFirstChild(); //first element
-        m_stream = getStream( cur );
+        m_stream = getStream(cur);
         assertEquals(new QName("foo.org", "foo", ""), m_stream.getName());
-
     }
 
+    @Test
     public void testGetNameAtEndElt() throws Exception {
         cur.toFirstChild();
-        m_stream = getStream( cur );
+        m_stream = getStream(cur);
         m_stream.next();
         assertEquals(XMLStreamConstants.END_ELEMENT, m_stream.next());
         assertEquals(new QName("foo.org", "foo", ""), m_stream.getName());
     }
 
-    public void testHasName() throws Exception{
-
-        m_stream = getStream( cur );
+    @Test
+    public void testHasName() throws Exception {
+        m_stream = getStream(cur);
         m_stream.next();
-         m_stream.next();
-         assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
-        assertTrue( m_stream.hasName() );
-
+        m_stream.next();
+        assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
+        assertTrue(m_stream.hasName());
     }
 
     //call at a bad place..here just attr but should exhaust all
-    public void testGetNameIllegal() throws Exception{
+    @Test
+    public void testGetNameIllegal() throws Exception {
         cur.toNextToken(); //attr
-         m_stream = getStream( cur );
+        m_stream = getStream(cur);
         try {
             m_stream.getName();
             fail("getName illegal pos");
-        }
-        catch (java.lang.IllegalStateException e) {
+        } catch (java.lang.IllegalStateException e) {
         }
 
-        assertFalse( m_stream.hasName() );
+        assertFalse(m_stream.hasName());
     }
 
+    @Before
     public void setUp() throws Exception {
         cur = XmlObject.Factory.newInstance().newCursor();
         cur.toNextToken();
 
         cur.insertAttributeWithValue(new QName("foo.org", "at0", "pre"),
-                "val0");
+            "val0");
         cur.insertNamespace("pre", "foons.bar.org");
         cur.beginElement(new QName("foo.org", "foo", ""));
         cur.insertAttribute("localName");
@@ -142,13 +145,9 @@ public abstract class ElementTest extend
 
     }
 
-    public void tearDown() throws Exception
-    {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         if (m_stream != null)
             m_stream.close();
     }
-
-    private XMLStreamReader m_stream;
-    private XmlCursor cur;
 }
\ No newline at end of file

Modified: xmlbeans/trunk/test/src/xmlcursor/jsr173/common/GeneralMethodsTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/jsr173/common/GeneralMethodsTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/jsr173/common/GeneralMethodsTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/jsr173/common/GeneralMethodsTest.java Fri Jan 18 23:08:44 2019
@@ -16,21 +16,22 @@
 package xmlcursor.jsr173.common;
 
 import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlDocumentProperties;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlDocumentProperties;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
 
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.*;
-import javax.xml.stream.XMLStreamException;
 import javax.xml.namespace.QName;
-
+import javax.xml.stream.Location;
 import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
-import junit.framework.*;
-
+import static org.junit.Assert.*;
 
-//
 
 /**
  * Methods tested
@@ -43,71 +44,69 @@ import junit.framework.*;
  * isStandalone
  * require
  * standaloneSet
- *
- *
-  *
  */
-public abstract class GeneralMethodsTest extends TestCase {
+@Ignore("abstract class")
+public abstract class GeneralMethodsTest {
 
-     public abstract XMLStreamReader getStream(XmlCursor c)
-             throws Exception;
-    public void testClose() throws Exception {
-        m_stream.close();
+    private XMLStreamReader m_stream;
+    private XMLStreamReader m_stream1;
 
+    public abstract XMLStreamReader getStream(XmlCursor c) throws Exception;
 
+    @Test
+    public void testClose() throws Exception {
+        m_stream.close();
         m_stream.next();
-
-
     }
 
+    @Test
     public void testAll() throws Exception {
-          m_stream.next();
-         m_stream.next();
+        m_stream.next();
+        m_stream.next();
         assertEquals("utf-8", m_stream.getCharacterEncodingScheme());
-       //  Eric says this refers to actual encoding, not xml def
-        //  assertEquals("utf-8", m_stream.getEncoding());
-
-         assertEquals(null, m_stream1.getCharacterEncodingScheme());
-        assertEquals(null, m_stream1.getEncoding());
+        assertEquals("utf-8", m_stream1.getCharacterEncodingScheme());
+        assertNull(m_stream1.getEncoding());
         //TODO: why is this still -1???
         Location l = m_stream.getLocation();
         assertEquals(-1, l.getCharacterOffset());
         assertEquals(-1, l.getColumnNumber());
         assertEquals(-1, l.getLineNumber());
-        assertEquals(null, l.getPublicId());
-        assertEquals(null, l.getSystemId());
+        assertNull(l.getPublicId());
+        assertNull(l.getSystemId());
 
 
-       // m_stream.getProperty("");
+        // m_stream.getProperty("");
         m_stream.getVersion();
 //        m_stream.isStandalone();
-        assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.getEventType() );
+        assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.getEventType());
         //only elements can have localnames
-         try{
-               m_stream.require(10, "", "at1");
+        try {
+            m_stream.require(10, "", "at1");
             fail("IllegalStateException needed here");
-        }catch (IllegalStateException e){}
+        } catch (IllegalStateException e) {
+        }
 
 
-          m_stream.next();
-         assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next() ) ;
-          m_stream.require(1, "foo.org", "foo");
-        try{
-                     m_stream.require(10, "", "");
-                   fail("XMLStreamException needed here");
-               }catch (XMLStreamException e){}
+        m_stream.next();
+        assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
+        m_stream.require(1, "foo.org", "foo");
+        try {
+            m_stream.require(10, "", "");
+            fail("XMLStreamException needed here");
+        } catch (XMLStreamException e) {
+        }
 
 
 //        m_stream.standaloneSet();
     }
 
-
+    @Before
     public void setUp() throws Exception {
-        cur = XmlObject.Factory.newInstance().newCursor();
+        XmlCursor cur = XmlObject.Factory.newInstance().newCursor();
         cur.toNextToken();
 
         cur.insertAttributeWithValue(new QName("foo.org", "at0", "pre"),
-                "val0");
+            "val0");
         cur.insertAttributeWithValue(new QName("", "at1", "pre"), "val1");
         cur.insertNamespace("pre", "foons.bar.org");
         cur.beginElement(new QName("foo.org", "foo", ""));
@@ -118,26 +117,20 @@ public abstract class GeneralMethodsTest
         cur.insertProcInst("xml-stylesheet", "http://foobar");
 
         cur.toStartDoc();
-        XmlDocumentProperties opt=cur.documentProperties();
+        XmlDocumentProperties opt = cur.documentProperties();
 
-        m_stream1 = getStream( cur );
+        m_stream1 = getStream(cur);
 
-         opt.setEncoding("utf-8");
-        m_stream=  getStream( cur );
+        opt.setEncoding("utf-8");
+        m_stream = getStream(cur);
 
     }
 
-    public void tearDown() throws Exception
-    {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         if (m_stream != null)
             m_stream.close();
     }
 
-    private XMLStreamReader m_stream;
-     private XMLStreamReader m_stream1;
-    private XmlCursor cur;
-    private XmlOptions opt;
-
 
 }
\ No newline at end of file

Modified: xmlbeans/trunk/test/src/xmlcursor/jsr173/common/IsXXXTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/jsr173/common/IsXXXTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/jsr173/common/IsXXXTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/jsr173/common/IsXXXTest.java Fri Jan 18 23:08:44 2019
@@ -18,29 +18,32 @@ package xmlcursor.jsr173.common;
 
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.store.Public2;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
 
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamConstants;
 import javax.xml.namespace.QName;
-
 import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
 
-import junit.framework.*;
-import junit.framework.Assert.*;
+import static org.junit.Assert.*;
 
 /**
  * This class tests next, hasNext, nextTag,getEventType and isXXX methods
- *
- *
- *
  */
-public abstract class IsXXXTest extends TestCase {
+@Ignore("abstract class")
+public abstract class IsXXXTest {
+
+    private XMLStreamReader m_stream;
 
     public abstract XMLStreamReader getStream(XmlCursor c) throws Exception;
 
+    @Test
     public void testAll() throws Exception {
         assertEquals(XMLStreamConstants.START_DOCUMENT,
-                m_stream.getEventType());
+            m_stream.getEventType());
 
         assertTrue(m_stream.hasNext());
         assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.next());
@@ -74,9 +77,9 @@ public abstract class IsXXXTest extends
 
         assertTrue(m_stream.hasNext());
         assertEquals(XMLStreamConstants.PROCESSING_INSTRUCTION,
-                m_stream.next());
+            m_stream.next());
         assertEquals(XMLStreamConstants.PROCESSING_INSTRUCTION,
-                m_stream.getEventType());
+            m_stream.getEventType());
 
 
         assertTrue(m_stream.hasNext());
@@ -100,45 +103,42 @@ public abstract class IsXXXTest extends
 
     /**
      * Not Impl
-     * public void testNextTag() throws Exception {
-     * try{
-     * m_stream.nextTag();
-     * fail("shouldn't jump to next tag");
-     * }catch (IllegalStateException e){}
-     * <p/>
-     * cur = Public2.newStore();
-     * cur.toNextToken();
-     * <p/>
-     * cur.insertComment("cmt");
-     * cur.beginElement("foobar");
-     * cur.insertChars("   \n");
-     * cur.toNextToken();
-     * cur.insertProcInst("xml-foo","http://foo.org");
-     * cur.insertElement("foobar1");
-     * <p/>
-     * m_stream=cur.newXMLStreamReader();
-     * <p/>
-     * assertEquals ( XMLStreamConstants.START_ELEMENT, m_stream.nextTag());
-     * assertEquals("fooabar", m_stream.getLocalName());
-     * assertEquals ( XMLStreamConstants.END_ELEMENT, m_stream.nextTag());
-     * assertEquals("fooabar", m_stream.getLocalName());
-     * <p/>
-     * assertEquals ( XMLStreamConstants.START_ELEMENT, m_stream.nextTag());
-     * assertEquals("fooabar1", m_stream.getLocalName());
-     * assertEquals ( XMLStreamConstants.END_ELEMENT, m_stream.nextTag());
-     * assertEquals("fooabar1", m_stream.getLocalName());
-     * <p/>
-     * <p/>
-     * }
      */
+    @Test
+    @Ignore
+    public void testNextTag() throws Exception {
+        try {
+            m_stream.nextTag();
+            fail("shouldn't jump to next tag");
+        } catch (IllegalStateException e) {
+        }
+        XmlCursor cur = Public2.newStore();
+        cur.toNextToken();
+        cur.insertComment("cmt");
+        cur.beginElement("foobar");
+        cur.insertChars("   \n");
+        cur.toNextToken();
+        cur.insertProcInst("xml-foo", "http://foo.org");
+        cur.insertElement("foobar1");
+        m_stream = cur.newXMLStreamReader();
+        assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.nextTag());
+        assertEquals("fooabar", m_stream.getLocalName());
+        assertEquals(XMLStreamConstants.END_ELEMENT, m_stream.nextTag());
+        assertEquals("fooabar", m_stream.getLocalName());
+
+        assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.nextTag());
+        assertEquals("fooabar1", m_stream.getLocalName());
+        assertEquals(XMLStreamConstants.END_ELEMENT, m_stream.nextTag());
+        assertEquals("fooabar1", m_stream.getLocalName());
+    }
 
-
+    @Before
     public void setUp() throws Exception {
-        cur = XmlObject.Factory.newInstance().newCursor();
+        XmlCursor cur = XmlObject.Factory.newInstance().newCursor();
         cur.toNextToken();
 
         cur.insertAttributeWithValue(new QName("foo.org", "at0", "pre"),
-                "val0");
+            "val0");
         cur.insertAttributeWithValue(new QName("", "at1", "pre"), "val1");
         cur.insertNamespace("pre", "foons.bar.org");
         cur.beginElement(new QName("foo.org", "foo", ""));
@@ -155,15 +155,9 @@ public abstract class IsXXXTest extends
         m_stream = getStream(cur);
     }
 
-    public void tearDown() throws Exception
-    {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         if (m_stream != null)
             m_stream.close();
     }
-
-    private XMLStreamReader m_stream;
-    private XmlCursor cur;
-
-
 }
\ No newline at end of file

Modified: xmlbeans/trunk/test/src/xmlcursor/jsr173/common/NamespaceTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/jsr173/common/NamespaceTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/jsr173/common/NamespaceTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/jsr173/common/NamespaceTest.java Fri Jan 18 23:08:44 2019
@@ -18,270 +18,263 @@ package xmlcursor.jsr173.common;
 
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
 
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
 import javax.xml.namespace.QName;
-
 import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
 
-import junit.framework.*;
-import junit.framework.Assert.*;
-
+import static org.junit.Assert.*;
 
 
 /**
  * Methods tested
-  * getLocalName
+ * getLocalName
  * getName
  * getNamespaceContext
  * getNamespaceCount
  * getNamespacePrefix
  * getNamespaceURI  x 3
- *  getPrefix
- *
-  *
+ * getPrefix
  */
-public abstract class NamespaceTest extends TestCase{
+@Ignore("abstract class")
+public abstract class NamespaceTest {
 
-  //only valid at TAGs and ER
+    private XMLStreamReader m_stream;
+
+    //only valid at TAGs and ER
     //TODO: ER
 
-    public abstract XMLStreamReader getStream(XmlCursor c)throws Exception;
-    public void testGetLocalName() throws Exception{
-      try{
-          m_stream.getLocalName();
-         fail("no name at startdoc");
-      }catch (IllegalStateException e){}
-
-      m_stream.next();  m_stream.next();
-       assertEquals( XMLStreamConstants.START_ELEMENT, m_stream.next() );
-      assertEquals("foo",m_stream.getLocalName());
-       m_stream.next();
-      assertEquals( XMLStreamConstants.END_ELEMENT, m_stream.next() );
-          assertEquals("foo",m_stream.getLocalName());
+    public abstract XMLStreamReader getStream(XmlCursor c) throws Exception;
+
+    @Test
+    public void testGetLocalName() throws Exception {
+        try {
+            m_stream.getLocalName();
+            fail("no name at startdoc");
+        } catch (IllegalStateException e) {
+        }
+
+        m_stream.next();
+        m_stream.next();
+        assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
+        assertEquals("foo", m_stream.getLocalName());
+        m_stream.next();
+        assertEquals(XMLStreamConstants.END_ELEMENT, m_stream.next());
+        assertEquals("foo", m_stream.getLocalName());
     }
-    public void testGetName(){
+
+    @Test
+    public void testGetName() {
         //test in Element--only valid for Element events
     }
 
-      public void testGetPrefix()throws Exception{
-         assertEquals(XMLStreamConstants.START_DOCUMENT,
-                m_stream.getEventType());
-
-       try{
-        assertEquals( null, m_stream.getPrefix()  );
-           fail("no prefix here");
-       }catch (IllegalStateException e){}
+    @Test
+    public void testGetPrefix() throws Exception {
+        assertEquals(XMLStreamConstants.START_DOCUMENT,
+            m_stream.getEventType());
+
+        try {
+            assertNull(m_stream.getPrefix());
+            fail("no prefix here");
+        } catch (IllegalStateException e) {
+        }
         //  assertFalse( m_stream.hasText() );
-         assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.next());
-         try{
-        assertEquals( null, m_stream.getPrefix()  );
-           fail("no prefix here");
-       }catch (IllegalStateException e){}
-
-         assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
-        try{
-        assertEquals( null, m_stream.getPrefix()  );
-           fail("no prefix here");
-       }catch (IllegalStateException e){}
+        assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.next());
+        try {
+            assertNull(m_stream.getPrefix());
+            fail("no prefix here");
+        } catch (IllegalStateException e) {
+        }
+
+        assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
+        try {
+            assertNull(m_stream.getPrefix());
+            fail("no prefix here");
+        } catch (IllegalStateException e) {
+        }
 
         assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
-        assertEquals("",m_stream.getPrefix());
+        assertEquals("", m_stream.getPrefix());
 
         assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
-       try{
-        assertEquals( null, m_stream.getPrefix()  );
-           fail("no prefix here");
-       }catch (IllegalStateException e){}
+        try {
+            assertNull(m_stream.getPrefix());
+            fail("no prefix here");
+        } catch (IllegalStateException e) {
+        }
 
         assertEquals(XMLStreamConstants.END_ELEMENT, m_stream.next());
-        assertEquals("",m_stream.getPrefix());
+        assertEquals("", m_stream.getPrefix());
         assertEquals(XMLStreamConstants.PROCESSING_INSTRUCTION, m_stream.next());
-          try{
-                assertEquals( null, m_stream.getPrefix()  );
-                   fail("no prefix here");
-               }catch (IllegalStateException e){}
-
-         assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
+        try {
+            assertNull(m_stream.getPrefix());
+            fail("no prefix here");
+        } catch (IllegalStateException e) {
+        }
 
+        assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
 
         assertEquals(XMLStreamConstants.COMMENT, m_stream.next());
-        try{
-        assertEquals( null, m_stream.getPrefix()  );
-           fail("no prefix here");
-       }catch (IllegalStateException e){}
-    }
-
-    /*@status inactive*/
-    public void testGetNamespaceContext() throws Exception{
-
-
-//        assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.next());
-//         assertEquals("", m_stream.getNamespaceContext().getNamespaceURI(""))  ;
-//        assertEquals("", m_stream.getNamespaceContext().getPrefix("foo.org"))  ;
-//          java.util.Iterator it= m_stream.getNamespaceContext().getPrefixes("foo.bar")  ;
-//
-          m_stream.next();
-          m_stream.next();
-          m_stream.next();
+        try {
+            assertNull(m_stream.getPrefix());
+            fail("no prefix here");
+        } catch (IllegalStateException e) {
+        }
+    }
+
+    @Test
+    public void testGetNamespaceContext() throws Exception {
+        //assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.next());
+        //assertEquals("", m_stream.getNamespaceContext().getNamespaceURI(""));
+        //assertEquals("", m_stream.getNamespaceContext().getPrefix("foo.org"));
+        //java.util.Iterator it = m_stream.getNamespaceContext().getPrefixes("foo.bar");
+
+        m_stream.next();
+        m_stream.next();
+        m_stream.next();
 
-          assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
-     //   assertEquals("", m_stream.getNamespaceContext().getNamespaceURI(""))  ;
+        assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
+        //assertEquals("", m_stream.getNamespaceContext().getNamespaceURI(""))  ;
         //assertEquals("", m_stream.getNamespaceContext().getPrefix("foo.bar"))  ;
-        assertEquals(null, m_stream.getNamespaceContext().getPrefix("foo.bar"))  ;
-        java.util.Iterator it= m_stream.getNamespaceContext().getPrefixes("foo.bar")  ;
+        assertNull(m_stream.getNamespaceContext().getPrefix("foo.bar"));
+        java.util.Iterator it = m_stream.getNamespaceContext().getPrefixes("foo.bar");
     }
 
-   /**
-    * only valid at Tags and NS decl
-    * @throws Exception
-    */
-
-    public void testGetNamespaceCount()throws Exception{
-          m_stream.next();
-         assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
-         assertEquals( 1, m_stream.getNamespaceCount() )  ;
-
-         assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
-         assertEquals( 2, m_stream.getNamespaceCount() )  ;
-
-       //java.lang.IllegalStateException
-       // - if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE
-          try{
-              assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
-               m_stream.getNamespaceCount();
-              fail("can't do this on a txt node");
-          } catch (IllegalStateException e){}
+    /**
+     * only valid at Tags and NS decl
+     */
+    @Test
+    public void testGetNamespaceCount() throws Exception {
+        m_stream.next();
+        assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
+        assertEquals(1, m_stream.getNamespaceCount());
 
+        assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
+        assertEquals(2, m_stream.getNamespaceCount());
 
+        //java.lang.IllegalStateException
+        // - if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE
+        try {
+            assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
+            m_stream.getNamespaceCount();
+            fail("can't do this on a txt node");
+        } catch (IllegalStateException e) {
+        }
 
         assertEquals(XMLStreamConstants.END_ELEMENT, m_stream.next());
-        assertEquals( 2, m_stream.getNamespaceCount() )  ;
+        assertEquals(2, m_stream.getNamespaceCount());
+    }
 
-       }
     /**
-       * only valid at Tags and NS decl
-       * @throws Exception
-       */
-
-     public void testGetNamespacePrefix()throws Exception{
-          m_stream.next();
-         assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
-         assertEquals( "pre0", m_stream.getNamespacePrefix(0) )  ;
-
-         assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
-         assertEquals( "pre", m_stream.getNamespacePrefix(0) )  ;
-         assertEquals( "pre1", m_stream.getNamespacePrefix(1) )  ;
+     * only valid at Tags and NS decl
+     */
+    @Test
+    public void testGetNamespacePrefix() throws Exception {
+        m_stream.next();
+        assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
+        assertEquals("pre0", m_stream.getNamespacePrefix(0));
+
+        assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
+        assertEquals("pre", m_stream.getNamespacePrefix(0));
+        assertEquals("pre1", m_stream.getNamespacePrefix(1));
         //java.lang.IllegalStateException
         // - if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE
 
-          try{
-              assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
-               assertEquals(XMLStreamConstants.CHARACTERS, m_stream.getEventType());
-               m_stream.getNamespacePrefix(0);
-              fail("can't do this on a txt node");
-          } catch (IllegalStateException e){}
-
+        try {
+            assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
+            assertEquals(XMLStreamConstants.CHARACTERS, m_stream.getEventType());
+            m_stream.getNamespacePrefix(0);
+            fail("can't do this on a txt node");
+        } catch (IllegalStateException e) {
+        }
 
         assertEquals(XMLStreamConstants.END_ELEMENT, m_stream.next());
-        assertEquals( "pre", m_stream.getNamespacePrefix(0) )  ;
-         assertEquals( "pre1", m_stream.getNamespacePrefix(1) )  ;
-       }
-
-       public void testGetNamespacePrefixNeg()throws Exception{
-            m_stream.next();
-         assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
-           try{
-         assertEquals( "", m_stream.getNamespacePrefix(-1) )  ;
-               fail("negative index");
-           }catch (java.lang.IndexOutOfBoundsException e){}
-
-       }
-
-    public void testGetNamespacePrefixLarge()throws Exception{
-            m_stream.next();
-         assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
-        try{
-         assertEquals( "", m_stream.getNamespacePrefix(3) )  ;
-               fail("negative index");
-           }catch (java.lang.IndexOutOfBoundsException e){}
-
-       }
-
-           //3 methods here
-     public void testGetNamespaceURI()throws Exception{
-               m_stream.next();
-         assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
-         assertEquals( "bea.com", m_stream.getNamespaceURI(0) )  ;
-
-         assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
-         assertEquals( "foons.bar.org", m_stream.getNamespaceURI(0) )  ;
-         assertEquals( "foons1.bar1.org1", m_stream.getNamespaceURI(1) )  ;
-          try{
-              assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
-               m_stream.getNamespaceURI(0);
-              fail("can't do this on a txt node");
-          } catch (IllegalStateException e){}
+        assertEquals("pre", m_stream.getNamespacePrefix(0));
+        assertEquals("pre1", m_stream.getNamespacePrefix(1));
+    }
 
+    @Test(expected = IndexOutOfBoundsException.class)
+    public void testGetNamespacePrefixNeg() throws Exception {
+        m_stream.next();
+        assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
+        m_stream.getNamespacePrefix(-1);
+    }
+
+    @Test(expected = IndexOutOfBoundsException.class)
+    public void testGetNamespacePrefixLarge() throws Exception {
+        m_stream.next();
+        assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
+        assertEquals("", m_stream.getNamespacePrefix(3));
+    }
+
+    //3 methods here
+    @Test
+    public void testGetNamespaceURI() throws Exception {
+        m_stream.next();
+        assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
+        assertEquals("bea.com", m_stream.getNamespaceURI(0));
+
+        assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
+        assertEquals("foons.bar.org", m_stream.getNamespaceURI(0));
+        assertEquals("foons1.bar1.org1", m_stream.getNamespaceURI(1));
+        try {
+            assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
+            m_stream.getNamespaceURI(0);
+            fail("can't do this on a txt node");
+        } catch (IllegalStateException e) {
+        }
 
         assertEquals(XMLStreamConstants.END_ELEMENT, m_stream.next());
-        assertEquals( "foons.bar.org", m_stream.getNamespaceURI(0) )  ;
-         assertEquals( "foons1.bar1.org1", m_stream.getNamespaceURI(1) )  ;
-       }
-
-      public void testGetNamespaceURINeg()throws Exception{
-            m_stream.next();
-         assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
-           try{
-         assertEquals( "", m_stream.getNamespaceURI(-1) )  ;
-               fail("negative index");
-           }catch (java.lang.IndexOutOfBoundsException e){}
-
-       }
-
-    public void testGetNamespaceURILarge()throws Exception{
-            m_stream.next();
-         assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
-        try{
-         assertEquals( "", m_stream.getNamespaceURI(3) )  ;
-               fail("negative index");
-           }catch (java.lang.IndexOutOfBoundsException e){}
+        assertEquals("foons.bar.org", m_stream.getNamespaceURI(0));
+        assertEquals("foons1.bar1.org1", m_stream.getNamespaceURI(1));
+    }
 
-       }
+    @Test(expected = IndexOutOfBoundsException.class)
+    public void testGetNamespaceURINeg() throws Exception {
+        m_stream.next();
+        assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
+        assertEquals("", m_stream.getNamespaceURI(-1));
+    }
+
+    @Test(expected = IndexOutOfBoundsException.class)
+    public void testGetNamespaceURILarge() throws Exception {
+        m_stream.next();
+        assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next());
+        assertEquals("", m_stream.getNamespaceURI(3));
+    }
+
+    @Before
     public void setUp() throws Exception {
-              cur = XmlObject.Factory.newInstance().newCursor();
-              cur.toNextToken();
+        XmlCursor cur = XmlObject.Factory.newInstance().newCursor();
+        cur.toNextToken();
+
+        cur.insertAttributeWithValue(new QName("foo.org", "at0", "pre"),
+            "val0");
+        cur.insertNamespace("pre0", "bea.com");
+
+        cur.beginElement(new QName("foo.org", "foo", ""));
+        cur.insertNamespace("pre", "foons.bar.org");
+        cur.insertNamespace("pre1", "foons1.bar1.org1");
+        cur.insertChars("some text");
+        cur.toNextToken();
+        cur.toNextToken();//end elt
+        cur.insertProcInst("xml-stylesheet", "http://foobar");
+        cur.insertChars("\t");
+        cur.insertComment(" some comment ");
 
-              cur.insertAttributeWithValue(new QName("foo.org", "at0", "pre"),
-                      "val0");
-               cur.insertNamespace("pre0", "bea.com");
-
-              cur.beginElement(new QName("foo.org", "foo", ""));
-              cur.insertNamespace("pre", "foons.bar.org");
-              cur.insertNamespace("pre1", "foons1.bar1.org1");
-              cur.insertChars("some text");
-              cur.toNextToken();
-              cur.toNextToken();//end elt
-              cur.insertProcInst("xml-stylesheet", "http://foobar");
-              cur.insertChars("\t");
-            cur.insertComment(" some comment ");
-
-              cur.toStartDoc();
-
-              m_stream=getStream( cur );
-          }
-
-          public void tearDown() throws Exception
-          {
-              super.tearDown();
-              if (m_stream != null)
-                  m_stream.close();
-          }
+        cur.toStartDoc();
 
-          private XMLStreamReader m_stream;
-          private XmlCursor cur;
+        m_stream = getStream(cur);
+    }
 
+    @After
+    public void tearDown() throws Exception {
+        if (m_stream != null)
+            m_stream.close();
+    }
 }
 

Modified: xmlbeans/trunk/test/src/xmlcursor/jsr173/common/PITest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/jsr173/common/PITest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/jsr173/common/PITest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/jsr173/common/PITest.java Fri Jan 18 23:08:44 2019
@@ -18,63 +18,61 @@ package xmlcursor.jsr173.common;
 
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
 
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.namespace.QName;
-
-import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
 
-import junit.framework.*;
-import junit.framework.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 
 /**
  * Methods tested:
  * getPIData
  * getPITarget
- *
- *
-  *
  */
-public abstract class PITest extends TestCase {
+@Ignore("abstract class")
+public abstract class PITest {
+
+    private XMLStreamReader m_stream;
 
-    public abstract XMLStreamReader getStream(XmlCursor c)throws Exception;
+    public abstract XMLStreamReader getStream(XmlCursor c) throws Exception;
+
+    @Test
     public void testGetPiData() throws XMLStreamException {
         assertEquals(XMLStreamConstants.PROCESSING_INSTRUCTION,
-                m_stream.next());
+            m_stream.next());
         assertEquals("http://foobar", m_stream.getPIData());
         assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
-        assertEquals(null, m_stream.getPIData());
+        assertNull(m_stream.getPIData());
     }
 
+    @Test
     public void testGetPiTarget() throws XMLStreamException {
         assertEquals(XMLStreamConstants.PROCESSING_INSTRUCTION,
-                m_stream.next());
+            m_stream.next());
         assertEquals("xml-stylesheet", m_stream.getPITarget());
         assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
-        assertEquals(null, m_stream.getPITarget());
+        assertNull(m_stream.getPITarget());
     }
 
+    @Before
     public void setUp() throws Exception {
-        cur = XmlObject.Factory.newInstance().newCursor();
+        XmlCursor cur = XmlObject.Factory.newInstance().newCursor();
         cur.toNextToken();
         cur.insertProcInst("xml-stylesheet", "http://foobar");
         cur.insertElement("foobar");
         cur.toStartDoc();
-        m_stream = getStream( cur );
+        m_stream = getStream(cur);
     }
 
-    public void tearDown() throws Exception
-    {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         if (m_stream != null)
             m_stream.close();
     }
-
-    private XMLStreamReader m_stream;
-    private XmlCursor cur;
-
 }
-
-

Modified: xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorAttributeTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorAttributeTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorAttributeTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorAttributeTest.java Fri Jan 18 23:08:44 2019
@@ -15,26 +15,13 @@
 package xmlcursor.jsr173.detailed;
 
 
-import junit.framework.*;
+import org.apache.xmlbeans.XmlCursor;
 import xmlcursor.jsr173.common.AttributeTest;
 
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.xmlbeans.XmlCursor;
-import org.w3c.dom.Node;
-/**
- *
- *
- */
-public  class CursorAttributeTest
-        extends AttributeTest {
-
-
-    public CursorAttributeTest(String s) {
-        super(s);
-    }
-    public  XMLStreamReader getStream(XmlCursor c)
-    throws Exception{
+public class CursorAttributeTest extends AttributeTest {
+    public XMLStreamReader getStream(XmlCursor c) {
         return c.newXMLStreamReader();
     }
 }

Modified: xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorElementTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorElementTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorElementTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorElementTest.java Fri Jan 18 23:08:44 2019
@@ -16,22 +16,14 @@
 package xmlcursor.jsr173.detailed;
 
 
-import junit.framework.*;
+import org.apache.xmlbeans.XmlCursor;
 import xmlcursor.jsr173.common.ElementTest;
 
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.xmlbeans.XmlCursor;
-import org.w3c.dom.Node;
-/**
- *
- *
- */
-public  class CursorElementTest
-        extends ElementTest {
+public class CursorElementTest extends ElementTest {
 
-    public  XMLStreamReader getStream(XmlCursor c)
-    throws Exception{
+    public XMLStreamReader getStream(XmlCursor c) {
         return c.newXMLStreamReader();
     }
 }
\ No newline at end of file

Modified: xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorGeneralMethodsTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorGeneralMethodsTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorGeneralMethodsTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorGeneralMethodsTest.java Fri Jan 18 23:08:44 2019
@@ -16,17 +16,11 @@
 package xmlcursor.jsr173.detailed;
 
 
+import org.apache.xmlbeans.XmlCursor;
 import xmlcursor.jsr173.common.GeneralMethodsTest;
 
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlDocumentProperties;
-/**
- *
- *
- */
 public  class CursorGeneralMethodsTest
         extends GeneralMethodsTest {
 

Modified: xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorNamespaceTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorNamespaceTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorNamespaceTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/jsr173/detailed/CursorNamespaceTest.java Fri Jan 18 23:08:44 2019
@@ -21,15 +21,9 @@ import xmlcursor.jsr173.common.Namespace
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.xmlbeans.XmlCursor;
-/**
- *
- *
- */
-public  class CursorNamespaceTest
-        extends NamespaceTest {
 
-    public  XMLStreamReader getStream(XmlCursor c)
-    throws Exception{
+public class CursorNamespaceTest extends NamespaceTest {
+    public XMLStreamReader getStream(XmlCursor c) {
         return c.newXMLStreamReader();
     }
 }
\ No newline at end of file

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/CustomerTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/xpath/CustomerTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/CustomerTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/CustomerTest.java Fri Jan 18 23:08:44 2019
@@ -1,198 +1,122 @@
 package xmlcursor.xpath;
 
 
-import java.io.*;
-import java.util.HashMap;
-
-import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.junit.Test;
 
-/**
- *
- */
-public class CustomerTest
-{
-
-    // public class XMLBeanXQueryTest {
-
-    static String sXml = "<?xml version=\"1.0\"?>\n" +
-        "<!DOCTYPE book SYSTEM \"book.dtd\">\n" +
-        "\n" +
-        "<book>\n" +
-        "  <title>Data on the Web</title>\n" +
-        "  <author>Serge Abiteboul</author>\n" +
-        "  <author>Peter Buneman</author>\n" +
-        "  <author>Dan Suciu</author>\n" +
-        "  <section id=\"intro\" difficulty=\"easy\" >\n" +
-        "    <title>Introduction</title>\n" +
-        "    <p>Text ... </p>\n" +
-        "    <section>\n" +
-        "      <title>Audience</title>\n" +
-        "      <p>Text ... </p>\n" +
-        "    </section>\n" +
-        "    <section>\n" +
-        "      <title>Web Data and the Two Cultures</title>\n" +
-        "      <p>Text ... </p>\n" +
-        "      <figure height=\"400\" width=\"400\">\n" +
-        "        <title>Traditional client/server architecture</title>\n" +
-        "        <image source=\"csarch.gif\"/>\n" +
-        "      </figure>\n" +
-        "      <p>Text ... </p>\n" +
-        "    </section>\n" +
-        "  </section>\n" +
-        "  <section id=\"syntax\" difficulty=\"medium\" >\n" +
-        "    <title>A Syntax For Data</title>\n" +
-        "    <p>Text ... </p>\n" +
-        "    <figure height=\"200\" width=\"500\">\n" +
-        "      <title>Graph representations of structures</title>\n" +
-        "      <image source=\"graphs.gif\"/>\n" +
-        "    </figure>\n" +
-        "    <p>Text ... </p>\n" +
-        "    <section>\n" +
-        "      <title>Base Types</title>\n" +
-        "      <p>Text ... </p>\n" +
-        "    </section>\n" +
-        "    <section>\n" +
-        "      <title>Representing Relational Databases</title>\n" +
-        "      <p>Text ... </p>\n" +
-        "      <figure height=\"250\" width=\"400\">\n" +
-        "        <title>Examples of Relations</title>\n" +
-        "        <image source=\"relations.gif\"/>\n" +
-        "      </figure>\n" +
-        "    </section>\n" +
-        "    <section>\n" +
-        "      <title>Representing Object Databases</title>\n" +
-        "      <p>Text ... </p>\n" +
-        "    </section>\n" +
-        "  </section>\n" +
-        "</book>";
-
-
-    static String sXml1 = "<report>\n" +
-        "  <section>\n" +
-        "    <section.title>Procedure</section.title>\n" +
-        "     <section.content>\n" +
-        "      The patient was taken to the operating room where she was placed\n" +
-        "      in supine position and\n" +
-        "      </section.content> </section></report>";
-
-    public static void test_xpath(int id, String xml, String xpath)
-    {
-        try
-        {
-            System.out.println("\n====== test" + id + ": " + xpath + " =======");
-            XmlObject xmlObj = XmlObject.Factory.parse(xml);
-            XmlObject[] results = xmlObj.selectPath(xpath);
-            show_result(results);
-        }
-        catch (Throwable e)
-        {
-            e.printStackTrace();
-        }
-    }
+import java.util.HashMap;
 
-    public static void test_xquery(int id, String xmlFile, String xquery)
-    {
-        try
-        {
-            System.out.println("\n====== test" + id + ": " + xquery + " =======");
-            XmlObject xmlObj = XmlObject.Factory.parse(sXml);
-            XmlObject[] results = xmlObj.execQuery(xquery);
-            show_result(results);
-        }
-        catch (Throwable e)
-        {
-            e.printStackTrace();
-        }
-    }
 
-    private static void show_result(Object[] results)
-        throws Throwable
-    {
-        for (int i = 0; i < results.length; i++)
-        {
-            Object node = results[i];
-            System.out.println("=> class: " + node.getClass() + ", obj: " + node);
-        }
-    }
+public class CustomerTest {
 
-    public static void test_xpath()
-    {
-        System.out.println("\n====== xpath test =======");
-        /*
-        test_xpath(1, "xml/data/book.xml", "./book/section[@difficulty =
-       \"easy\"]");
-        test_xpath(2, "xml/data/book.xml", "./book/section");
-        test_xpath(3, "xml/data/report1.xml",
-       "./report/section/section.title[text() = \"Procedure\"]");
-        */
-//  test_xpath(0, sXml, "./book/section");
-//  test_xpath(1, sXml, "./book/section[@difficulty =\"easy\"]");
+    private static void test_xpath(int id, String xml, String xpath) throws XmlException {
+        XmlObject xmlObj = XmlObject.Factory.parse(xml);
+        XmlObject[] results = xmlObj.selectPath(xpath);
+    }
+
+    private static void test_xquery(int id, String xquery) throws XmlException {
+        String sXml =
+            "<?xml version=\"1.0\"?>\n" +
+            "<!DOCTYPE book SYSTEM \"book.dtd\">\n" +
+            "\n" +
+            "<book>\n" +
+            "  <title>Data on the Web</title>\n" +
+            "  <author>Serge Abiteboul</author>\n" +
+            "  <author>Peter Buneman</author>\n" +
+            "  <author>Dan Suciu</author>\n" +
+            "  <section id=\"intro\" difficulty=\"easy\" >\n" +
+            "    <title>Introduction</title>\n" +
+            "    <p>Text ... </p>\n" +
+            "    <section>\n" +
+            "      <title>Audience</title>\n" +
+            "      <p>Text ... </p>\n" +
+            "    </section>\n" +
+            "    <section>\n" +
+            "      <title>Web Data and the Two Cultures</title>\n" +
+            "      <p>Text ... </p>\n" +
+            "      <figure height=\"400\" width=\"400\">\n" +
+            "        <title>Traditional client/server architecture</title>\n" +
+            "        <image source=\"csarch.gif\"/>\n" +
+            "      </figure>\n" +
+            "      <p>Text ... </p>\n" +
+            "    </section>\n" +
+            "  </section>\n" +
+            "  <section id=\"syntax\" difficulty=\"medium\" >\n" +
+            "    <title>A Syntax For Data</title>\n" +
+            "    <p>Text ... </p>\n" +
+            "    <figure height=\"200\" width=\"500\">\n" +
+            "      <title>Graph representations of structures</title>\n" +
+            "      <image source=\"graphs.gif\"/>\n" +
+            "    </figure>\n" +
+            "    <p>Text ... </p>\n" +
+            "    <section>\n" +
+            "      <title>Base Types</title>\n" +
+            "      <p>Text ... </p>\n" +
+            "    </section>\n" +
+            "    <section>\n" +
+            "      <title>Representing Relational Databases</title>\n" +
+            "      <p>Text ... </p>\n" +
+            "      <figure height=\"250\" width=\"400\">\n" +
+            "        <title>Examples of Relations</title>\n" +
+            "        <image source=\"relations.gif\"/>\n" +
+            "      </figure>\n" +
+            "    </section>\n" +
+            "    <section>\n" +
+            "      <title>Representing Object Databases</title>\n" +
+            "      <p>Text ... </p>\n" +
+            "    </section>\n" +
+            "  </section>\n" +
+            "</book>";
+        XmlObject xmlObj = XmlObject.Factory.parse(sXml);
+        XmlObject[] results = xmlObj.execQuery(xquery);
+    }
+
+    @Test
+    public void test_xpath() throws XmlException {
+        String sXml1 =
+            "<report>\n" +
+            "  <section>\n" +
+            "    <section.title>Procedure</section.title>\n" +
+            "     <section.content>\n" +
+            "      The patient was taken to the operating room where she was placed\n" +
+            "      in supine position and\n" +
+            "      </section.content> </section></report>";
         test_xpath(2, sXml1,
             "./report/section/section.title[text() = \"Procedure\"]");
-//  test_xpath(3, sXml1,
-// "./report/section[section.title = \"Procedure\"]");
-
-        // this is not allowed in XPath(but it is OK for XQuery).
-        // test_xpath(4, "xml/data/report1.xml", "./report/section/section.title =\"Procedure\"");
     }
 
-    public static void test_xquery()
-    {
-        System.out.println("\n====== xquery test =======");
-        test_xquery(1, "xml/data/bib.xml", xquery1);
-        test_xquery(2, "xml/data/bib.xml", xquery2);
-    }
+    @Test
+    public void test_xquery() throws XmlException {
+        final String xquery1 =
+            "for $b in $this/bib/book "
+            +
+            "  where $b/publisher[text() = \"Addison-Wesley\"] and $b[@year > 1992] "
+            + "return "
+            + "    <book year=\"{ $b/@year }\"> "
+            + "{ $b/title }"
+            + "</book>";
+
+        test_xquery(1, xquery1);
+
+        final String xquery2 =
+            "for $b in $this/bib/book "
+            + "  where $b/publisher = \"Addison-Wesley\" and $b/@year > 1992 "
+            + "return "
+            + "    <book year=\"{ $b/@year }\"> "
+            + "{ $b/title }"
+            + "</book>";
 
-    /*
-    static final String xquery1 = "for $b in ./bib/book "
- +"  where $b/publisher[text() = \"Addison-Wesley\"] and $b[@year > 1992] "
- +"return "
- +"    <book year=\"{ $b/@year }\"> "
- +"{ $b/title }"
- +"</book>";
-    static final String xquery2 = "for $b in ./bib/book "
- +"  where $b/publisher = \"Addison-Wesley\" and $b/@year > 1992 "
- +"return "
- +"    <book year=\"{ $b/@year }\"> "
- +"{ $b/title }"
- +"</book>";
-    */
-    static final String xquery1 = "for $b in $this/bib/book "
-        +
-        "  where $b/publisher[text() = \"Addison-Wesley\"] and $b[@year > 1992] "
-        + "return "
-        + "    <book year=\"{ $b/@year }\"> "
-        + "{ $b/title }"
-        + "</book>";
-    static final String xquery2 = "for $b in $this/bib/book "
-        + "  where $b/publisher = \"Addison-Wesley\" and $b/@year > 1992 "
-        + "return "
-        + "    <book year=\"{ $b/@year }\"> "
-        + "{ $b/title }"
-        + "</book>";
-
-    public static void main(String[] args)
-    {
-        test_xpath();
-        //  test_xquery();
-        try{
-        testXMLBeans();
-        }catch(Exception e){
-            e.printStackTrace();
-        }
+        test_xquery(2, xquery2);
     }
 
-    private static void testXMLBeans()  throws Exception
-    {
+    @Test
+    public void testXMLBeans() throws XmlException {
         XmlObject doc = XmlObject.Factory.parse(" <contact xmlns=\"http://dearjohn/address-book\"/>");
-        HashMap nsMap = new HashMap();
+        HashMap<String, String> nsMap = new HashMap<String, String>();
         nsMap.put("ns", "http://dearjohn/address-book");
-        XmlObject[] xmlObjs = doc.execQuery("/ns:contact", new
+        doc.execQuery("/ns:contact", new
             XmlOptions().setLoadAdditionalNamespaces(nsMap));
-        System.out.println(xmlObjs);
     }
-
-
 }
-
-//}

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/common/BaseXPathTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/xpath/common/BaseXPathTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/common/BaseXPathTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/common/BaseXPathTest.java Fri Jan 18 23:08:44 2019
@@ -14,15 +14,18 @@
  */
 package xmlcursor.xpath.common;
 
+import org.junit.Before;
+import org.junit.Ignore;
 import xmlcursor.common.BasicCursorTestCase;
 
 import java.util.HashMap;
 
+@Ignore("abstract class")
 public abstract class BaseXPathTest extends BasicCursorTestCase {
-    protected HashMap testMap = new HashMap();
+    protected final HashMap<String,String[]> testMap = new HashMap<String,String[]>();
 
-    public BaseXPathTest(String sName) {
-        super(sName);
+    @Before
+    public void setUp() throws Exception {
         String[] add = new String[]{"//price[position()=0+1]"};
         String[] sub = new String[]{"//price[position()=4-2]"};
         String[] mult = new String[]{"//price[position()=2*1]"};

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathCommon.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathCommon.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathCommon.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathCommon.java Fri Jan 18 23:08:44 2019
@@ -15,47 +15,46 @@
 
 package xmlcursor.xpath.common;
 
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
-import junit.framework.Assert;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
 import tools.xml.XmlComparator;
 
-/**
- */
+import static org.junit.Assert.assertTrue;
+
 public class XPathCommon {
 
     public static String display(XmlObject[] rObj) {
         XmlOptions xm = new XmlOptions();
         xm.setSavePrettyPrint();
         xm.setLoadStripWhitespace();
-        StringBuffer sb=new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int i = 0; i < rObj.length; i++) {
-            sb.append("[" + i + "] -- " + rObj[i].xmlText(xm)+"\n");
+            sb.append("[" + i + "] -- " + rObj[i].xmlText(xm) + "\n");
         }
         return sb.toString();
     }
 
 
-    public static String getPrint(XmlObject[] rObj) {
+    private static String getPrint(XmlObject[] rObj) {
         XmlOptions xm = new XmlOptions();
         xm.setSavePrettyPrint();
         xm.setLoadStripWhitespace();
 
-        StringBuffer st = new StringBuffer();
+        StringBuilder st = new StringBuilder();
         for (int i = 0; i < rObj.length; i++) {
             st.append("[" + i + "] -- " + rObj[i].xmlText(xm));
         }
         return st.toString();
     }
 
-    public static String getPrint(XmlCursor rObj) {
+    private static String getPrint(XmlCursor rObj) {
         XmlOptions xm = new XmlOptions();
         xm.setSavePrettyPrint();
         xm.setLoadStripWhitespace();
 
-        StringBuffer st = new StringBuffer();
+        StringBuilder st = new StringBuilder();
         int i = 0;
         while (rObj.toNextSelection()) {
             st.append("[cursor-" + i + "] -- " + rObj.xmlText(xm));
@@ -69,10 +68,10 @@ public class XPathCommon {
         XmlOptions xm = new XmlOptions();
         xm.setSavePrettyPrint();
         xm.setLoadStripWhitespace();
-        StringBuffer sb=new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         int i = 0;
         while (rObj.toNextSelection()) {
-            sb.append("[cursor-" + i + "] -- " + rObj.xmlText(xm)+"\n");
+            sb.append("[cursor-" + i + "] -- " + rObj.xmlText(xm) + "\n");
             i++;
         }
         return sb.toString();
@@ -85,45 +84,47 @@ public class XPathCommon {
                 actual.xmlText(),
                 expected.xmlText(), diag);
 
-            Assert.assertTrue("***********************\nFound difference: \nactual=\n'" +
+            assertTrue(
+                "***********************\nFound difference: \nactual=\n'" +
                 actual.xmlText() +
-                              "'\nexpected=\n'" + expected.xmlText()
+                "'\nexpected=\n'" + expected.xmlText()
                 + "'\ndiagnostic=" + diag, match);
         } catch (XmlException e) {
             throw new RuntimeException(e);
         }
     }
 
-    public static void compare(XmlObject rObj, XmlObject rSet) throws Exception{
-        check(rObj.newCursor(),rSet.newCursor());
+    public static void compare(XmlObject rObj, XmlObject rSet) {
+        check(rObj.newCursor(), rSet.newCursor());
     }
+
     public static void compare(XmlObject[] rObj, XmlObject[] rSet) throws Exception {
 
         if (rObj.length != rSet.length)
-            throw new Exception("Comparison Failed\n " +
-                    "Actual Count: "+rObj.length +" Expected Count: "+rSet.length+"\n" +
-                    "Actual:"+getPrint(rObj)+"\nExpected:"+getPrint(rSet));
+            throw new Exception(
+                "Comparison Failed\n " +
+                "Actual Count: " + rObj.length + " Expected Count: " + rSet.length + "\n" +
+                "Actual:" + getPrint(rObj) + "\nExpected:" + getPrint(rSet));
 
-        for (int i = 0; i < rObj.length; i++){
+        for (int i = 0; i < rObj.length; i++) {
             check(rObj[i].newCursor(), rSet[i].newCursor());
         }
-        // This should be done in the test if no exception occurs...don't print here
-        // System.out.println("Test Passed");
     }
 
     public static void compare(XmlCursor rObj, XmlObject[] rSet) throws Exception {
         if (rObj.getSelectionCount() != rSet.length) {
-            StringBuffer message = new StringBuffer();
+            StringBuilder message = new StringBuilder();
 
             message.append("EXPECTED ==\n");
             display(rSet);
             message.append("ACTUAL ==\n");
             display(rObj);
 
-            throw new Exception(message.toString()+
+            throw new Exception(
+                message.toString() +
                 "\nCompare failure == Result Count was not equal to actual count\n" +
-                    "Actual Count: "+rObj.getSelectionCount() +" Expected Count: "+rSet.length+"\n" +
-                    "Actual:" + getPrint(rObj) + "\nExpected:" + getPrint(rSet));
+                "Actual Count: " + rObj.getSelectionCount() + " Expected Count: " + rSet.length + "\n" +
+                "Actual:" + getPrint(rObj) + "\nExpected:" + getPrint(rSet));
         }
         int i = 0;
         while (rObj.toNextSelection()) {
@@ -133,16 +134,5 @@ public class XPathCommon {
             check(rObj, rSet[i].newCursor());
             i++;
         }
-        // This should be done in the test if no exception occurs...don't print here
-       // System.out.println("Test Passed");
     }
-
-    public static void checkLength(XmlCursor rObj, int count) throws Exception{
-        if(rObj.getSelectionCount() != count){
-            throw new Exception("Length == Return Count was not equal\n"+
-                    "Cursor-Count: "+ rObj.getSelectionCount()+" Expected: "+count+"\n"+
-                    getPrint(rObj));
-        }
-    }
-
 }

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathExpressionTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathExpressionTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathExpressionTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathExpressionTest.java Fri Jan 18 23:08:44 2019
@@ -14,29 +14,31 @@
  */
 package xmlcursor.xpath.common;
 
+import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 /**
  * Verifies XPath with Expressions
  * http://www.w3schools.com/xpath/xpath_expressions.asp
  */
+@Ignore("abstract class")
 public abstract class XPathExpressionTest extends BaseXPathTest {
 
-    String sXml="<foo>" +
-            "<bar><price at=\"val0\">3.00</price>" +
-            "<price at=\"val1\">2</price></bar><bar1>3.00</bar1>" +
-            "</foo>";
-
-    public XPathExpressionTest(String sName) {
-        super(sName);
-    }
-
     //("/catalog/cd[price>10.80]/price
     //Numerical Expressions
+
+
     /**
      * + Addition 6 + 4 10
      */
-    public void testAddition() throws Exception {
+    @Test
+    public void testAddition() {
         String sXpath=getQuery("testAddition",0);
         m_xc.selectPath(sXpath);
         assertEquals(1,m_xc.getSelectionCount());
@@ -46,8 +48,8 @@ public abstract class XPathExpressionTes
     /**
      * - Subtraction 6 - 4 2
      */
-    public void testSubtraction() throws Exception {
-
+    @Test
+    public void testSubtraction() {
         String sXpath=getQuery("testSubtraction",0);
         String sExpected="<price at=\"val1\">2</price>";
         m_xc.selectPath(sXpath);
@@ -55,21 +57,25 @@ public abstract class XPathExpressionTes
         m_xc.toNextSelection();
         assertEquals(sExpected,m_xc.xmlText());
     }
+
     /**
      * * Multiplication 6 * 4 24
      */
-    public void testMultiplication() throws Exception {
+    @Test
+    public void testMultiplication() {
         String sXpath=getQuery("testMultiplication",0);
         String sExpected="<price at=\"val1\">2</price>";
         m_xc.selectPath(sXpath);
         m_xc.toNextSelection();
         assertEquals(sExpected,m_xc.xmlText());
     }
+
     /**
      * div Division 8 div 4 2
      * NOTE: do a case where res is infinite (eg 10 div 3 or 22/7)
      */
-    public void testDiv() throws Exception {
+    @Test
+    public void testDiv() {
         String sXpath=getQuery("testDiv",0); //get the second(last) price child
         String sExpected="<price at=\"val0\">3.00</price>";
         m_xc.selectPath(sXpath);
@@ -94,7 +100,7 @@ public abstract class XPathExpressionTes
             m_xc.selectPath(sXpathZero);
             i = m_xc.getSelectionCount();
             fail("Division by 0");
-        }catch (Exception e){}
+        } catch (Exception ignored){}
         assertEquals(0,i);
 
         m_xc.clearSelections();
@@ -105,11 +111,12 @@ public abstract class XPathExpressionTes
         m_xc.toNextSelection();
         assertEquals(sExpected,m_xc.xmlText());
     }
+
     /**
      * mod Modulus (division remainder) 5 mod 2 1
      */
-    public void testMod() throws Exception {
-
+    @Test(expected = Exception.class)
+    public void testMod() {
         String sXpath=getQuery("testMod",0); //get the second(last) price child
         String sExpected="<price at=\"val1\">2</price>";
 
@@ -132,20 +139,16 @@ public abstract class XPathExpressionTes
         String sXpathZero="10 mod 0";
         m_xc.clearSelections();
         m_xc.toStartDoc();
-        int i = 0;
-        try{
-            m_xc.selectPath(sXpathZero);
-            i = m_xc.getSelectionCount();
-            fail("Mod by 0");
-        }catch (Exception e){}
-        assertEquals(0,i);
+        m_xc.selectPath(sXpathZero);
+        m_xc.getSelectionCount();
     }
 
     //Equality Expressions
     /**
      * = Like (equal) price=9.80 true (if price is 9.80)
      */
-    public void testEqual() throws Exception {
+    @Test
+    public void testEqual() throws XmlException {
         String sXml="<foo><bar>" +
                 "<price at=\"val0\">3.00</price>" +
                 "<price at=\"val1\">2</price></bar><bar>" +
@@ -161,7 +164,8 @@ public abstract class XPathExpressionTes
 
     //Existential semantics of equality in a node set
     //check this--not sure how to create this test
-    public void testEqualityNodeset() throws Exception {
+    @Test
+    public void testEqualityNodeset() {
         String sXpath=getQuery("testEqualityNodeset",0);
         String sExpected="<bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar>";
         m_xc.selectPath(sXpath);
@@ -169,10 +173,12 @@ public abstract class XPathExpressionTes
         m_xc.toNextSelection();
         assertEquals(sExpected,m_xc.xmlText());
     }
+
     /**
      * != Not like (not equal) price!=9.80 false
      */
-    public void testNotEqual() throws Exception {
+    @Test
+    public void testNotEqual() {
         assertEquals(0,m_xc.getSelectionCount());
         String sXpath=getQuery("testNotEqual",0); //has to be double-comparison
         String sExpected="<bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar>";
@@ -187,15 +193,18 @@ public abstract class XPathExpressionTes
     /**
      * < Less than price<9.80 false (if price is 9.80)
      */
-    public void testLessThan() throws Exception {
+    @Test
+    public void testLessThan() {
         String sXpath=getQuery("testLessThan",0);
         m_xc.selectPath(sXpath);
         assertEquals(0,m_xc.getSelectionCount());
     }
+
     /**
      * <= Less or equal price<=9.80 true
      */
-    public void testLessOrEqual() throws Exception {
+    @Test
+    public void testLessOrEqual() {
         String sXpath=getQuery("testLessOrEqual",0);
         String sExpected="<bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar>";
         m_xc.selectPath(sXpath);
@@ -203,10 +212,12 @@ public abstract class XPathExpressionTes
         m_xc.toNextSelection();
         assertEquals(sExpected,m_xc.xmlText());
     }
+
     /**
      * > Greater than price>9.80 false
      */
-    public void testGreaterThan() throws Exception {
+    @Test
+    public void testGreaterThan() {
         String sXpath=getQuery("testGreaterThan",0);
         String sExpected="<bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar>";
         m_xc.selectPath(sXpath);
@@ -214,10 +225,12 @@ public abstract class XPathExpressionTes
         m_xc.toNextSelection();
         assertEquals(sExpected,m_xc.xmlText());
     }
+
     /**
      * >= Greater or equal price>=9.80 true
      */
-    public void testGreaterOrEqual() throws Exception {
+    @Test
+    public void testGreaterOrEqual() {
         String sXpath=getQuery("testGreaterOrEqual",0);
         String sExpected="<bar>" +
                 "<price at=\"val0\">3.00</price><price at=\"val1\">2</price>" +
@@ -232,7 +245,8 @@ public abstract class XPathExpressionTes
     /**
      * or or price=9.80 or price=9.70 true (if price is 9.80)
      */
-    public void testOr() throws Exception {
+    @Test
+    public void testOr() {
         String sXpath=getQuery("testOr",0);
         String sExpected="<price at=\"val1\">2</price>";
         m_xc.selectPath(sXpath);
@@ -240,16 +254,24 @@ public abstract class XPathExpressionTes
         m_xc.toNextSelection();
         assertEquals(sExpected,m_xc.xmlText());
     }
+
     /**
      * and and  price<=9.80 and price=9.70 false
      */
-    public void testAnd() throws Exception {
+    @Test
+    public void testAnd() {
         String sXpath=getQuery("testAnd",0);
         m_xc.selectPath(sXpath);
         assertEquals(0,m_xc.getSelectionCount());
     }
 
-    public void setUp()throws Exception{
+    @Before
+    public void setUp()throws Exception {
+        super.setUp();
+        String sXml = "<foo>" +
+                      "<bar><price at=\"val0\">3.00</price>" +
+                      "<price at=\"val1\">2</price></bar><bar1>3.00</bar1>" +
+                      "</foo>";
         m_xc=XmlObject.Factory.parse(sXml).newCursor();
     }
 

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionAuxTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionAuxTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionAuxTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionAuxTest.java Fri Jan 18 23:08:44 2019
@@ -15,46 +15,29 @@
 
 package xmlcursor.xpath.common;
 
-import xmlcursor.common.BasicCursorTestCase;
-
-import xmlcursor.common.Common;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.framework.Assert;
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Test;
 import tools.util.JarUtil;
+import xmlcursor.common.BasicCursorTestCase;
+import xmlcursor.common.Common;
 
-import java.io.IOException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Verifies XPath using functions
  * http://www.w3schools.com/xpath/xpath_functions.asp
  */
 
-public class XPathFunctionAuxTest
-    extends BasicCursorTestCase
-{
-    public XPathFunctionAuxTest(String sName)
-    {
-        super(sName);
-    }
+public class XPathFunctionAuxTest extends BasicCursorTestCase {
 
-    public static Test suite()
-    {
-        return new TestSuite(XPathFunctionAuxTest.class);
-    }
-
-    static String fixPath(String path)
-    {
+    private static String fixPath(String path) {
         return path;
     }
 
-    public void testFunctionCount_caseB()
-        throws Exception
-    {
+    @Test
+    public void testFunctionCount_caseB() throws Exception {
         XmlObject xDoc = XmlObject.Factory.parse(
             JarUtil.getResourceFromJar("xbean/xmlcursor/xpath/cdcatalog.xml"));
 
@@ -70,14 +53,13 @@ public class XPathFunctionAuxTest
         x1.dispose();
     }
 
-    public void testFunctionConcat_caseB()
-        throws Exception
-    {
+    @Test
+    public void testFunctionConcat_caseB() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price>" +
             "<price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
 
-        String sXPath = "concat(name(/bar[position()=1]/*[position()=last()])," +
+        String sXPath = "concat(name(//bar[position()=1]/*[position()=last()])," +
             "//price[position()=1]/text())";
         String sExpected = Common.wrapInXmlFrag("price3.00");
         m_xc.selectPath(fixPath(sXPath));
@@ -85,10 +67,8 @@ public class XPathFunctionAuxTest
         assertEquals(sExpected, m_xc.xmlText());
     }
 
-    public void testFunctionStringLength_caseB()
-        throws Exception
-    {
-
+    @Test
+    public void testFunctionStringLength_caseB() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
 
@@ -99,9 +79,8 @@ public class XPathFunctionAuxTest
         assertEquals(sExpected, m_xc.xmlText());
     }
 
-    public void testFunctionSubString_caseB()
-        throws Exception
-    {
+    @Test
+    public void testFunctionSubString_caseB() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
 
@@ -109,16 +88,12 @@ public class XPathFunctionAuxTest
         String sExpected = Common.wrapInXmlFrag("ice");
         m_xc.selectPath(fixPath(sXPath));
         m_xc.toNextSelection();
-        assertEquals(XmlCursor.TokenType.TEXT,
-            m_xc.currentTokenType());
+        assertEquals(XmlCursor.TokenType.TEXT, m_xc.currentTokenType());
         assertEquals(sExpected, m_xc.xmlText());
-
     }
 
-    public void testFunctionSubStringAfter_caseB()
-        throws Exception
-    {
-
+    @Test
+    public void testFunctionSubStringAfter_caseB() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
 
@@ -127,13 +102,10 @@ public class XPathFunctionAuxTest
         m_xc.selectPath(fixPath(sXPath));
         m_xc.toNextSelection();
         assertEquals(sExpected, m_xc.xmlText());
-
     }
 
-    public void testFunctionSubStringBefore_caseB()
-        throws Exception
-    {
-
+    @Test
+    public void testFunctionSubStringBefore_caseB() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
 
@@ -145,9 +117,8 @@ public class XPathFunctionAuxTest
         assertEquals(sExpected, m_xc.xmlText());
     }
 
-    public void testFunctionTranslate_caseB()
-        throws Exception
-    {
+    @Test
+    public void testFunctionTranslate_caseB() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
 
@@ -160,9 +131,8 @@ public class XPathFunctionAuxTest
         assertEquals(sExpected, m_xc.xmlText());
     }
 
-    public void testFunctionNumber_caseB()
-        throws Exception
-    {
+    @Test
+    public void testFunctionNumber_caseB() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
         String sXPath = "number(//price/text())+10";
@@ -170,12 +140,10 @@ public class XPathFunctionAuxTest
         m_xc.selectPath(fixPath(sXPath));
         m_xc.toNextSelection();
         assertEquals(sExpected, m_xc.xmlText());
-
     }
 
-    public void testFunctionRound_caseB()
-        throws Exception
-    {
+    @Test
+    public void testFunctionRound_caseB() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.15</price><price at=\"val1\">2.87</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
 
@@ -188,10 +156,8 @@ public class XPathFunctionAuxTest
         assertEquals(sExpected, m_xc.xmlText());
     }
 
-    public void testFunctionSum_caseB()
-        throws Exception
-    {
-
+    @Test
+    public void testFunctionSum_caseB() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
 
@@ -201,11 +167,9 @@ public class XPathFunctionAuxTest
         m_xc.toNextSelection();
         assertEquals(sExpected, m_xc.xmlText());
     }
-//
 
-    public void testFunctionBoolean_caseB_delete()
-        throws Exception
-    {
+    @Test
+    public void testFunctionBoolean_caseB_delete() throws Exception {
         String sXml = "<foo><bar>" +
             "<price at=\"val0\">3.00</price>" +
             "<price at=\"val1\">2</price>" +
@@ -219,7 +183,7 @@ public class XPathFunctionAuxTest
         assertEquals(Common.wrapInXmlFrag("false"),
             m_xc.xmlText());
         assertTrue(!m_xc.toNextSelection());
-        System.out.println("DOC  " + m_xc.xmlText());
+//        System.out.println("DOC  " + m_xc.xmlText());
         m_xc.clearSelections();
         m_xc.toStartDoc();
         m_xc.selectPath("boolean(//price/text())");
@@ -228,9 +192,8 @@ public class XPathFunctionAuxTest
    //     System.out.println("HERE " + m_xc.xmlText());
     }
 
-    public void testFunctionBoolean_caseB()
-        throws Exception
-    {
+    @Test
+    public void testFunctionBoolean_caseB() throws Exception {
         String sXml = "<foo><bar>" +
             "<price at=\"val0\">3.00</price>" +
             "<price at=\"val1\">2</price>" +
@@ -242,8 +205,7 @@ public class XPathFunctionAuxTest
         m_xc.push();
         m_xc.selectPath(sXPath);
         m_xc.toNextSelection();
-        assertEquals(Common.wrapInXmlFrag("false"),
-            m_xc.xmlText());
+        assertEquals(Common.wrapInXmlFrag("false"), m_xc.xmlText());
         m_xc.clearSelections();
 
         //need to reset cursor since it's on a bool outside the doc
@@ -275,12 +237,10 @@ public class XPathFunctionAuxTest
         m_xc.toNextSelection();
         assertEquals(Common.wrapInXmlFrag("false"), m_xc.xmlText());
         m_xc.clearSelections();
-
     }
 
-    public void testFunctionFalse_caseB()
-        throws Exception
-    {
+    @Test
+    public void testFunctionFalse_caseB() throws Exception {
         m_xc =
             XmlObject.Factory.parse(
                 "<foo><price at=\"val0\">3.00</price></foo>")
@@ -289,6 +249,5 @@ public class XPathFunctionAuxTest
         String sExpected = Common.wrapInXmlFrag("foo");
         m_xc.toNextSelection();
         assertEquals(sExpected, m_xc.xmlText());
-
     }
 }

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionTest.java Fri Jan 18 23:08:44 2019
@@ -15,19 +15,20 @@
 
 package xmlcursor.xpath.common;
 
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Ignore;
+import org.junit.Test;
 import tools.util.JarUtil;
 
+import static org.junit.Assert.assertEquals;
+
 /**
  * Verifies XPath using functions
  * http://www.w3schools.com/xpath/xpath_functions.asp
  */
+@Ignore("abstract class")
 public abstract class XPathFunctionTest extends BaseXPathTest {
-    public XPathFunctionTest(String sName) {
-        super(sName);
-    }
-
     //    Node Set Functions
     //    http://www.w3.org/TR/xpath#section-Node-Set-Functions
 
@@ -37,6 +38,7 @@ public abstract class XPathFunctionTest
      *      number=count(node-set)
      *
      */
+    @Test
     public void testFunctionCount() throws Exception {
         String ex0Simple =getQuery("testFunctionCount",0) ;
         String ex0Simple1 =getQuery("testFunctionCount",1) ;
@@ -74,6 +76,7 @@ public abstract class XPathFunctionTest
      *      Selects elements by their unique ID
      *      node-set=id(value)
      */
+    @Test
     public void testFunctionId() throws Exception {
         XmlObject xDoc = XmlObject.Factory.parse(
                 JarUtil.getResourceFromJar("xbean/xmlcursor/xpath/cdcatalog.xml"));
@@ -128,6 +131,7 @@ public abstract class XPathFunctionTest
      *      Returns the position number of the last node in the processed node list
      *      number=last()
      */
+    @Test
     public void testFunctionLast() throws Exception {
         XmlObject xDoc = XmlObject.Factory.parse(
                 JarUtil.getResourceFromJar("xbean/xmlcursor/xpath/cdcatalog.xml"));
@@ -153,6 +157,7 @@ public abstract class XPathFunctionTest
      *      Returns the local part of a node. A node usually consists of a prefix, a colon, followed by the local name
      *      string=local-name(node)
      */
+    @Test
     public void testFunctionLocalName() throws Exception {
         String sXPath = getQuery("testFunctionLocalName",0);
         String sXml = "<foo xmlns:pre=\"uri.org\">" +
@@ -182,6 +187,7 @@ public abstract class XPathFunctionTest
      *      Returns the namespace URI of a specified node
      *      uri=namespace-uri(node)
      */
+    @Test
     public void testFunctionNamespaceURI() throws Exception {
         String sXPath = getQuery("testFunctionNamespaceURI",0);
 
@@ -214,6 +220,7 @@ public abstract class XPathFunctionTest
      *      Returns the concatenation of all its arguments string=concat(val1, val2, ..)
      *      Example: concat('The',' ','XML') Result: 'The XML'
      */
+    @Test
     public void testFunctionConcat() throws Exception {
         String sXPath=getQuery("testFunctionConcat",0);
         String sXml = "<foo><bar><price at=\"val0\">3.00</price>" +
@@ -230,6 +237,7 @@ public abstract class XPathFunctionTest
      *      string(value)
      *      Example:  string(314)    Result: '314'
      */
+    @Test
     public void testFunctionString() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price>" +
                 "<price at=\"val1\">1</price></bar><bar1>3.00</bar1></foo>";
@@ -256,6 +264,7 @@ public abstract class XPathFunctionTest
      *      number=string-length(string)
      *    Example: string-length('Beatles') Result: 7
      */
+    @Test
     public void testFunctionStringLength() throws Exception {
         String sXml = "<foo><bar>" +
                 "<price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar>" +
@@ -276,6 +285,7 @@ public abstract class XPathFunctionTest
      *      string=substring(string,start,length)
      *    Example: substring('Beatles',1,4) Result: 'Beat'
      */
+    @Test
     public void testFunctionSubString() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
@@ -294,6 +304,7 @@ public abstract class XPathFunctionTest
      *      string=substring-after(string,substr)
      *      Example: substring-after('12/10','/') Result: '10'
      */
+    @Test
     public void testFunctionSubStringAfter() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
@@ -309,6 +320,7 @@ public abstract class XPathFunctionTest
      *      string=substring-before(string,substr)
      *      Example: substring-before('12/10','/') Result: '12'
      */
+    @Test
     public void testFunctionSubStringBefore() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price>" +
                 "<price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
@@ -328,6 +340,7 @@ public abstract class XPathFunctionTest
      *                translate('12:30','03','54') Result: '12:45'
      *                translate('12:30','0123','abcd') Result: 'bc:da'
      */
+    @Test
     public void testFunctionTranslate() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
@@ -371,6 +384,7 @@ public abstract class XPathFunctionTest
      *      number=number(value)
      *      Example: number('100') Result: 100
      */
+    @Test
     public void testFunctionNumber() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.00</price></bar><bar1>3.00</bar1></foo>";
         m_xc = XmlObject.Factory.parse(sXml).newCursor();
@@ -390,6 +404,7 @@ public abstract class XPathFunctionTest
      *      integer=round(number)
      *      Example: round(3.14) Result: 3
      */
+    @Test
     public void testFunctionRound() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">3.15</price>" +
                 "<price at=\"val1\">2.87</price></bar><bar1>3.00</bar1></foo>";
@@ -411,6 +426,7 @@ public abstract class XPathFunctionTest
      *      number=sum(nodeset)
      *      Example: sum(/cd/price)
      */
+    @Test
     public void testFunctionSum() throws Exception {
         String sXml = "<foo><bar><price at=\"val0\">" +
                 "3.00</price><price at=\"val1\">2</price>" +
@@ -440,12 +456,13 @@ public abstract class XPathFunctionTest
      * a string is true if and only if its length is non-zero
      * an object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type
      */
+    @Test
     public void testFunctionBoolean() throws Exception {
         m_xc =
-                XmlObject.Factory.parse(
-                        "<foo><price at=\"val0\">3.00</price></foo>")
+            XmlObject.Factory.parse(
+                "<foo><price at=\"val0\">3.00</price></foo>")
                 .newCursor();
-        String sXPath= getQuery("testFunctionBoolean",0);
+        String sXPath = getQuery("testFunctionBoolean", 0);
         m_xc.selectPath(sXPath);
         m_xc.toNextSelection();
         assertEquals(1, m_xc.getSelectionCount());
@@ -456,12 +473,13 @@ public abstract class XPathFunctionTest
      *      Returns false false()
      *    Example: number(false()) Result: 0
      */
+    @Test
     public void testFunctionFalse() throws Exception {
         m_xc =
-                XmlObject.Factory.parse(
-                        "<foo><price at=\"val0\">3.00</price></foo>")
+            XmlObject.Factory.parse(
+                "<foo><price at=\"val0\">3.00</price></foo>")
                 .newCursor();
-          String sXPath= getQuery("testFunctionFalse",0);
+        String sXPath = getQuery("testFunctionFalse", 0);
         m_xc.selectPath(sXPath);
         assertEquals(0, m_xc.getSelectionCount());
     }
@@ -472,12 +490,13 @@ public abstract class XPathFunctionTest
      *      xsl:lang element, otherwise it returns false
      *      bool=lang(language)
      */
+    @Test
     public void testFunctionLang() throws Exception {
         m_xc =
-                XmlObject.Factory.parse(
-                        "<foo><div xml:lang=\"en\"><para/><price at=\"val0\">3.00</price></div></foo>")
+            XmlObject.Factory.parse(
+                "<foo><div xml:lang=\"en\"><para/><price at=\"val0\">3.00</price></div></foo>")
                 .newCursor();
-          String sXPath= getQuery("testFunctionLang",0);
+        String sXPath = getQuery("testFunctionLang", 0);
         m_xc.selectPath(sXPath);
         String sExpected = "<price at=\"val0\">3.00</price>";
         m_xc.toNextSelection();
@@ -506,10 +525,11 @@ public abstract class XPathFunctionTest
      *      true()
      *    Example: number(true()) Result: 1
      */
+    @Test
     public void testFunctionTrue() throws Exception {
         m_xc =
-                XmlObject.Factory.parse(
-                        "<foo><price at=\"val0\">3.00</price></foo>")
+            XmlObject.Factory.parse(
+                "<foo><price at=\"val0\">3.00</price></foo>")
                 .newCursor();
 
         String sXPath= getQuery("testFunctionTrue",0);



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