Modified: 
xmlbeans/trunk/src/test/java/xmlobject/xmlloader/detailed/XmlStreamBeanReader.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/xmlloader/detailed/XmlStreamBeanReader.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/xmlobject/xmlloader/detailed/XmlStreamBeanReader.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/xmlobject/xmlloader/detailed/XmlStreamBeanReader.java
 Sun Feb  6 01:51:55 2022
@@ -18,7 +18,7 @@ import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.openuri.bea.samples.workshop.CreditCardDataDocument;
 
 import javax.xml.stream.XMLInputFactory;
@@ -27,35 +27,36 @@ import javax.xml.stream.XMLStreamReader;
 import java.io.ByteArrayInputStream;
 import java.nio.charset.StandardCharsets;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class XmlStreamBeanReader {
 
+    private static final String creditCardXmlwPrefix =
+        " <cc:credit-card-data 
xmlns:cc=\"http://openuri.org/bea/samples/workshop\";>\n" +
+        " <cc:customer id=\"1\">\n" +
+        " <cc:card name=\"MasterCard\" number=\"15385\">\n" +
+        " <cc:available-credit>0</cc:available-credit>\n" +
+        " <cc:credit-used>0</cc:credit-used>\n" +
+        " </cc:card>\n" +
+        " <cc:card name=\"Visa\" number=\"12346\">\n" +
+        " <cc:available-credit>0</cc:available-credit>\n" +
+        " <cc:credit-used>0</cc:credit-used>\n" +
+        " </cc:card>\n" +
+        " </cc:customer>\n" +
+        " <cc:customer id=\"2\">\n" +
+        " <cc:card name=\"MasterCard\" number=\"String\">\n" +
+        " <cc:available-credit>0</cc:available-credit>\n" +
+        " <cc:credit-used>0</cc:credit-used>\n" +
+        " </cc:card>\n" +
+        " <cc:card name=\"MasterCard\" number=\"String\">\n" +
+        " <cc:available-credit>0</cc:available-credit>\n" +
+        " <cc:credit-used>0</cc:credit-used>\n" +
+        " </cc:card>\n" +
+        " </cc:customer>\n" +
+        " </cc:credit-card-data>";
 
     @Test
-    public void testXMLStreamReaderLoader() throws XMLStreamException, 
XmlException {
-        String creditCardXmlwPrefix = " <cc:credit-card-data 
xmlns:cc=\"http://openuri.org/bea/samples/workshop\";>\n" +
-            " <cc:customer id=\"1\">\n" +
-            " <cc:card name=\"MasterCard\" number=\"15385\">\n" +
-            " <cc:available-credit>0</cc:available-credit>\n" +
-            " <cc:credit-used>0</cc:credit-used>\n" +
-            " </cc:card>\n" +
-            " <cc:card name=\"Visa\" number=\"12346\">\n" +
-            " <cc:available-credit>0</cc:available-credit>\n" +
-            " <cc:credit-used>0</cc:credit-used>\n" +
-            " </cc:card>\n" +
-            " </cc:customer>\n" +
-            " <cc:customer id=\"2\">\n" +
-            " <cc:card name=\"MasterCard\" number=\"String\">\n" +
-            " <cc:available-credit>0</cc:available-credit>\n" +
-            " <cc:credit-used>0</cc:credit-used>\n" +
-            " </cc:card>\n" +
-            " <cc:card name=\"MasterCard\" number=\"String\">\n" +
-            " <cc:available-credit>0</cc:available-credit>\n" +
-            " <cc:credit-used>0</cc:credit-used>\n" +
-            " </cc:card>\n" +
-            " </cc:customer>\n" +
-            " </cc:credit-card-data>";
+    void testXMLStreamReaderLoader() throws XMLStreamException, XmlException {
 
         XMLStreamReader reader = 
XMLInputFactory.newInstance().createXMLStreamReader(new 
ByteArrayInputStream(creditCardXmlwPrefix.getBytes(StandardCharsets.UTF_8)));
         CreditCardDataDocument ccdoc = (CreditCardDataDocument) 
XmlObject.Factory.parse(reader, new 
XmlOptions().setDocumentType(CreditCardDataDocument.type));
@@ -64,7 +65,7 @@ public class XmlStreamBeanReader {
 
     // test for IllegalStateException thrown on using XmlStreamReader
     @Test
-    public void testXmlStreamReaderException() throws XMLStreamException {
+    void testXmlStreamReaderException() throws XMLStreamException {
         XmlObject xo = XmlObject.Factory.newInstance();
         try (XmlCursor xc = xo.newCursor()) {
             xc.toNextToken();

Modified: 
xmlbeans/trunk/src/test/java/xmltokensource/detailed/NewDomNodeTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmltokensource/detailed/NewDomNodeTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmltokensource/detailed/NewDomNodeTest.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmltokensource/detailed/NewDomNodeTest.java 
Sun Feb  6 01:51:55 2022
@@ -19,25 +19,23 @@ package xmltokensource.detailed;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
-import xmlcursor.common.BasicCursorTestCase;
 
 import javax.xml.namespace.QName;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static xmlcursor.common.BasicCursorTestCase.compareDocTokens;
 
 
-public class NewDomNodeTest extends BasicCursorTestCase {
-    public static final String DOC_FRAGMENT = "#document-fragment";
+public class NewDomNodeTest {
     private static final String DOC = "#document";
-    private XmlOptions m_map = new XmlOptions();
 
     @Test
-    public void testNewDomNode() throws Exception {
-        m_xo = XmlObject.Factory.parse("<foo>01234   <bar>text</bar>   chars 
</foo>");
+    void testNewDomNode() throws Exception {
+        XmlObject m_xo = XmlObject.Factory.parse("<foo>01234   <bar>text</bar> 
  chars </foo>");
         Node doc = m_xo.newDomNode();
         assertEquals(DOC, doc.getNodeName());
         NodeList nl = doc.getChildNodes();
@@ -65,16 +63,16 @@ public class NewDomNodeTest extends Basi
     }
 
     @Test
-    public void testNewDomNodeWithNamespace() throws Exception {
-        m_xo = XmlObject.Factory.parse("<foo xmlns=\"ns\">01234   
<bar>text</bar>   chars </foo>");
+    void testNewDomNodeWithNamespace() throws Exception {
+        XmlObject m_xo = XmlObject.Factory.parse("<foo xmlns=\"ns\">01234   
<bar>text</bar>   chars </foo>");
         Node doc = m_xo.newDomNode();
         assertNotNull(doc);
         assertEquals(DOC, doc.getNodeName());
     }
 
     @Test
-    public void testNewDomNodeWithOptions() throws Exception {
-        m_xo = XmlObject.Factory.parse("<foo attr=\"val\" xmlns=\"ns\">01234   
<bar>text</bar>   chars </foo>");
+    void testNewDomNodeWithOptions() throws Exception {
+        XmlObject m_xo = XmlObject.Factory.parse("<foo attr=\"val\" 
xmlns=\"ns\">01234   <bar>text</bar>   chars </foo>");
         XmlOptions map = new XmlOptions();
         map.setLoadStripComments();
         map.setLoadReplaceDocumentElement(new QName(""));
@@ -106,13 +104,14 @@ public class NewDomNodeTest extends Basi
     }
 
     @Test
-    public void testNewDomNodeRoundTrip() throws Exception {
-        m_xo = XmlObject.Factory.parse("<foo>01234   <bar>text</bar>   chars 
</foo>");
+    void testNewDomNodeRoundTrip() throws Exception {
+        XmlObject m_xo = XmlObject.Factory.parse("<foo>01234   <bar>text</bar> 
  chars </foo>");
         Node doc = m_xo.newDomNode();
         assertNotNull(doc);
         XmlObject xo = XmlObject.Factory.parse(doc);
-        m_xc = m_xo.newCursor();
-        try (XmlCursor xc1 = xo.newCursor()) {
+
+        try (XmlCursor m_xc = m_xo.newCursor();
+            XmlCursor xc1 = xo.newCursor()) {
             compareDocTokens(m_xc, xc1);
         }
     }

Modified: 
xmlbeans/trunk/src/test/java/xmltokensource/detailed/PrettyPrintNamespaceTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmltokensource/detailed/PrettyPrintNamespaceTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/xmltokensource/detailed/PrettyPrintNamespaceTest.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/xmltokensource/detailed/PrettyPrintNamespaceTest.java
 Sun Feb  6 01:51:55 2022
@@ -19,16 +19,15 @@ import com.mtest.SubInfo;
 import com.mtest.TestDocument;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 
 public class PrettyPrintNamespaceTest {
 
     @Test
-    public void testWithNewInstance()
-            throws Exception {
+    void testWithNewInstance() throws Exception {
         XmlObject x = XmlObject.Factory.newInstance();
 
         try (XmlCursor c = x.newCursor()) {
@@ -38,16 +37,14 @@ public class PrettyPrintNamespaceTest {
             c.insertNamespace("", "aaaa");
         }
 
-        String str =
-                "<a aaaa:a=\"\" xmlns=\"aaaa\" xmlns:aaaa=\"aaaa\"/>";
+        String str = "<a aaaa:a=\"\" xmlns=\"aaaa\" xmlns:aaaa=\"aaaa\"/>";
 
-        assertEquals("XmlText() Failed.", x.xmlText(), str);
-        assertEquals("toString() Failed.", x.toString().trim(), str);
+        assertEquals(x.xmlText(), str, "XmlText() Failed.");
+        assertEquals(x.toString().trim(), str, "toString() Failed.");
     }
 
     @Test
-    public void testWithInstanceFromSchema()
-            throws Exception {
+    void testWithInstanceFromSchema() throws Exception {
         String xml = "<mt:Test xmlns:mt=\"http://www.mtest.com\";> <mt:desc/> 
</mt:Test>";
         TestDocument doc = TestDocument.Factory.parse(xml);
         SubInfo subInfo = SubInfo.Factory.newInstance();
@@ -55,17 +52,19 @@ public class PrettyPrintNamespaceTest {
         subInfo.setSubdesc("there");
         doc.setTest(subInfo);
         String lnSep = System.getProperty("line.separator");
-        String str1 = "<mtes:Test xsi:type=\"mtes:SubInfo\" 
xmlns:mtes=\"http://www.mtest.com\"; 
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\";>" + lnSep +
-                "  <mtes:desc>hi</mtes:desc>" + lnSep +
-                "  <mtes:subdesc>there</mtes:subdesc>" + lnSep +
-                "</mtes:Test>";
-        String str2 = "<mtes:Test xsi:type=\"mtes:SubInfo\" 
xmlns:mtes=\"http://www.mtest.com\"; " +
-                "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\";>" +
-                "<mtes:desc>hi</mtes:desc>" +
-                "<mtes:subdesc>there</mtes:subdesc>" +
-                "</mtes:Test>";
+        String str1 =
+            "<mtes:Test xsi:type=\"mtes:SubInfo\" 
xmlns:mtes=\"http://www.mtest.com\"; 
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\";>" + lnSep +
+            "  <mtes:desc>hi</mtes:desc>" + lnSep +
+            "  <mtes:subdesc>there</mtes:subdesc>" + lnSep +
+            "</mtes:Test>";
+        String str2 =
+            "<mtes:Test xsi:type=\"mtes:SubInfo\" 
xmlns:mtes=\"http://www.mtest.com\"; " +
+            "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\";>" +
+            "<mtes:desc>hi</mtes:desc>" +
+            "<mtes:subdesc>there</mtes:subdesc>" +
+            "</mtes:Test>";
 
-        assertEquals("XmlText() Failed.", doc.xmlText(), str2);
-        assertEquals("toString() Failed.", doc.toString().trim(), str1);
+        assertEquals(doc.xmlText(), str2, "XmlText() Failed.");
+        assertEquals(doc.toString().trim(), str1, "toString() Failed.");
     }
 }

Modified: 
xmlbeans/trunk/src/test/java/xmltokensource/detailed/RoundTripLoaderTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmltokensource/detailed/RoundTripLoaderTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/xmltokensource/detailed/RoundTripLoaderTest.java 
(original)
+++ 
xmlbeans/trunk/src/test/java/xmltokensource/detailed/RoundTripLoaderTest.java 
Sun Feb  6 01:51:55 2022
@@ -19,88 +19,95 @@ package xmltokensource.detailed;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.w3c.dom.Node;
-import xmlcursor.common.BasicCursorTestCase;
 import xmlcursor.common.Common;
 
 import java.io.InputStream;
 
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static xmlcursor.common.BasicCursorTestCase.compareDocTokens;
 
 
-public class RoundTripLoaderTest extends BasicCursorTestCase {
-    public static final String DOC_FRAGMENT = "#document-fragment";
-    private XmlOptions m_map = new XmlOptions();
+public class RoundTripLoaderTest {
 
-    @Before
-    public void setUp() {
-        m_map.setCharacterEncoding("Big5");
-        m_map.setSaveNamespacesFirst();
-    }
 
     private void _newDomNodeRoundTrip(XmlOptions map) throws Exception {
-        m_xo = XmlObject.Factory.parse(Common.XML_FOO_BAR_NESTED_SIBLINGS);
+        XmlObject m_xo = 
XmlObject.Factory.parse(Common.XML_FOO_BAR_NESTED_SIBLINGS);
         Node doc = m_xo.newDomNode(map);
         assertNotNull(doc);
         XmlObject xo = XmlObject.Factory.parse(doc, map);
-        m_xc = m_xo.newCursor();
-        try (XmlCursor xc1 = xo.newCursor()) {
+
+        try (XmlCursor m_xc = m_xo.newCursor();
+            XmlCursor xc1 = xo.newCursor()) {
             compareDocTokens(m_xc, xc1);
         }
     }
 
     @Test
-    public void testNewDomNodeRoundTrip() throws Exception {
+    void testNewDomNodeRoundTrip() throws Exception {
         _newDomNodeRoundTrip(null);
     }
 
     @Test
-    public void testNewDomNodeWithOptionsRoundTrip() throws Exception {
+    void testNewDomNodeWithOptionsRoundTrip() throws Exception {
+        XmlOptions m_map = new XmlOptions();
+        m_map.setCharacterEncoding("Big5");
+        m_map.setSaveNamespacesFirst();
+
         _newDomNodeRoundTrip(m_map);
     }
 
     private void _newInputStreamRoundTrip(XmlOptions map) throws Exception {
-        m_xo = XmlObject.Factory.parse(Common.XML_FOO_BAR_NESTED_SIBLINGS);
+        XmlObject m_xo = 
XmlObject.Factory.parse(Common.XML_FOO_BAR_NESTED_SIBLINGS);
         InputStream is = m_xo.newInputStream(map);
         assertNotNull(is);
         XmlOptions options = new XmlOptions(map);
         XmlObject xo = XmlObject.Factory.parse(is, options);
-        m_xc = m_xo.newCursor();
-        try (XmlCursor xc1 = xo.newCursor()) {
+
+        try (XmlCursor m_xc = m_xo.newCursor();
+            XmlCursor xc1 = xo.newCursor()) {
             compareDocTokens(m_xc, xc1);
         }
     }
 
     @Test
-    public void testNewInputStreamRoundTrip() throws Exception {
+    void testNewInputStreamRoundTrip() throws Exception {
         _newInputStreamRoundTrip(null);
     }
 
     @Test
-    public void testNewInputStreamWithOptionsRoundTrip() throws Exception {
+    void testNewInputStreamWithOptionsRoundTrip() throws Exception {
+        XmlOptions m_map = new XmlOptions();
+        m_map.setCharacterEncoding("Big5");
+        m_map.setSaveNamespacesFirst();
+
         _newInputStreamRoundTrip(m_map);
     }
 
     private void _xmlTextRoundTrip(XmlOptions map) throws Exception {
-        m_xo = XmlObject.Factory.parse(Common.XML_FOO_BAR_NESTED_SIBLINGS);
+        XmlObject m_xo = 
XmlObject.Factory.parse(Common.XML_FOO_BAR_NESTED_SIBLINGS);
         String sXml = m_xo.xmlText(map);
         assertNotNull(sXml);
         XmlOptions options = new XmlOptions(map);
         XmlObject xo = XmlObject.Factory.parse(sXml, options);
-        m_xc = m_xo.newCursor();
-        try (XmlCursor xc1 = xo.newCursor()) {
+
+        try (XmlCursor m_xc = m_xo.newCursor();
+             XmlCursor xc1 = xo.newCursor()) {
             compareDocTokens(m_xc, xc1);
         }
     }
 
     @Test
-    public void testXmlTextRoundTrip() throws Exception {
+    void testXmlTextRoundTrip() throws Exception {
         _xmlTextRoundTrip(null);
     }
 
-    public void testXmlTextWithOptionsRoundTrip() throws Exception {
+    @Test
+    void testXmlTextWithOptionsRoundTrip() throws Exception {
+        XmlOptions m_map = new XmlOptions();
+        m_map.setCharacterEncoding("Big5");
+        m_map.setSaveNamespacesFirst();
         _xmlTextRoundTrip(m_map);
     }
 }

Modified: xmlbeans/trunk/src/test/java/xmltokensource/detailed/XmlTextTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmltokensource/detailed/XmlTextTest.java?rev=1897795&r1=1897794&r2=1897795&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmltokensource/detailed/XmlTextTest.java 
(original)
+++ xmlbeans/trunk/src/test/java/xmltokensource/detailed/XmlTextTest.java Sun 
Feb  6 01:51:55 2022
@@ -20,111 +20,114 @@ import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlCursor.TokenType;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import org.junit.Test;
-import tools.util.JarUtil;
-import xmlcursor.common.BasicCursorTestCase;
+import org.junit.jupiter.api.Test;
 import xmlcursor.common.Common;
 
 import javax.xml.namespace.QName;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static xmlcursor.common.BasicCursorTestCase.*;
 
 
-public class XmlTextTest extends BasicCursorTestCase {
-    private XmlOptions m_map = new XmlOptions();
-
+public class XmlTextTest {
     @Test
-    public void testSAVENAMESPACESFIRST() throws Exception {
-        m_xo = XmlObject.Factory.parse("<foo attr0=\"val0\" 
xmlns=\"http://www.foo.org\";>01234</foo>");
-        m_xc = m_xo.newCursor();
-        m_map.setSaveNamespacesFirst();
-        assertEquals("<foo xmlns=\"http://www.foo.org\"; 
attr0=\"val0\">01234</foo>",
-            m_xc.xmlText(m_map));
+    void testSAVENAMESPACESFIRST() throws Exception {
+        String xml = "<foo attr0=\"val0\" 
xmlns=\"http://www.foo.org\";>01234</foo>";
+        String exp = "<foo xmlns=\"http://www.foo.org\"; 
attr0=\"val0\">01234</foo>";
+        try (XmlCursor m_xc = cur(xml)) {
+            XmlOptions m_map = new XmlOptions();
+            m_map.setSaveNamespacesFirst();
+            assertEquals(exp, m_xc.xmlText(m_map));
+        }
     }
 
     @Test
-    public void testSAVENAMESPACESlast() throws Exception {
-        m_xo = XmlObject.Factory.parse("<foo attr0=\"val0\" 
xmlns=\"http://www.foo.org\";>01234</foo>");
-        m_xc = m_xo.newCursor();
-        assertEquals("<foo attr0=\"val0\" 
xmlns=\"http://www.foo.org\";>01234</foo>",
-            m_xc.xmlText(m_map));
+    void testSAVENAMESPACESlast() throws Exception {
+        String xml = "<foo attr0=\"val0\" 
xmlns=\"http://www.foo.org\";>01234</foo>";
+        String exp = "<foo attr0=\"val0\" 
xmlns=\"http://www.foo.org\";>01234</foo>";
+        try (XmlCursor m_xc = cur(xml)) {
+            assertEquals(exp, m_xc.xmlText(new XmlOptions()));
+        }
     }
 
     @Test
-    public void testSaveSyntheticDocumentElement() throws Exception {
-        m_xo = XmlObject.Factory.parse("<bar>text</bar>");
-        m_xc = m_xo.newCursor();
-        m_map.setSaveSyntheticDocumentElement(new QName("foo"));
-        assertEquals("<foo><bar>text</bar></foo>", m_xc.xmlText(m_map));
+    void testSaveSyntheticDocumentElement() throws Exception {
+        try (XmlCursor m_xc = cur("<bar>text</bar>")) {
+            XmlOptions m_map = new XmlOptions();
+            m_map.setSaveSyntheticDocumentElement(new QName("foo"));
+            assertEquals("<foo><bar>text</bar></foo>", m_xc.xmlText(m_map));
+        }
     }
 
     @Test
-    public void testSavePrettyPrint() throws Exception {
-        m_xo = XmlObject.Factory.parse("<a><b><c> text </c></b></a>");
-        m_xc = m_xo.newCursor();
-        m_map.setSavePrettyPrint();
-        String lnSep = System.getProperty("line.separator");
-        assertEquals("<a>" + lnSep + "  <b>" + lnSep + "    <c> text </c>" + 
lnSep + "  </b>" + lnSep + "</a>", m_xc.xmlText(m_map));
+    void testSavePrettyPrint() throws Exception {
+        try (XmlCursor m_xc = cur("<a><b><c> text </c></b></a>")) {
+            XmlOptions m_map = new XmlOptions();
+            m_map.setSavePrettyPrint();
+            String lnSep = System.getProperty("line.separator");
+            assertEquals("<a>" + lnSep + "  <b>" + lnSep + "    <c> text </c>" 
+ lnSep + "  </b>" + lnSep + "</a>", m_xc.xmlText(m_map));
+        }
     }
 
     @Test
-    public void testSavePrettyPrintIndent3() throws Exception {
-        m_xo = XmlObject.Factory.parse("<a><b><c> text </c></b></a>");
-        m_xc = m_xo.newCursor();
-        m_map.setSavePrettyPrint();
-        m_map.setSavePrettyPrintIndent(3);
-        String lnSep = System.getProperty("line.separator");
-        assertEquals("<a>" + lnSep + "   <b>" + lnSep + "      <c> text </c>" 
+ lnSep + "   </b>" + lnSep + "</a>", m_xc.xmlText(m_map));
+    void testSavePrettyPrintIndent3() throws Exception {
+        try (XmlCursor m_xc = cur("<a><b><c> text </c></b></a>")) {
+            XmlOptions m_map = new XmlOptions();
+            m_map.setSavePrettyPrint();
+            m_map.setSavePrettyPrintIndent(3);
+            String lnSep = System.getProperty("line.separator");
+            assertEquals("<a>" + lnSep + "   <b>" + lnSep + "      <c> text 
</c>" + lnSep + "   </b>" + lnSep + "</a>", m_xc.xmlText(m_map));
+        }
     }
 
     @Test
-    public void testSavePrettyPrintIndentNeg1() throws Exception {
-        m_xc = XmlObject.Factory.parse("<a>  \n  <b>  \n    <c> text   </c>   
\n  </b>  \n  </a>").newCursor();
-        m_map.setSavePrettyPrint();
-        m_map.setSavePrettyPrintIndent(-1);
-        assertEquals("<a><b><c> text   </c></b></a>", m_xc.xmlText(m_map));
+    void testSavePrettyPrintIndentNeg1() throws Exception {
+        try (XmlCursor m_xc = cur("<a>  \n  <b>  \n    <c> text   </c>   \n  
</b>  \n  </a>")) {
+            XmlOptions m_map = new XmlOptions();
+            m_map.setSavePrettyPrint();
+            m_map.setSavePrettyPrintIndent(-1);
+            assertEquals("<a><b><c> text   </c></b></a>", m_xc.xmlText(m_map));
+        }
     }
 
     @Test
-    public void testDefaultNamespace() throws Exception {
-        m_xo = XmlObject.Factory.parse(
-            JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
-        m_xc = m_xo.newCursor();
-        m_xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT + "$this//FleetID");
-        m_xc.toNextSelection();
-        m_map.setSaveNamespacesFirst();
-        assertEquals("<FleetID xmlns=\"" + Common.CLM_NS + "\" " +
-                     Common.CLM_XSI_NS +
-                     ">FLEETNAME</FleetID>",
-            m_xc.xmlText(m_map));
+    void testDefaultNamespace() throws Exception {
+        try (XmlCursor m_xc = jcur(Common.TRANXML_FILE_CLM)) {
+            m_xc.selectPath(Common.CLM_NS_XQUERY_DEFAULT + "$this//FleetID");
+            m_xc.toNextSelection();
+            XmlOptions m_map = new XmlOptions();
+            m_map.setSaveNamespacesFirst();
+            String exp = "<FleetID xmlns=\"" + Common.CLM_NS + "\" " + 
Common.CLM_XSI_NS + ">FLEETNAME</FleetID>";
+            assertEquals(exp, m_xc.xmlText(m_map));
+        }
     }
 
     @Test
-    public void testSTARTDOCvsFirstChild() throws Exception {
-        m_xo = XmlObject.Factory.parse(
-            JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
-        m_xc = m_xo.newCursor();
-        try (XmlCursor xc1 = m_xo.newCursor()) {
+    void testSTARTDOCvsFirstChild() throws Exception {
+        XmlObject m_xo = jobj(Common.TRANXML_FILE_CLM);
+
+        try (XmlCursor m_xc = m_xo.newCursor();
+            XmlCursor xc1 = m_xo.newCursor()) {
             xc1.toFirstChild();
             assertEquals(m_xc.xmlText().replaceFirst("(?s)<!--.*-->", ""), 
xc1.xmlText());
         }
     }
 
     @Test
-    public void testXmlTextFromTEXT() throws Exception {
-        m_xo = XmlObject.Factory.parse(Common.XML_FOO_1ATTR_TEXT);
-        m_xc = m_xo.newCursor();
-        toNextTokenOfType(m_xc, TokenType.TEXT);
-        assertEquals("text", m_xc.getChars());
+    void testXmlTextFromTEXT() throws Exception {
+        try (XmlCursor m_xc = cur(Common.XML_FOO_1ATTR_TEXT)) {
+            toNextTokenOfType(m_xc, TokenType.TEXT);
+            assertEquals("text", m_xc.getChars());
+        }
     }
 
     @Test
-    public void testXmlTextFromTEXTafterEND() throws Exception {
-        m_xo = XmlObject.Factory.parse("<foo><bar> text </bar> ws \\r\\n 
</foo>");
-        m_xc = m_xo.newCursor();
-        toNextTokenOfType(m_xc, TokenType.TEXT);
-        toNextTokenOfType(m_xc, TokenType.TEXT);
-        assertEquals(" ws \\r\\n ", m_xc.getChars());
+    void testXmlTextFromTEXTafterEND() throws Exception {
+        try (XmlCursor m_xc = cur("<foo><bar> text </bar> ws \\r\\n </foo>")) {
+            toNextTokenOfType(m_xc, TokenType.TEXT);
+            toNextTokenOfType(m_xc, TokenType.TEXT);
+            assertEquals(" ws \\r\\n ", m_xc.getChars());
+        }
     }
 }
 



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

Reply via email to