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 [19/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/detailed/ObjectCursorInteractionTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/ObjectCursorInteractionTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/ObjectCursorInteractionTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/ObjectCursorInteractionTest.java Fri Jan 18 23:08:44 2019
@@ -14,46 +14,29 @@
*/
-package xmlcursor.detailed;
+package xmlcursor.detailed;
-import junit.framework.*;
-
-import xmlcursor.common.Common;
-import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlCursor;
-
-import test.xbean.xmlcursor.location.LocationDocument.Location;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Test;
import test.xbean.xmlcursor.location.LocationDocument;
+import test.xbean.xmlcursor.location.LocationDocument.Location;
+import xmlcursor.common.Common;
+import static org.junit.Assert.*;
-/**
- *
- *
- */
-public class ObjectCursorInteractionTest extends TestCase {
- public ObjectCursorInteractionTest(String sName) {
- super(sName);
- }
-
- public static Test suite() {
- return new TestSuite(ObjectCursorInteractionTest.class);
- }
-
- public void testClassPath() throws Exception {
- String sClassPath = System.getProperty("java.class.path");
- int i = sClassPath.indexOf(Common.XMLCURSOR_JAR);
- assertTrue(i >= 0);
- }
+public class ObjectCursorInteractionTest {
+ @Test
public void testObjectNullEffectOnCursor() throws Exception {
String sNamespace = "";
String sXml =
- "<loc:Location xmlns:loc=\"http://xbean.test/xmlcursor/Location\""
- + sNamespace +
- "><loc:CityName>DALLAS</loc:CityName><StateCode>TX</StateCode>" +
- "</loc:Location>";
+ "<loc:Location xmlns:loc=\"http://xbean.test/xmlcursor/Location\""
+ + sNamespace +
+ "><loc:CityName>DALLAS</loc:CityName><StateCode>TX</StateCode>" +
+ "</loc:Location>";
- // LocationDocument locDoc = (LocationDocument) XmlObject.Factory.parse(sXml);
+ // LocationDocument locDoc = (LocationDocument) XmlObject.Factory.parse(sXml);
LocationDocument locDoc = LocationDocument.Factory.parse(sXml);
Location loc = locDoc.getLocation();
XmlCursor xc0 = loc.newCursor();
@@ -64,21 +47,19 @@ public class ObjectCursorInteractionTest
Thread.sleep(1000);
xc0.toFirstChild();
assertEquals("DALLAS", xc0.getTextValue());
- }
- catch (InterruptedException e) {
- }
- finally {
+ } finally {
xc0.dispose();
}
}
+ @Test
public void testCursorDisposalEffectOnObject() throws Exception {
String sNamespace = "xmlns:loc=\"http://xbean.test/xmlcursor/Location\"";
String sXml = "<loc:Location " + sNamespace + ">" +
- "<loc:CityName>DALLAS</loc:CityName><loc:StateCode>TX</loc:StateCode></loc:Location>";
+ "<loc:CityName>DALLAS</loc:CityName><loc:StateCode>TX</loc:StateCode></loc:Location>";
LocationDocument locDoc = LocationDocument.Factory.parse(
- sXml);
- assertEquals(true, locDoc.validate());
+ sXml);
+ assertTrue(locDoc.validate());
Location loc0 = locDoc.getLocation();
Location loc1 = locDoc.getLocation();
XmlCursor xc0 = loc0.newCursor();
@@ -95,42 +76,42 @@ public class ObjectCursorInteractionTest
xc1.setTextValue("HOUSTON");
xc1.dispose();
assertEquals("HOUSTON", loc0.getCityName());
- }
- finally {
+ } finally {
xc0.dispose();
xc1.dispose();
}
}
+ @Test
public void testObjectRefAssignmentEffectOnCursor() throws Exception {
String sXml0 =
- "<loc:Location xmlns:loc=\"http://xbean.test/xmlcursor/Location\">" +
- "<loc:CityName>DALLAS</loc:CityName>" +
- "<loc:StateCode>TX</loc:StateCode>" +
- "</loc:Location>";
+ "<loc:Location xmlns:loc=\"http://xbean.test/xmlcursor/Location\">" +
+ "<loc:CityName>DALLAS</loc:CityName>" +
+ "<loc:StateCode>TX</loc:StateCode>" +
+ "</loc:Location>";
String sXml1 =
- "<loc:Location xmlns:loc=\"http://xbean.test/xmlcursor/Location\">" +
- "<loc:PostalCode>90210</loc:PostalCode>" +
- "<loc:CountryCode>US</loc:CountryCode>" +
- "</loc:Location>";
+ "<loc:Location xmlns:loc=\"http://xbean.test/xmlcursor/Location\">" +
+ "<loc:PostalCode>90210</loc:PostalCode>" +
+ "<loc:CountryCode>US</loc:CountryCode>" +
+ "</loc:Location>";
LocationDocument locDoc0 = LocationDocument.Factory.parse(
- sXml0);
+ sXml0);
Location loc0 = locDoc0.getLocation();
XmlCursor xc0 = loc0.newCursor();
LocationDocument locDoc1 = (LocationDocument) XmlObject.Factory.parse(
- sXml1);
+ sXml1);
Location loc1 = locDoc1.getLocation();
assertEquals("DALLAS", loc0.getCityName());
assertEquals("TX", loc0.getStateCode());
- assertEquals(null, loc0.getPostalCode());
- assertEquals(null, loc0.getCountryCode());
+ assertNull(loc0.getPostalCode());
+ assertNull(loc0.getCountryCode());
loc0 = loc1;
- assertEquals(null, loc0.getCityName());
- assertEquals(null, loc0.getStateCode());
+ assertNull(loc0.getCityName());
+ assertNull(loc0.getStateCode());
assertEquals("90210", loc0.getPostalCode());
assertEquals("US", loc0.getCountryCode());
@@ -138,55 +119,54 @@ public class ObjectCursorInteractionTest
assertEquals(sXml0, xc0.xmlText());
xc0 = loc0.newCursor();
assertEquals(sXml1, xc0.xmlText());
- }
- finally {
+ } finally {
xc0.dispose();
}
}
+ @Test
public void testCursorRefAssignmentEffectOnObject() throws Exception {
String sXml0 =
- "<loc:Location xmlns:loc=\"http://xbean.test/xmlcursor/Location\">" +
- "<loc:CityName>DALLAS</loc:CityName>" +
- "<loc:StateCode>TX</loc:StateCode>" +
- "</loc:Location>";
+ "<loc:Location xmlns:loc=\"http://xbean.test/xmlcursor/Location\">" +
+ "<loc:CityName>DALLAS</loc:CityName>" +
+ "<loc:StateCode>TX</loc:StateCode>" +
+ "</loc:Location>";
LocationDocument locDoc0 = LocationDocument.Factory.parse(
- sXml0);
+ sXml0);
Location loc0 = locDoc0.getLocation();
XmlCursor xc0 = loc0.newCursor();
String sXml1 =
- "<loc:Location xmlns:loc=\"http://xbean.test/xmlcursor/Location\">" +
- "<loc:PostalCode>90210</loc:PostalCode>" +
- "<loc:CountryCode>US</loc:CountryCode>" +
- "</loc:Location>";
+ "<loc:Location xmlns:loc=\"http://xbean.test/xmlcursor/Location\">" +
+ "<loc:PostalCode>90210</loc:PostalCode>" +
+ "<loc:CountryCode>US</loc:CountryCode>" +
+ "</loc:Location>";
LocationDocument locDoc1 = LocationDocument.Factory.parse(
- sXml1);
+ sXml1);
Location loc1 = locDoc1.getLocation();
XmlCursor xc1 = loc1.newCursor();
try {
assertEquals("DALLAS", loc0.getCityName());
assertEquals("TX", loc0.getStateCode());
- assertEquals(null, loc0.getPostalCode());
- assertEquals(null, loc0.getCountryCode());
+ assertNull(loc0.getPostalCode());
+ assertNull(loc0.getCountryCode());
xc0 = xc1;
assertEquals("DALLAS", loc0.getCityName());
assertEquals("TX", loc0.getStateCode());
- assertEquals(null, loc0.getPostalCode());
- assertEquals(null, loc0.getCountryCode());
+ assertNull(loc0.getPostalCode());
+ assertNull(loc0.getCountryCode());
loc0 = (Location) xc0.getObject();
- assertEquals(null, loc0.getCityName());
- assertEquals(null, loc0.getStateCode());
+ assertNull(loc0.getCityName());
+ assertNull(loc0.getStateCode());
assertEquals("90210", loc0.getPostalCode());
assertEquals("US", loc0.getCountryCode());
- }
- finally {
+ } finally {
xc0.dispose();
xc1.dispose();
}
Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/PrefixForNamespaceTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/PrefixForNamespaceTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/PrefixForNamespaceTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/PrefixForNamespaceTest.java Fri Jan 18 23:08:44 2019
@@ -18,27 +18,16 @@ package xmlcursor.detailed;
import org.apache.xmlbeans.XmlCursor.TokenType;
import org.apache.xmlbeans.XmlObject;
+import org.junit.Test;
import tools.util.JarUtil;
import xmlcursor.common.BasicCursorTestCase;
import xmlcursor.common.Common;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertEquals;
-/**
- *
- *
- */
-public class PrefixForNamespaceTest extends BasicCursorTestCase {
-
- public PrefixForNamespaceTest(String sName) {
- super(sName);
- }
-
- public static Test suite() {
- return new TestSuite(PrefixForNamespaceTest.class);
- }
+public class PrefixForNamespaceTest extends BasicCursorTestCase {
+ @Test
public void testprefixForNamespaceFromSTARTDOC() throws Exception {
m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\">text</foo>");
m_xc = m_xo.newCursor();
@@ -53,6 +42,7 @@ public class PrefixForNamespaceTest exte
assertEquals("pre3", m_xc.prefixForNamespace("uri3"));
}
+ @Test
public void testprefixForNamespaceFromSTARTDOCInvalid() throws Exception {
m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\">text</foo>");
m_xc = m_xo.newCursor();
@@ -65,26 +55,21 @@ public class PrefixForNamespaceTest exte
assertEquals("uri4", m_xc.prefixForNamespace("uri4"));
}
+ @Test(expected = IllegalArgumentException.class)
public void testprefixForNamespaceFromSTARTDOCNull() throws Exception {
m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\">text</foo>");
m_xc = m_xo.newCursor();
- try {
- m_xc.prefixForNamespace(null);
- fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- }
+ m_xc.prefixForNamespace(null);
}
+ @Test(expected = IllegalArgumentException.class)
public void testprefixForNamespaceFromSTARTDOCEmptyString() throws Exception {
m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\">text</foo>");
m_xc = m_xo.newCursor();
- try {
- m_xc.prefixForNamespace("");
- fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- }
+ m_xc.prefixForNamespace("");
}
+ @Test
public void testprefixForNamespaceFromSTART() throws Exception {
m_xo = XmlObject.Factory.parse(
JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
@@ -94,6 +79,7 @@ public class PrefixForNamespaceTest exte
m_xc.prefixForNamespace("http://www.w3.org/2000/10/XMLSchema-instance"));
}
+ @Test
public void testprefixForNamespaceFromSTARTdefaultNamespace() throws Exception {
m_xo = XmlObject.Factory.parse(
JarUtil.getResourceFromJar(Common.TRANXML_FILE_CLM));
@@ -103,6 +89,7 @@ public class PrefixForNamespaceTest exte
m_xc.prefixForNamespace("http://www.tranxml.org/TranXML/Version4.0"));
}
+ @Test
public void testprefixForNamespaceFromATTR() throws Exception {
m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\"><bar attr0=\"val0\">text</bar></foo>");
m_xc = m_xo.newCursor();
@@ -112,12 +99,13 @@ public class PrefixForNamespaceTest exte
m_xc.insertNamespace("pre3", "uri3");
m_xc.insertNamespace(null, "uridefault");
m_xc.toStartDoc();
- m_xc.selectPath("default element namespace=\"nsa\"" + "$this//bar");
+ m_xc.selectPath("declare default element namespace \"nsa\";" + "$this//bar");
m_xc.toFirstAttribute();
assertEquals("nsa", m_xc.prefixForNamespace("nsa"));
assertEquals("pre1", m_xc.prefixForNamespace("uri1"));
}
+ @Test
public void testprefixForNamespaceFromEND() throws Exception {
m_xo = XmlObject.Factory.parse("<foo xmlns=\"nsa\"><bar attr0=\"val0\">text</bar></foo>");
m_xc = m_xo.newCursor();
@@ -131,7 +119,5 @@ public class PrefixForNamespaceTest exte
assertEquals("", m_xc.prefixForNamespace("nsa"));
// assertEquals("pre1", m_xc.prefixForNamespace("uri1"));
}
-
-
}
Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/PushPopTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/PushPopTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/PushPopTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/PushPopTest.java Fri Jan 18 23:08:44 2019
@@ -17,45 +17,37 @@
package xmlcursor.detailed;
-import junit.framework.*;
-
import org.apache.xmlbeans.XmlObject;
+import org.junit.Before;
+import org.junit.Test;
+import xmlcursor.common.BasicCursorTestCase;
-import xmlcursor.common.*;
-
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
-/**
- *
- *
- */
public class PushPopTest extends BasicCursorTestCase {
- String sDoc="<foo xmlns:edi='http://ecommerce.org/schema'><?xml-stylesheet type=\"text/xsl\" xmlns=\"http://openuri.org/shipping/\"?><!-- the 'price' element's namespace is http://ecommerce.org/schema --> <edi:price units='Euro' date='12-12-03'>32.18</edi:price> </foo>";
-
- public PushPopTest(String sName) {
- super(sName);
- }
-
- public static Test suite() {
- return new TestSuite(PushPopTest.class);
- }
+ private String sDoc = "<foo xmlns:edi='http://ecommerce.org/schema'><?xml-stylesheet type=\"text/xsl\" xmlns=\"http://openuri.org/shipping/\"?><!-- the 'price' element's namespace is http://ecommerce.org/schema --> <edi:price units='Euro' date='12-12-03'>32.18</edi:price> </foo>";
- public void testPopEmpty(){
- assertEquals(false,m_xc.pop());
+ @Test
+ public void testPopEmpty() {
+ assertFalse(m_xc.pop());
}
- public void testPushNTimes(){
- int nCount=100;
- for (int i=0;i<nCount;i++)
- m_xc.push();
- boolean result=true;
- for (int i=0;i<nCount;i++)
- result&=m_xc.pop();
- assertEquals(true,result);
- assertEquals(false,m_xc.pop());
+ @Test
+ public void testPushNTimes() {
+ int nCount = 100;
+ for (int i = 0; i < nCount; i++)
+ m_xc.push();
+ boolean result = true;
+ for (int i = 0; i < nCount; i++)
+ result &= m_xc.pop();
+ assertTrue(result);
+ assertFalse(m_xc.pop());
}
- public void setUp() throws Exception{
- m_xc=XmlObject.Factory.parse(sDoc).newCursor();
+ @Before
+ public void setUp() throws Exception {
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
}
}
Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/SelectionsTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/SelectionsTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/SelectionsTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/SelectionsTest.java Fri Jan 18 23:08:44 2019
@@ -16,137 +16,118 @@
package xmlcursor.detailed;
-import junit.framework.*;
-import junit.framework.Assert.*;
-
-import java.io.*;
-
-import org.apache.xmlbeans.XmlCursor.TokenType;
-import org.apache.xmlbeans.*;
-import org.apache.xmlbeans.XmlCursor.XmlBookmark;
-
-import javax.xml.namespace.QName;
-
-import xmlcursor.common.*;
-
-import java.net.URL;
-
-import test.xbean.xmlcursor.cr196679.TestType;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Before;
+import org.junit.Test;
import test.xbean.xmlcursor.cr196679.TestDocument;
+import test.xbean.xmlcursor.cr196679.TestType;
+import xmlcursor.common.BasicCursorTestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
-/**
- *
- *
- */
public class SelectionsTest extends BasicCursorTestCase {
- static final String sXml="<foo><b>0</b><b>1</b><b>2</b><b attr=\"a3\">3</b><b>4</b><b>5</b><b>6</b></foo>";
-
- public SelectionsTest(String sName) {
- super(sName);
- }
-
- public static Test suite() {
- return new TestSuite(SelectionsTest.class);
- }
+ private static final String sXml="<foo><b>0</b><b>1</b><b>2</b><b attr=\"a3\">3</b><b>4</b><b>5</b><b>6</b></foo>";
//average case test
- public void testNormalCase()throws Exception{
- XmlCursor m_xc1=m_xo.newCursor();
- int nSelectionsCount=7;
- m_xc.selectPath("$this//a");
- assertEquals(false, m_xc.hasNextSelection());
- assertEquals(false, m_xc.toNextSelection());
- assertEquals(0, m_xc.getSelectionCount());
-
- m_xc.selectPath("$this//b");
- m_xc1.toFirstChild();
- m_xc1.toFirstChild();
- do{
- m_xc1.addToSelection();
- }while(m_xc1.toNextSibling());
- assertEquals(nSelectionsCount, m_xc.getSelectionCount());
- int i=0;
- while(m_xc.hasNextSelection()){
- m_xc.toNextSelection();
- assertEquals("" + i, m_xc.getTextValue());
- i++;
- }
- int j=0;
- while(m_xc1.hasNextSelection()){
- m_xc1.toSelection(j);
- assertEquals("" + j, m_xc1.getTextValue());
- j++;
- }
- assertEquals(nSelectionsCount,j);
- assertEquals(nSelectionsCount,i);
- }
-
- public void testToSelectionIllegalIndex(){
- m_xc.selectPath("$this//b");
- int i=0;
- boolean result=false;
- result=m_xc.toSelection(-1);
- assertEquals(result,false);
-
- try{
- result=m_xc.toSelection(m_xc.getSelectionCount()+1);
- if (result)
- fail(" Index > num selections");
- }catch(IllegalStateException e){}
-
- if (result && (i>0)) fail(" Index <0 ");
-
- }
-
- public void testClearSelections(){
-
- int nSelectionsCount=7;
- m_xc.selectPath("$this//b");
- m_xc.toSelection(0);
- m_xc.clearSelections();
- assertEquals("<b>0</b>",m_xc.xmlText());
-
- }
-
- public void testCR196679() throws Exception
- {
- TestDocument testDoc = null;
- String input="<ns:test xmlns:ns=\"http://xbean.test/xmlcursor/CR196679\">\n" +
- " <ns:name>myTest</ns:name>" +
- " <ns:value>5</ns:value>" +
- " </ns:test>";
- testDoc = TestDocument.Factory.parse(input);
- TestType test = testDoc.getTest();
-
- String queryName =
- "declare namespace ns='http://xbean.test/xmlcursor/CR196679'" +
- "$this/ns:name";
-
- String queryValue =
- "declare namespace ns='http://xbean.test/xmlcursor/CR196679'" +
- "$this/ns:value";
-
- XmlCursor cursor = test.newCursor();
- cursor.push();
- cursor.selectPath(queryName);
- cursor.toNextSelection();
-
- assertEquals("myTest",cursor.getTextValue());
-
- cursor.pop();
- cursor.selectPath(queryValue);
- cursor.toNextSelection();
-
- assertEquals("5",cursor.getTextValue());//expected output is value=5
-
- cursor.dispose();
-
- }
- public void setUp()throws Exception{
- m_xo=XmlObject.Factory.parse(sXml);
- m_xc= m_xo.newCursor();
- }
+ @Test
+ public void testNormalCase() throws Exception {
+ XmlCursor m_xc1 = m_xo.newCursor();
+ int nSelectionsCount = 7;
+ m_xc.selectPath("$this//a");
+ assertFalse(m_xc.hasNextSelection());
+ assertFalse(m_xc.toNextSelection());
+ assertEquals(0, m_xc.getSelectionCount());
+
+ m_xc.selectPath("$this//b");
+ m_xc1.toFirstChild();
+ m_xc1.toFirstChild();
+ do {
+ m_xc1.addToSelection();
+ } while (m_xc1.toNextSibling());
+ assertEquals(nSelectionsCount, m_xc.getSelectionCount());
+ int i = 0;
+ while (m_xc.hasNextSelection()) {
+ m_xc.toNextSelection();
+ assertEquals("" + i, m_xc.getTextValue());
+ i++;
+ }
+ int j = 0;
+ while (m_xc1.hasNextSelection()) {
+ m_xc1.toSelection(j);
+ assertEquals("" + j, m_xc1.getTextValue());
+ j++;
+ }
+ assertEquals(nSelectionsCount, j);
+ assertEquals(nSelectionsCount, i);
+ }
+
+ @Test
+ public void testToSelectionIllegalIndex() {
+ m_xc.selectPath("$this//b");
+ boolean result = m_xc.toSelection(-1);
+ assertFalse(result);
+
+ try {
+ result = m_xc.toSelection(m_xc.getSelectionCount() + 1);
+ assertFalse("Index > num selections", result);
+ } catch (IllegalStateException e) {
+ }
+
+ assertFalse("Index < 0 ", result);
+
+ }
+
+ @Test
+ public void testClearSelections() {
+ m_xc.selectPath("$this//b");
+ m_xc.toSelection(0);
+ m_xc.clearSelections();
+ assertEquals("<b>0</b>", m_xc.xmlText());
+
+ }
+
+ @Test
+ public void testCR196679() throws Exception {
+ TestDocument testDoc = null;
+ String input = "<ns:test xmlns:ns=\"http://xbean.test/xmlcursor/CR196679\">\n" +
+ " <ns:name>myTest</ns:name>" +
+ " <ns:value>5</ns:value>" +
+ " </ns:test>";
+ testDoc = TestDocument.Factory.parse(input);
+ TestType test = testDoc.getTest();
+
+ String queryName =
+ "declare namespace ns='http://xbean.test/xmlcursor/CR196679'" +
+ "$this/ns:name";
+
+ String queryValue =
+ "declare namespace ns='http://xbean.test/xmlcursor/CR196679'" +
+ "$this/ns:value";
+
+ XmlCursor cursor = test.newCursor();
+ cursor.push();
+ cursor.selectPath(queryName);
+ cursor.toNextSelection();
+
+ assertEquals("myTest", cursor.getTextValue());
+
+ cursor.pop();
+ cursor.selectPath(queryValue);
+ cursor.toNextSelection();
+
+ assertEquals("5", cursor.getTextValue());//expected output is value=5
+
+ cursor.dispose();
+
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ m_xo = XmlObject.Factory.parse(sXml);
+ m_xc = m_xo.newCursor();
+ }
}
Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/SetTextValueTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/SetTextValueTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/SetTextValueTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/SetTextValueTest.java Fri Jan 18 23:08:44 2019
@@ -15,33 +15,26 @@
package xmlcursor.detailed;
-import junit.framework.*;
-
-import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlCursor.TokenType;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Before;
+import org.junit.Test;
import xmlcursor.common.BasicCursorTestCase;
import xmlcursor.common.Common;
+import static org.junit.Assert.*;
+
/**
*
*
*/
public class SetTextValueTest extends BasicCursorTestCase {
- String sDoc = Common.XML_FOO_NS_PREFIX;
-
- public SetTextValueTest(String sName) {
- super(sName);
- }
-
- public static Test suite() {
- return new TestSuite(SetTextValueTest.class);
- }
-
/**
* Depth first concatenation of all text leaves
*/
+ @Test
public void testSTARTDOC() {
String sExpected = Common.XMLFRAG_BEGINTAG + "<newdoc/>" +
Common.XMLFRAG_ENDTAG;
@@ -51,6 +44,7 @@ public class SetTextValueTest extends Ba
assertEquals(sExpected, m_xc.xmlText());
}
+ @Test
public void testSTART() {
String sNewVal = "new test value ";
String sExpected = "<foo xmlns:edi=\"http://ecommerce.org/schema\">" +
@@ -63,6 +57,7 @@ public class SetTextValueTest extends Ba
assertEquals(sExpected, m_xc.xmlText());
}
+ @Test
public void testAttr() {
String sNewVal = "US\u0024 ";
String sExpected = "<foo xmlns:edi=\"http://ecommerce.org/schema\"><!-- the 'price' element's namespace is http://ecommerce.org/schema --> <edi:price units=\"" +
@@ -75,6 +70,7 @@ public class SetTextValueTest extends Ba
assertEquals(sExpected, m_xc.xmlText());
}
+ @Test
public void testComment() {
String sNewVal = "My new comment ";
String sExpected = "<foo xmlns:edi=\"http://ecommerce.org/schema\"><!--" +
@@ -87,6 +83,7 @@ public class SetTextValueTest extends Ba
assertEquals(sExpected, m_xc.xmlText());
}
+ @Test
public void testPI() throws Exception {
String sTestXml = "<?xml-stylesheet type=\"text/xsl\" xmlns=\"http://openuri.org/shipping/\"?><foo at0=\"value0\">text</foo>";
m_xc = XmlObject.Factory.parse(sTestXml).newCursor();
@@ -100,6 +97,7 @@ public class SetTextValueTest extends Ba
assertEquals(sExpected, m_xc.xmlText());
}
+ @Test
public void testSetNull() {
toNextTokenOfType(m_xc, TokenType.START);
try {
@@ -110,18 +108,15 @@ public class SetTextValueTest extends Ba
}
}
+ @Test(expected = IndexOutOfBoundsException.class)
public void testNegativeOffset() {
char[] buffer = new char[100];
toNextTokenOfType(m_xc, TokenType.START);
- try {
- m_xc.setTextValue(buffer, -1, 98);
- fail("Offset < 0");
- }
- catch (IndexOutOfBoundsException ie) {
- }
+ m_xc.setTextValue(buffer, -1, 98);
}
+ @Test
public void testNonZeroOffset() {
char[] buffer = "Test".toCharArray();
toNextTokenOfType(m_xc, TokenType.START);
@@ -132,30 +127,24 @@ public class SetTextValueTest extends Ba
}
+ @Test(expected = IndexOutOfBoundsException.class)
public void testLargeOffset() {
String sNewVal = " 20";
toNextTokenOfType(m_xc, TokenType.START);
- try {
- m_xc.setTextValue(sNewVal.toCharArray(), 5, 3);
- fail("Offset Past end");
- }
- catch (IndexOutOfBoundsException ie) {
- }
+ m_xc.setTextValue(sNewVal.toCharArray(), 5, 3);
}
//charCount<=0: should be a noop
+ @Test(expected = IndexOutOfBoundsException.class)
public void testNegativeCharCount() {
char[] buffer = new char[100];
toNextTokenOfType(m_xc, TokenType.START);
String sExpected = m_xc.xmlText();
- try {
- m_xc.setTextValue(buffer, 10, -1);
- if (!m_xc.equals(sExpected)) fail("Negative Char Cnt");
- }
- catch (IndexOutOfBoundsException ie) {
- }
+ m_xc.setTextValue(buffer, 10, -1);
+ if (!m_xc.equals(sExpected)) fail("Negative Char Cnt");
}
+ @Test
public void testZeroCharCount() {
char[] buffer = new char[100];
String sExpected = "<foo xmlns:edi=\"http://ecommerce.org/schema\"/>";
@@ -168,10 +157,11 @@ public class SetTextValueTest extends Ba
assertEquals(sExpected, m_xc.xmlText());
}
+ @Test
public void testLargeCharCount() {
String sNewVal = " 20";
int nCharCount = 10;
- assertEquals(true, sNewVal.length() < nCharCount);
+ assertTrue(sNewVal.length() < nCharCount);
toNextTokenOfType(m_xc, TokenType.START);
m_xc.setTextValue(sNewVal.toCharArray(), 0, nCharCount);
// toPrevTokenOfType(m_xc, TokenType.START);
@@ -179,6 +169,7 @@ public class SetTextValueTest extends Ba
}
//offset+selection>buffer
+ @Test
public void testSelectionPastEnd() {
String sNewVal = " 20";
toNextTokenOfType(m_xc, TokenType.START);
@@ -188,20 +179,16 @@ public class SetTextValueTest extends Ba
}
//spec doesn't say anything about text???
+ @Test(expected = IllegalStateException.class)
public void testText() {
String sNewVal = "5000 ";
char[] buff = sNewVal.toCharArray();
toNextTokenOfType(m_xc, TokenType.TEXT);
- try {
- m_xc.setTextValue(buff, 0, buff.length);
- fail("SetText in TEXT token");
- }
- catch (IllegalStateException e) {
- }
-
+ m_xc.setTextValue(buff, 0, buff.length);
}
//$NOTE:did I forget a type
+ @Test
public void testSetIllegalCursorPos() {
char[] buffer = new char[100];
@@ -225,7 +212,9 @@ public class SetTextValueTest extends Ba
fail("SetText in END token");
}
+ @Before
public void setUp() throws Exception {
+ String sDoc = Common.XML_FOO_NS_PREFIX;
m_xc = XmlObject.Factory.parse(sDoc).newCursor();
}
}
Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/ToBookmarkTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/ToBookmarkTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/ToBookmarkTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/ToBookmarkTest.java Fri Jan 18 23:08:44 2019
@@ -16,43 +16,24 @@
package xmlcursor.detailed;
-import org.apache.xmlbeans.XmlOptions;
-import junit.framework.*;
-import junit.framework.Assert.*;
-
-import java.io.*;
-
-import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlCursor.TokenType;
-import org.apache.xmlbeans.XmlDocumentProperties;
-import org.apache.xmlbeans.XmlCursor.XmlBookmark;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Test;
+import tools.util.JarUtil;
+import xmlcursor.common.BasicCursorTestCase;
+import xmlcursor.common.Common;
import javax.xml.namespace.QName;
-import xmlcursor.common.*;
-import tools.util.JarUtil;
-
-import java.net.URL;
+import static org.junit.Assert.*;
-/**
- *
- *
- */
public class ToBookmarkTest extends BasicCursorTestCase {
private SimpleBookmark _theBookmark = new SimpleBookmark("value");
private SimpleBookmark _theBookmark1 = new SimpleBookmark("value1");
- public ToBookmarkTest(String sName) {
- super(sName);
- }
-
- public static Test suite() {
- return new TestSuite(ToBookmarkTest.class);
- }
-
+ @Test
public void testToBookmarkPrior() throws Exception {
m_xo = XmlObject.Factory.parse(Common.XML_FOO_TEXT);
m_xc = m_xo.newCursor();
@@ -60,9 +41,9 @@ public class ToBookmarkTest extends Basi
m_xc.setBookmark(_theBookmark);
XmlCursor xc1 = m_xc.newCursor();
xc1.toEndDoc();
- assertEquals(true, xc1.toBookmark(_theBookmark));
+ assertTrue(xc1.toBookmark(_theBookmark));
try {
- assertEquals(true, m_xc.isAtSamePositionAs(xc1));
+ assertTrue(m_xc.isAtSamePositionAs(xc1));
SimpleBookmark sa = (SimpleBookmark) xc1.getBookmark(_theBookmark.getClass());
assertEquals("value", sa.text);
} finally {
@@ -70,6 +51,7 @@ public class ToBookmarkTest extends Basi
}
}
+ @Test
public void testToBookmarkPost() throws Exception {
m_xo = XmlObject.Factory.parse(Common.XML_FOO_TEXT);
m_xc = m_xo.newCursor();
@@ -77,9 +59,9 @@ public class ToBookmarkTest extends Basi
m_xc.setBookmark(_theBookmark);
XmlCursor xc1 = m_xc.newCursor();
xc1.toStartDoc();
- assertEquals(true, xc1.toBookmark(_theBookmark));
+ assertTrue(xc1.toBookmark(_theBookmark));
try {
- assertEquals(true, m_xc.isAtSamePositionAs(xc1));
+ assertTrue(m_xc.isAtSamePositionAs(xc1));
SimpleBookmark sa = (SimpleBookmark) xc1.getBookmark(_theBookmark.getClass());
assertEquals("value", sa.text);
} finally {
@@ -87,6 +69,7 @@ public class ToBookmarkTest extends Basi
}
}
+ @Test
public void testToBookmarkNULL() throws Exception {
m_xo = XmlObject.Factory.parse(Common.XML_FOO_TEXT);
m_xc = m_xo.newCursor();
@@ -94,31 +77,33 @@ public class ToBookmarkTest extends Basi
m_xc.setBookmark(_theBookmark);
XmlCursor xc1 = m_xc.newCursor();
xc1.toEndDoc();
- assertEquals(false, xc1.toBookmark(null));
+ assertFalse(xc1.toBookmark(null));
try {
- assertEquals(false, m_xc.isAtSamePositionAs(xc1));
+ assertFalse(m_xc.isAtSamePositionAs(xc1));
assertEquals(TokenType.ENDDOC, xc1.currentTokenType());
} finally {
xc1.dispose();
}
}
+ @Test
public void testToBookmarkDifferentDoc() throws Exception {
m_xo = XmlObject.Factory.parse(Common.XML_FOO_TEXT);
m_xc = m_xo.newCursor();
XmlObject xo = XmlObject.Factory.parse(Common.XML_FOO);
XmlCursor xc1 = xo.newCursor();
- assertEquals(false, m_xc.isInSameDocument(xc1));
+ assertFalse(m_xc.isInSameDocument(xc1));
toNextTokenOfType(m_xc, TokenType.START);
m_xc.setBookmark(_theBookmark);
try {
- assertEquals(false, xc1.toBookmark(_theBookmark));
- assertEquals(false, m_xc.isInSameDocument(xc1));
+ assertFalse(xc1.toBookmark(_theBookmark));
+ assertFalse(m_xc.isInSameDocument(xc1));
} finally {
xc1.dispose();
}
}
+ @Test
public void testPostMoveBookmarkInsideMove() throws Exception {
m_xo = XmlObject.Factory.parse(JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
String ns = "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
@@ -133,7 +118,7 @@ public class ToBookmarkTest extends Basi
while (xc1.toNextSelection()) {
m_xc.moveXml(xc1);
try {
- assertEquals(true, xc1.toBookmark(_theBookmark));
+ assertTrue(xc1.toBookmark(_theBookmark));
assertEquals("<po:city " + exp_ns + ">Mill Valley</po:city>", xc1.xmlText());
xc1.toNextSibling();
assertEquals("<po:city " + exp_ns + ">Old Town</po:city>", xc1.xmlText());
@@ -144,6 +129,7 @@ public class ToBookmarkTest extends Basi
xc1.dispose();
}
+ @Test
public void testPostMoveBookmarkToRightOfMove() throws Exception {
m_xo = XmlObject.Factory.parse(JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
String ns = "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
@@ -165,7 +151,7 @@ public class ToBookmarkTest extends Basi
m_xc.moveXml(xc1);
m_xc.toStartDoc();
try {
- assertEquals(true, xc1.toBookmark(_theBookmark1));
+ assertTrue(xc1.toBookmark(_theBookmark1));
xc1.toPrevSibling();
assertEquals("<po:street " + exp_ns + ">123 Maple Street</po:street>", xc1.xmlText());
} catch (Exception e) {
@@ -175,6 +161,7 @@ public class ToBookmarkTest extends Basi
xc1.dispose();
}
+ @Test
public void testToBookmarkPostCopy() throws Exception {
m_xo = XmlObject.Factory.parse(JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
m_xc = m_xo.newCursor();
@@ -189,7 +176,7 @@ public class ToBookmarkTest extends Basi
while (xc1.toNextSelection()) {
m_xc.copyXml(xc1);
try {
- assertEquals(true, xc1.toBookmark(_theBookmark));
+ assertTrue(xc1.toBookmark(_theBookmark));
assertEquals("<po:city " + exp_ns + ">Mill Valley</po:city>", xc1.xmlText());
xc1.toNextSibling();
assertEquals("<po:state " + exp_ns + ">CA</po:state>", xc1.xmlText());
@@ -200,6 +187,7 @@ public class ToBookmarkTest extends Basi
xc1.dispose();
}
+ @Test
public void testToBookmarkPostMoveChars() throws Exception {
m_xo = XmlObject.Factory.parse(Common.XML_FOO_DIGITS);
m_xc = m_xo.newCursor();
@@ -225,10 +213,8 @@ public class ToBookmarkTest extends Basi
* Purpose of the test:
* start w/ 01234, copy the first two characters b/n 3 and 4
* result should be 0123*01*4 where * shows the new insert
- *
- * @throws Exception
*/
-
+ @Test
public void testToBookmarkPostCopyChars() throws Exception {
m_xo = XmlObject.Factory.parse(Common.XML_FOO_DIGITS);
m_xc = m_xo.newCursor();
@@ -254,6 +240,7 @@ public class ToBookmarkTest extends Basi
}
}
+ @Test
public void testDumb() throws Exception {
m_xo = XmlObject.Factory.parse("<foo>01234</foo>");
m_xc = m_xo.newCursor();
@@ -263,6 +250,7 @@ public class ToBookmarkTest extends Basi
assertEquals(2, m_xc.copyChars(2, xc1));
}
+ @Test(expected = IllegalArgumentException.class)
public void testDumbDelete() throws Exception {
m_xo = XmlObject.Factory.parse("<foo>01234</foo>");
m_xc = m_xo.newCursor();
@@ -281,12 +269,10 @@ public class ToBookmarkTest extends Basi
//move xc1 to outer space
xc1.toBookmark(_theBookmark);
assertTrue(!m_xc.isInSameDocument(xc1));
- try{
assertTrue(!m_xc.isLeftOf(xc1));
- fail("Expected Illegal Arg exception--diff docs");
- }catch (IllegalArgumentException e){}
}
+ @Test
public void testToBookmarkPostRemove() throws Exception {
m_xo = XmlObject.Factory.parse(Common.XML_FOO_BAR_TEXT);
m_xc = m_xo.newCursor();
@@ -308,7 +294,7 @@ public class ToBookmarkTest extends Basi
assertEquals("<foo/>", m_xc.xmlText());
//test modified, the two cursors are not in the same
//tree anymore
- assertEquals(true, xc1.toBookmark(_theBookmark));
+ assertTrue(xc1.toBookmark(_theBookmark));
assertTrue(!xc1.isInSameDocument(m_xc));
// assertTrue(!xc1.isLeftOf(m_xc));
@@ -318,6 +304,7 @@ public class ToBookmarkTest extends Basi
xc1.dispose();
}
+ @Test
public void testToBookmarkPostRemoveAttribute() throws Exception {
m_xo = XmlObject.Factory.parse(Common.XML_FOO_1ATTR_TEXT);
m_xc = m_xo.newCursor();
@@ -335,13 +322,14 @@ public class ToBookmarkTest extends Basi
m_xc.toStartDoc();
try {
assertEquals("<foo>text</foo>", m_xc.xmlText());
- assertEquals(true, xc1.toBookmark(_theBookmark));
+ assertTrue(xc1.toBookmark(_theBookmark));
assertTrue(!xc1.isInSameDocument(m_xc));
} finally {
xc1.dispose();
}
}
+ @Test
public void testToBookmarkPostRemoveChars() throws Exception {
m_xo = XmlObject.Factory.parse(Common.XML_FOO_DIGITS);
m_xc = m_xo.newCursor();
@@ -355,7 +343,7 @@ public class ToBookmarkTest extends Basi
XmlCursor xc1 = m_xc.newCursor();
xc1.toEndDoc();
try {
- assertEquals(true, xc1.toBookmark(_theBookmark));
+ assertTrue(xc1.toBookmark(_theBookmark));
assertTrue(!xc1.isInSameDocument(m_xc));
SimpleBookmark sa =
(SimpleBookmark) xc1.getBookmark(SimpleBookmark.class);
@@ -366,6 +354,7 @@ public class ToBookmarkTest extends Basi
}
}
+ @Test
public void testToBookmarkPostSetTextValue() throws Exception {
m_xo = XmlObject.Factory.parse(Common.XML_FOO_TEXT);
m_xc = m_xo.newCursor();
@@ -380,7 +369,7 @@ public class ToBookmarkTest extends Basi
m_xc.toStartDoc();
assertEquals("<foo>changed</foo>", m_xc.xmlText());
try {
- assertEquals(true, xc1.toBookmark(_theBookmark));
+ assertTrue(xc1.toBookmark(_theBookmark));
assertTrue(!xc1.isInSameDocument(m_xc));
SimpleBookmark sa = (SimpleBookmark) xc1.getBookmark(SimpleBookmark.class);
assertEquals("value", sa.text);
@@ -394,7 +383,7 @@ public class ToBookmarkTest extends Basi
public class SimpleBookmark extends XmlCursor.XmlBookmark {
public String text;
- public SimpleBookmark(String text) {
+ SimpleBookmark(String text) {
this.text = text;
}
}
Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/ToChildTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/ToChildTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/ToChildTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/ToChildTest.java Fri Jan 18 23:08:44 2019
@@ -16,42 +16,20 @@
package xmlcursor.detailed;
-import org.apache.xmlbeans.XmlOptions;
-import junit.framework.*;
-import junit.framework.Assert.*;
-
-import java.io.*;
-
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlCursor.TokenType;
-import org.apache.xmlbeans.XmlDocumentProperties;
-import org.apache.xmlbeans.XmlCursor.XmlBookmark;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Test;
+import xmlcursor.common.BasicCursorTestCase;
import javax.xml.namespace.QName;
-import xmlcursor.common.*;
+import static org.junit.Assert.*;
-import java.net.URL;
-
-
-/**
- *
- *
- */
public class ToChildTest extends BasicCursorTestCase {
- String sDoc="<foo>early<bar>text</bar><char>zap<dar>wap</dar><ear>yap</ear></char></foo>";
+ private String sDoc="<foo>early<bar>text</bar><char>zap<dar>wap</dar><ear>yap</ear></char></foo>";
- int nChildCount=2; //num children if TEXT is a child
- public ToChildTest(String sName) {
- super(sName);
- }
-
- public static Test suite() {
- return new TestSuite(ToChildTest.class);
- }
+ private int nChildCount=2; //num children if TEXT is a child
/**
* Testing toChild(String)
* Cases:
@@ -61,52 +39,51 @@ public class ToChildTest extends BasicCu
* Child of TEXT
*/
- public void testToChildNonExisting()throws Exception{
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- assertEquals(false,m_xc.toChild("yana"));
- }
- public void testToChildInvalidName()throws Exception{
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- try{
- m_xc.toChild("");
- fail(" Name is invalid");
- }catch (java.lang.IllegalArgumentException e){}
-
- }
-
- public void testToChildNull()throws Exception{
- String sNull=null;
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- try{
- assertEquals(false,m_xc.toChild(sNull));
- fail("toChild with Null localName");
- }catch (IllegalArgumentException e){}
- }
-
- public void testNameCollision()throws Exception{
- sDoc="<foo><bar>txt0</bar><bar>txt1</bar></foo>";
- String sExpectedValue="<bar>txt0</bar>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(true,m_xc.toChild("bar"));
- assertEquals(sExpectedValue,m_xc.xmlText());
- }
-
- public void testSameNameDescendant()throws Exception{
- sDoc="<foo><bar><bar>txt0<bar/></bar></bar><bar>txt1</bar></foo>";
- String sExpectedValue="<bar><bar>txt0<bar/></bar></bar>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(true,m_xc.toChild("bar"));
- assertEquals(sExpectedValue,m_xc.xmlText());
- }
-
- public void testTextChild()throws Exception{
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- toNextTokenOfType(m_xc,TokenType.TEXT);
- assertEquals(false,m_xc.toChild("bar"));
- }
+ @Test
+ public void testToChildNonExisting() throws Exception {
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ assertFalse(m_xc.toChild("yana"));
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testToChildInvalidName() throws Exception {
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toChild("");
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testToChildNull() throws Exception {
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toChild((String)null);
+ }
+
+ @Test
+ public void testNameCollision() throws Exception {
+ sDoc = "<foo><bar>txt0</bar><bar>txt1</bar></foo>";
+ String sExpectedValue = "<bar>txt0</bar>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertTrue(m_xc.toChild("bar"));
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ }
+
+ @Test
+ public void testSameNameDescendant() throws Exception {
+ sDoc = "<foo><bar><bar>txt0<bar/></bar></bar><bar>txt1</bar></foo>";
+ String sExpectedValue = "<bar><bar>txt0<bar/></bar></bar>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertTrue(m_xc.toChild("bar"));
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ }
+
+ @Test
+ public void testTextChild() throws Exception {
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ toNextTokenOfType(m_xc, TokenType.TEXT);
+ assertFalse(m_xc.toChild("bar"));
+ }
/**
* toChild(String,String)
@@ -120,95 +97,98 @@ public class ToChildTest extends BasicCu
*/
- public void testNullNS()throws Exception{
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- String sExpectedResult="<bar>text</bar>";
- assertEquals(true,m_xc.toChild(null,"bar"));
- assertEquals(sExpectedResult,m_xc.xmlText());
- }
-
- public void testNullName()throws Exception{
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- try{
- assertEquals(false,m_xc.toChild("uri:foo.org",null));
- fail("toChild(uri,localname) with Null localName");
- }catch (IllegalArgumentException e){}
- }
-
- public void testNamespaceOKNameInvalid()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\"><fo:bar>txt0</fo:bar><bar>txt1</bar></foo>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(false,m_xc.toChild("fo","test"));
- }
-
- public void testNamespaceInvalidNameOK()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\"><fo:bar>txt0</fo:bar><bar>txt1</bar></foo>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- String sExpectedResult="<bar>text</bar>";
- assertEquals(false,m_xc.toChild("bar","bar"));
- }
-
- public void testNormalCase()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\"><fo:bar>txt0</fo:bar><bar>txt1</bar></foo>";
- String sExpectedResult="<fo:bar xmlns:fo=\"uri:foo.org\">txt0</fo:bar>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(true,m_xc.toChild("uri:foo.org","bar"));
- assertEquals(sExpectedResult,m_xc.xmlText());
- }
-
- public void testUriNameCollision()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\"><fo:bar>txt0</fo:bar><fo:bar>txt1</fo:bar></foo>";
- String sExpectedValue="<fo:bar xmlns:fo=\"uri:foo.org\">txt0</fo:bar>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(true,m_xc.toChild("uri:foo.org","bar"));
- assertEquals(sExpectedValue,m_xc.xmlText());
- }
-
-
+ @Test
+ public void testNullNS() throws Exception {
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ String sExpectedResult = "<bar>text</bar>";
+ assertTrue(m_xc.toChild(null, "bar"));
+ assertEquals(sExpectedResult, m_xc.xmlText());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testNullName() throws Exception {
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ m_xc.toChild("uri:foo.org", null);
+ }
+
+ @Test
+ public void testNamespaceOKNameInvalid() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\"><fo:bar>txt0</fo:bar><bar>txt1</bar></foo>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertFalse(m_xc.toChild("fo", "test"));
+ }
+
+ @Test
+ public void testNamespaceInvalidNameOK() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\"><fo:bar>txt0</fo:bar><bar>txt1</bar></foo>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertFalse(m_xc.toChild("bar", "bar"));
+ }
+
+ @Test
+ public void testNormalCase() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\"><fo:bar>txt0</fo:bar><bar>txt1</bar></foo>";
+ String sExpectedResult = "<fo:bar xmlns:fo=\"uri:foo.org\">txt0</fo:bar>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertTrue(m_xc.toChild("uri:foo.org", "bar"));
+ assertEquals(sExpectedResult, m_xc.xmlText());
+ }
+
+ @Test
+ public void testUriNameCollision() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\"><fo:bar>txt0</fo:bar><fo:bar>txt1</fo:bar></foo>";
+ String sExpectedValue = "<fo:bar xmlns:fo=\"uri:foo.org\">txt0</fo:bar>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertTrue(m_xc.toChild("uri:foo.org", "bar"));
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ }
//same URI diff names
- public void testFakeNameCollision()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\"><fo:bars>txt0</fo:bars><fo:bar>txt1</fo:bar></foo>";
- String sExpectedValue="<fo:bar xmlns:fo=\"uri:foo.org\">txt1</fo:bar>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(true,m_xc.toChild("uri:foo.org","bar"));
- assertEquals(sExpectedValue,m_xc.xmlText());
- }
-
- //diff URI same names
- public void testFakeNameCollision3()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\"><fo:bar>txt0</fo:bar><bar>txt1</bar></foo>";
- String sExpectedValue="<fo:bar xmlns:fo=\"uri:foo.org\">txt0</fo:bar>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(true,m_xc.toChild("uri:foo.org","bar"));
- assertEquals(sExpectedValue,m_xc.xmlText());
- }
-
-
- public void testSameNameDescendant1()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\"><bar><fo:bar>txt0<bar/></fo:bar></bar><bar>txt1</bar></foo>";
-
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(false,m_xc.toChild("uri:foo.org","bar"));
- }
-
- public void testSameNameDescendant2()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\"><bar><fo:bar>txt0<bar/></fo:bar></bar><bar>txt1</bar><fo:bar>txt1</fo:bar></foo>";
- String sExpectedValue="<fo:bar xmlns:fo=\"uri:foo.org\">txt1</fo:bar>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(true,m_xc.toChild("uri:foo.org","bar"));
- assertEquals(sExpectedValue,m_xc.xmlText());
- }
+ @Test
+ public void testFakeNameCollision() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\"><fo:bars>txt0</fo:bars><fo:bar>txt1</fo:bar></foo>";
+ String sExpectedValue = "<fo:bar xmlns:fo=\"uri:foo.org\">txt1</fo:bar>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertTrue(m_xc.toChild("uri:foo.org", "bar"));
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ }
+
+ //diff URI same names
+ @Test
+ public void testFakeNameCollision3() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\"><fo:bar>txt0</fo:bar><bar>txt1</bar></foo>";
+ String sExpectedValue = "<fo:bar xmlns:fo=\"uri:foo.org\">txt0</fo:bar>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertTrue(m_xc.toChild("uri:foo.org", "bar"));
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ }
+
+ @Test
+ public void testSameNameDescendant1() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\"><bar><fo:bar>txt0<bar/></fo:bar></bar><bar>txt1</bar></foo>";
+
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertFalse(m_xc.toChild("uri:foo.org", "bar"));
+ }
+
+ @Test
+ public void testSameNameDescendant2() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\"><bar><fo:bar>txt0<bar/></fo:bar></bar><bar>txt1</bar><fo:bar>txt1</fo:bar></foo>";
+ String sExpectedValue = "<fo:bar xmlns:fo=\"uri:foo.org\">txt1</fo:bar>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertTrue(m_xc.toChild("uri:foo.org", "bar"));
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ }
/**
@@ -219,103 +199,114 @@ public class ToChildTest extends BasicCu
* i=0, numChildren=0
*/
- public void testNegativeIndex()throws Exception{
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- assertEquals(false,m_xc.toChild(-1));
- }
-
- public void testIndexOKFirst()throws Exception{
- String sExpectedValue="<bar>text</bar>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(true,m_xc.toChild(0));//text is not children
- assertEquals(sExpectedValue,m_xc.xmlText());
- }
-
- public void testIndexOKLast()throws Exception{
- String sExpectedValue="<char>zap<dar>wap</dar><ear>yap</ear></char>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(true,m_xc.toChild(nChildCount-1));
- assertEquals(sExpectedValue,m_xc.xmlText());
- m_xc.toParent();
- m_xc.toLastChild();
- assertEquals(sExpectedValue,m_xc.xmlText());
- }
-
- public void testLargeIndex()throws Exception{
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(false,m_xc.toChild(20));
-
- }
- public void testInd0Count0()throws Exception{
- sDoc="<foo/>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(false,m_xc.toChild(0));
- }
-
-
- /**
- * toChild(QName,int)
- * Cases:
- * QName dne,
- * QName OK, i OK;i >numChildren;i<0
- * Name collision, i=1;i>numChildren
- * Siblings and a child with same qname, ask for 2nd sibling
- */
-
- public void testToChildQNameDNE0()throws Exception{
- QName searchVal=new QName("fake:uri","bar");
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(false,m_xc.toChild(searchVal,1));
- }
-
- public void testToChildQNameDNE1()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\"><fo:bars>txt0</fo:bars><fo:bar>txt1</fo:bar></foo>";
- QName searchVal=new QName("uri:foo.org","bar","pre");
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(false,m_xc.toChild(searchVal,1));
- }
-
- public void testToChildQNameOKIndexOK()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\"><fo:bars>txt0</fo:bars><fo:bar>txt1</fo:bar></foo>";
- QName searchVal=new QName("uri:foo.org","bar","fo");
- String sExpectedValue="<fo:bar xmlns:fo=\"uri:foo.org\">txt1</fo:bar>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(true,m_xc.toChild(searchVal,0));
- assertEquals(sExpectedValue,m_xc.xmlText());
- assertEquals(false,m_xc.toChild(searchVal,1));
- assertEquals(false,m_xc.toChild(searchVal,-1));
- }
-
- public void testQNameNameCollision()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\"><fo:bars>txt0</fo:bars><fo:bar>txt1</fo:bar></foo>";
- nChildCount=2;
- QName searchVal=new QName("uri:foo.org","bar","fo");
- String sExpectedValue="<fo:bar xmlns:fo=\"uri:foo.org\">txt1</fo:bar>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- assertEquals(true,m_xc.toChild(searchVal,0));
- assertEquals(sExpectedValue,m_xc.xmlText());
- int nInvalidCount=2;
- if(nInvalidCount>=nChildCount)
- assertEquals(false,m_xc.toChild(searchVal,nInvalidCount));
- else fail("Broken Test");
- }
-
-
- public void testFakeQNameCollision()throws Exception{
- sDoc="<foo xmlns:fo=\"uri:foo.org\" xmlns:fo2=\"uri:foo.org\"><fo2:bar>txt0</fo2:bar><fo:bar>txt1</fo:bar></foo>";
- String sExpectedValue="<fo2:bar xmlns:fo=\"uri:foo.org\" xmlns:fo2=\"uri:foo.org\">txt0</fo2:bar>";
- m_xc = XmlObject.Factory.parse(sDoc).newCursor();
- m_xc.toFirstChild();
- QName searchVal=new QName("uri:foo.org","bar","fo");
- assertEquals(true,m_xc.toChild(searchVal,0));
- assertEquals(sExpectedValue,m_xc.xmlText());
- }
+ @Test
+ public void testNegativeIndex() throws Exception {
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ assertFalse(m_xc.toChild(-1));
+ }
+
+ @Test
+ public void testIndexOKFirst() throws Exception {
+ String sExpectedValue = "<bar>text</bar>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertTrue(m_xc.toChild(0));//text is not children
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ }
+
+ @Test
+ public void testIndexOKLast() throws Exception {
+ String sExpectedValue = "<char>zap<dar>wap</dar><ear>yap</ear></char>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertTrue(m_xc.toChild(nChildCount - 1));
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ m_xc.toParent();
+ m_xc.toLastChild();
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ }
+
+ @Test
+ public void testLargeIndex() throws Exception {
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertFalse(m_xc.toChild(20));
+
+ }
+
+ @Test
+ public void testInd0Count0() throws Exception {
+ sDoc = "<foo/>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertFalse(m_xc.toChild(0));
+ }
+
+
+ /**
+ * toChild(QName,int)
+ * Cases:
+ * QName dne,
+ * QName OK, i OK;i >numChildren;i<0
+ * Name collision, i=1;i>numChildren
+ * Siblings and a child with same qname, ask for 2nd sibling
+ */
+
+ @Test
+ public void testToChildQNameDNE0() throws Exception {
+ QName searchVal = new QName("fake:uri", "bar");
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertFalse(m_xc.toChild(searchVal, 1));
+ }
+
+ @Test
+ public void testToChildQNameDNE1() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\"><fo:bars>txt0</fo:bars><fo:bar>txt1</fo:bar></foo>";
+ QName searchVal = new QName("uri:foo.org", "bar", "pre");
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertFalse(m_xc.toChild(searchVal, 1));
+ }
+
+ @Test
+ public void testToChildQNameOKIndexOK() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\"><fo:bars>txt0</fo:bars><fo:bar>txt1</fo:bar></foo>";
+ QName searchVal = new QName("uri:foo.org", "bar", "fo");
+ String sExpectedValue = "<fo:bar xmlns:fo=\"uri:foo.org\">txt1</fo:bar>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertTrue(m_xc.toChild(searchVal, 0));
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ assertFalse(m_xc.toChild(searchVal, 1));
+ assertFalse(m_xc.toChild(searchVal, -1));
+ }
+
+ @Test
+ public void testQNameNameCollision() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\"><fo:bars>txt0</fo:bars><fo:bar>txt1</fo:bar></foo>";
+ nChildCount = 2;
+ QName searchVal = new QName("uri:foo.org", "bar", "fo");
+ String sExpectedValue = "<fo:bar xmlns:fo=\"uri:foo.org\">txt1</fo:bar>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ assertTrue(m_xc.toChild(searchVal, 0));
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ int nInvalidCount = 2;
+ if (nInvalidCount >= nChildCount)
+ assertFalse(m_xc.toChild(searchVal, nInvalidCount));
+ else fail("Broken Test");
+ }
+
+
+ @Test
+ public void testFakeQNameCollision() throws Exception {
+ sDoc = "<foo xmlns:fo=\"uri:foo.org\" xmlns:fo2=\"uri:foo.org\"><fo2:bar>txt0</fo2:bar><fo:bar>txt1</fo:bar></foo>";
+ String sExpectedValue = "<fo2:bar xmlns:fo=\"uri:foo.org\" xmlns:fo2=\"uri:foo.org\">txt0</fo2:bar>";
+ m_xc = XmlObject.Factory.parse(sDoc).newCursor();
+ m_xc.toFirstChild();
+ QName searchVal = new QName("uri:foo.org", "bar", "fo");
+ assertTrue(m_xc.toChild(searchVal, 0));
+ assertEquals(sExpectedValue, m_xc.xmlText());
+ }
}
Modified: xmlbeans/trunk/test/src/xmlcursor/detailed/XmlLineNumberTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/detailed/XmlLineNumberTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/detailed/XmlLineNumberTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/detailed/XmlLineNumberTest.java Fri Jan 18 23:08:44 2019
@@ -14,18 +14,16 @@
*/
package xmlcursor.detailed;
-import java.io.*;
-
-import org.apache.xmlbeans.XmlObject;
+import common.Common;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlLineNumber;
+import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
+import org.junit.Test;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import java.io.File;
-import common.Common;
+import static org.junit.Assert.*;
public class XmlLineNumberTest extends Common
{
@@ -40,13 +38,9 @@ public class XmlLineNumberTest extends C
public static final String xmlFile =
XBEAN_CASE_ROOT + P + "xmlcursor" + P + "Employees.xml";
- public XmlLineNumberTest(String name)
- {
- super(name);
- }
-
/** test obtaining XmlLineNumber bookmark with option
XmlOptions.setLoadLineNumbers() */
+ @Test
public void testGetBookmark1() throws Exception
{
File f = new File(xmlFile);
@@ -57,7 +51,7 @@ public class XmlLineNumberTest extends C
c.toFirstChild();
assertEquals(XmlCursor.TokenType.START, c.currentTokenType());
XmlLineNumber ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
- assertTrue(ln != null);
+ assertNotNull(ln);
assertEquals(1, ln.getLine());
c.toFirstChild();
ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
@@ -66,12 +60,13 @@ public class XmlLineNumberTest extends C
assertEquals(XmlCursor.TokenType.END, c.currentTokenType());
ln =(XmlLineNumber) c.getBookmark(XmlLineNumber.class);
// no bookmark at END
- assertEquals(null, ln);
+ assertNull(ln);
}
/** test obtaining XmlLineNumber bookmark with option
XmlOptions.setLoadLineNumbers(XmlOptions.LOAD_LINE_NUMBERS_END_ELEMENT)
*/
+ @Test
public void testGetBookmark2() throws Exception
{
File f = new File(xmlFile);
@@ -82,7 +77,7 @@ public class XmlLineNumberTest extends C
c.toFirstChild();
assertEquals(XmlCursor.TokenType.START, c.currentTokenType());
XmlLineNumber ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
- assertTrue(ln != null);
+ assertNotNull(ln);
assertEquals(1, ln.getLine());
c.toFirstChild();
ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
@@ -91,12 +86,13 @@ public class XmlLineNumberTest extends C
assertEquals(XmlCursor.TokenType.END, c.currentTokenType());
ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
// there is a bookmark at END
- assertTrue(ln != null);
+ assertNotNull(ln);
assertEquals(19, ln.getLine());
}
/** test using XmlLineNumber to get line number, column, and offset
- parsing xml from string */
+ @Test
public void testLineNumber1() throws Exception
{
XmlOptions opt = new XmlOptions().setLoadLineNumbers();
@@ -106,27 +102,24 @@ public class XmlLineNumberTest extends C
c.toFirstChild();
XmlLineNumber ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
assertEquals(1, ln.getLine());
- //assertEquals(8, ln.getColumn()); // actual: 10
- assertTrue(8 <= ln.getColumn() && ln.getColumn() <= 10);
+ assertEquals(50, ln.getColumn());
// offset is not implemented
assertEquals(-1, ln.getOffset());
c.toFirstChild();
ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
assertEquals(2, ln.getLine());
- //assertEquals(4, ln.getColumn()); // actual: 6
- assertTrue(4 <= ln.getColumn() && ln.getColumn() <= 6);
+ assertEquals(10, ln.getColumn());
c.toFirstChild();
ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
assertEquals(3, ln.getLine());
- // tabs count as having single column width
- //assertEquals(2, ln.getColumn()); // actual: 4
- assertTrue(2 <= ln.getColumn() && ln.getColumn() <= 4);
+ // finishes after reading after <first_name> + 2xtabs
+ assertEquals(14, ln.getColumn());
}
/** test using XmlLineNumber to get line number, column, and offset
- parsing xml from file */
- public void testLineNumber2() throws Exception
- {
+ @Test
+ public void testLineNumber2() throws Exception {
File f = new File(xmlFile);
XmlOptions opt = new XmlOptions();
opt.setLoadLineNumbers(XmlOptions.LOAD_LINE_NUMBERS_END_ELEMENT);
@@ -136,34 +129,23 @@ public class XmlLineNumberTest extends C
c.toFirstChild();
XmlLineNumber ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
assertEquals(2, ln.getLine());
- assertTrue(2 <= ln.getColumn() && ln.getColumn() <= 4);
+ assertEquals(15, ln.getColumn());
assertEquals(-1, ln.getOffset());
c.toFirstChild();
c.push();
ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
assertEquals(3, ln.getLine());
- assertTrue(4 <= ln.getColumn() && ln.getColumn() <= 6);
+ assertEquals(13, ln.getColumn());
c.toEndToken();
ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
assertEquals(3, ln.getLine());
- assertTrue(23 <= ln.getColumn() && ln.getColumn() <= 25);
+ assertEquals(33, ln.getColumn());
c.pop();
c.toNextSibling(); //address
c.toEndToken();
ln = (XmlLineNumber) c.getBookmark(XmlLineNumber.class);
assertEquals(9, ln.getLine());
- assertTrue(4 <= ln.getColumn() && ln.getColumn() <= 6);
+ assertEquals(17, ln.getColumn());
assertEquals(-1, ln.getOffset());
}
-
- public static Test suite()
- {
- TestSuite suite = new TestSuite(XmlLineNumberTest.class);
- return suite;
- }
-
- public static void main(String args[])
- {
- junit.textui.TestRunner.run(suite());
- }
}
Modified: xmlbeans/trunk/test/src/xmlcursor/jsr173/common/AttributeTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/jsr173/common/AttributeTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/jsr173/common/AttributeTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/jsr173/common/AttributeTest.java Fri Jan 18 23:08:44 2019
@@ -18,53 +18,55 @@ 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.namespace.QName;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
-import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
-import org.apache.xmlbeans.XmlOptions;
+import static org.junit.Assert.*;
-import junit.framework.*;
-import junit.framework.Assert.*;
+@Ignore("abstract class")
+public abstract class AttributeTest {
-/**
- *
- *
- */
-public abstract class AttributeTest extends TestCase {
-
- int indexMethods=6;
- public abstract XMLStreamReader getStream(XmlCursor c)throws Exception;
- public AttributeTest(String s) {
- super(s);
- }
+ private XMLStreamReader m_stream;
+ private XmlCursor cur;
+ private int indexMethods = 6;
+ public abstract XMLStreamReader getStream(XmlCursor c) throws Exception;
+
+ @Test
public void testAttrEvent() throws Exception {
cur.toNextToken();
- m_stream =getStream(cur);
- assertEquals( XMLStreamConstants.ATTRIBUTE, m_stream.getEventType() );
+ m_stream = getStream(cur);
+ assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.getEventType());
assertEquals(1, m_stream.getAttributeCount());
assertEquals(m_stream.getAttributeValue(0),
- m_stream.getAttributeValue("foo.org", "at0"));
+ m_stream.getAttributeValue("foo.org", "at0"));
- assertFalse(m_stream.hasNext());
+ assertFalse(m_stream.hasNext());
}
- public void testAttrMethodsAtAttr() throws Exception{
+
+ @Test
+ public void testAttrMethodsAtAttr() throws Exception {
//2 attrs under the doc
-// assertEquals(2, m_stream.getAttributeCount());
+ // assertEquals(2, m_stream.getAttributeCount());
- cur.toNextToken();
- m_stream= getStream(cur);;
+ cur.toNextToken();
+ m_stream = getStream(cur);
+ ;
//move 2 first attr
- assertEquals( XMLStreamConstants.ATTRIBUTE, m_stream.getEventType() );
+ assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.getEventType());
assertEquals(1, m_stream.getAttributeCount());
assertEquals(m_stream.getAttributeValue(0),
- m_stream.getAttributeValue("foo.org", "at0"));
+ m_stream.getAttributeValue("foo.org", "at0"));
//Below methods tested at index 0 and last at index tests
//getAttributeLocalName(int)
@@ -77,7 +79,8 @@ public abstract class AttributeTest exte
}
- public void testAttrMethodsAtStartElt() throws Exception{
+ @Test
+ public void testAttrMethodsAtStartElt() throws Exception {
cur.toFirstChild();
cur.toNextSibling();
m_stream = getStream(cur);
@@ -86,15 +89,14 @@ public abstract class AttributeTest exte
assertEquals(new QName("foo.org", "foo", ""), m_stream.getName());
assertEquals(m_stream.getAttributeValue(0), "");
assertEquals(m_stream.getAttributeValue(0),
- m_stream.getAttributeValue("", "localName"));
+ m_stream.getAttributeValue("", "localName"));
}
private void assertIllegalState1() {
try {
m_stream.getAttributeCount();
fail("Illegal State");
- }
- catch (java.lang.IllegalStateException e) {
+ } catch (java.lang.IllegalStateException e) {
}
}
@@ -102,15 +104,15 @@ public abstract class AttributeTest exte
try {
m_stream.getAttributeValue(0);
fail("Illegal State");
- }
- catch (java.lang.IllegalStateException e) {
+ } catch (java.lang.IllegalStateException e) {
}
}
+ @Test
public void testAttrMethodsAtNamespace() throws Exception {
cur.toNextToken();
cur.toNextToken();
- assertEquals (XmlCursor.TokenType.NAMESPACE, cur.toNextToken());
+ assertEquals(XmlCursor.TokenType.NAMESPACE, cur.toNextToken());
m_stream = getStream(cur);
assertIllegalState1();
@@ -121,11 +123,11 @@ public abstract class AttributeTest exte
//
}
-//
+ //
// java.lang.IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE
//
-
- public void testAttrMethodsAtEndElt()throws Exception {
+ @Test
+ public void testAttrMethodsAtEndElt() throws Exception {
cur.toFirstChild();
cur.toNextSibling();
cur.toNextToken();
@@ -136,7 +138,8 @@ public abstract class AttributeTest exte
assertIllegalState2();
}
- public void testAttrMethodsAtEndDoc() throws Exception {
+ @Test
+ public void testAttrMethodsAtEndDoc() throws Exception {
cur.toFirstChild();
cur.toNextSibling();
cur.toNextToken();
@@ -149,6 +152,7 @@ public abstract class AttributeTest exte
assertIllegalState2();
}
+ @Test
public void testAttrMethodstAtText() throws Exception {
cur.toFirstChild();
cur.toNextSibling();
@@ -159,6 +163,7 @@ public abstract class AttributeTest exte
assertIllegalState2();
}
+ @Test
public void testAttrMethodstAtPI() throws Exception {
cur.toFirstChild();
cur.toNextSibling();
@@ -171,7 +176,7 @@ public abstract class AttributeTest exte
assertIllegalState2();
}
- /**
+ /**
* verify index correctness for all index methods
* tested w/ cursor positioned at first attr
* //getAttributeLocalName(int)
@@ -181,149 +186,144 @@ public abstract class AttributeTest exte
* //getAttributeType(int)
* //getAttributeValue(int)
*/
-
+ @Test
public void testAttrMethodsNegIndex() throws Exception {
int cnt = 0;
try {
m_stream.getAttributeLocalName(-1);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
try {
m_stream.getAttributeName(-1);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
try {
m_stream.getAttributeNamespace(-1);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
try {
m_stream.getAttributePrefix(-1);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
try {
m_stream.getAttributeType(-1);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
try {
m_stream.getAttributeValue(-1);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
- assertEquals( "A negative error wasn't thrown", indexMethods , cnt);
+ assertEquals("A negative error wasn't thrown", indexMethods, cnt);
}
- public void testAttrMethodsLargeIndex()
- throws XMLStreamException {
+ @Test
+ public void testAttrMethodsLargeIndex() throws XMLStreamException {
int cnt = 0;
- int pos=-1;
+ int pos = -1;
try {
- m_stream.next();
- pos=m_stream.getAttributeCount();
+ m_stream.next();
+ pos = m_stream.getAttributeCount();
m_stream.getAttributeLocalName(pos);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
try {
m_stream.getAttributeName(pos);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
try {
m_stream.getAttributeNamespace(pos);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
try {
m_stream.getAttributePrefix(pos);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
try {
m_stream.getAttributeType(pos);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
try {
m_stream.getAttributeValue(pos);
- }
- catch (java.lang.IndexOutOfBoundsException e) {
+ } catch (java.lang.IndexOutOfBoundsException e) {
cnt++;
}
- assertEquals( "A negative error wasn't thrown", indexMethods, cnt);
+ assertEquals("A negative error wasn't thrown", indexMethods, cnt);
}
- public void testAttrMethods0Index() throws Exception{
- assertEquals( XMLStreamConstants.START_DOCUMENT, m_stream.getEventType() );
+ @Test
+ public void testAttrMethods0Index() throws Exception {
+ assertEquals(XMLStreamConstants.START_DOCUMENT, m_stream.getEventType());
- assertEquals( XMLStreamConstants.ATTRIBUTE, m_stream.next() );
+ assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.next());
assertEquals(1, m_stream.getAttributeCount());
assertEquals("val0", m_stream.getAttributeValue(0));
- assertEquals( XMLStreamConstants.ATTRIBUTE, m_stream.next() );
+ assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.next());
assertEquals("val1", m_stream.getAttributeValue(0));
//why does this crash here????
- assertEquals( XMLStreamConstants.NAMESPACE,m_stream.next()); //ns
+ assertEquals(XMLStreamConstants.NAMESPACE, m_stream.next()); //ns
m_stream.next(); //elt
- assertEquals("", m_stream.getAttributeValue(0));
+ assertEquals("", m_stream.getAttributeValue(0));
}
//NOTHING to do; eric always emits one event per attr=>
//getAttributeCount is always 1
+ @Test
public void testAttrMethodsLastIndex() {
}
- public void testIsAttributeSpecified() throws Exception {
- assertEquals( XMLStreamConstants.START_DOCUMENT,
- m_stream.getEventType() );
- try{
- m_stream.isAttributeSpecified(0);
- fail("Bad state");
- }catch (IllegalStateException e){}
- assertEquals( XMLStreamConstants.ATTRIBUTE, m_stream.next() );
+ @Test
+ public void testIsAttributeSpecified() throws Exception {
+ assertEquals(XMLStreamConstants.START_DOCUMENT,
+ m_stream.getEventType());
+ try {
+ m_stream.isAttributeSpecified(0);
+ fail("Bad state");
+ } catch (IllegalStateException e) {
+ }
+
+ assertEquals(XMLStreamConstants.ATTRIBUTE, m_stream.next());
assertEquals(false, m_stream.isAttributeSpecified(0));
- try{
- m_stream.isAttributeSpecified(-1);
- fail("Bad state");
- }catch (java.lang.IndexOutOfBoundsException e){}
-
- try{
- m_stream.isAttributeSpecified(2);
- fail("Bad state");
- }catch (java.lang.IndexOutOfBoundsException e){}
+ try {
+ m_stream.isAttributeSpecified(-1);
+ fail("Bad state");
+ } catch (java.lang.IndexOutOfBoundsException e) {
+ }
- }
+ try {
+ m_stream.isAttributeSpecified(2);
+ fail("Bad state");
+ } catch (java.lang.IndexOutOfBoundsException e) {
+ }
+ }
+ @Before
public void setUp() throws Exception {
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", ""));
@@ -334,19 +334,13 @@ public abstract class AttributeTest exte
cur.insertProcInst("xml-stylesheet", "http://foobar");
cur.toStartDoc();
- m_stream=getStream(cur);
- //cur.newXMLStreamReader();
-
+ m_stream = getStream(cur);
+ //cur.newXMLStreamReader();
}
- public void tearDown() throws Exception
- {
- super.tearDown();
+ @After
+ public void tearDown() throws Exception {
if (m_stream != null)
m_stream.close();
}
-
- XMLStreamReader m_stream;
- XmlCursor cur;
-
}
\ No newline at end of file
Modified: xmlbeans/trunk/test/src/xmlcursor/jsr173/common/CharactersTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/jsr173/common/CharactersTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/jsr173/common/CharactersTest.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/jsr173/common/CharactersTest.java Fri Jan 18 23:08:44 2019
@@ -18,16 +18,16 @@ 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 static org.junit.Assert.*;
/**
* Methods tested
@@ -39,13 +39,17 @@ import junit.framework.*;
* Token Types should be DTD, ER, Chars, Comment, Space
* currently DTD and ER are Not Impl
*/
-public abstract class CharactersTest extends TestCase {
+@Ignore("abstract class")
+public abstract class CharactersTest {
+
+ private XMLStreamReader m_stream;
public abstract XMLStreamReader getStream(XmlCursor c) throws Exception;
+ @Test
public void testHasText() throws Exception {
assertEquals(XMLStreamConstants.START_DOCUMENT,
- m_stream.getEventType());
+ m_stream.getEventType());
// assertEquals( XMLStreamConstants.ATTRIBUTE, m_stream.next() );
// assertFalse( m_stream.hasText() );
@@ -72,6 +76,7 @@ public abstract class CharactersTest ext
}
//also testing getTextStart and getTextLength
+ @Test
public void testGetTextCharacters() throws Exception {
try {
assertEquals(XMLStreamConstants.START_DOCUMENT, m_stream.getEventType());
@@ -83,7 +88,7 @@ public abstract class CharactersTest ext
assertEquals(XMLStreamConstants.COMMENT, m_stream.next());
char[] result = m_stream.getTextCharacters();
assertEquals(" some comment ", new String(result).substring(m_stream.getTextStart(),
- m_stream.getTextLength()));
+ m_stream.getTextLength()));
try {
assertEquals(XMLStreamConstants.START_ELEMENT, m_stream.next());
@@ -96,7 +101,7 @@ public abstract class CharactersTest ext
assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
result = m_stream.getTextCharacters();
assertEquals("some text", new String(result).substring(m_stream.getTextStart(),
- m_stream.getTextLength()));
+ m_stream.getTextLength()));
m_stream.next();
m_stream.next();//skip empty elt
@@ -104,7 +109,7 @@ public abstract class CharactersTest ext
assertEquals(XMLStreamConstants.CHARACTERS, m_stream.next());
result = m_stream.getTextCharacters();
assertEquals("\t", new String(result).substring(m_stream.getTextStart(),
- m_stream.getTextLength()));
+ m_stream.getTextLength()));
try {
m_stream.next();
m_stream.getTextLength();
@@ -113,74 +118,46 @@ public abstract class CharactersTest ext
}
}
-
+ @Test(expected = IndexOutOfBoundsException.class)
public void testGetTextCharactersBufferNegStart() throws Exception {
m_stream.next();
- try {
- m_stream.getTextCharacters(-1, new char[10], 12, 12);
- fail(" java.lang.IndexOutOfBoundsException - if " +
- "length < 0 or targetStart + length > length of target ");
- } catch (java.lang.IndexOutOfBoundsException e) {
- }
+ m_stream.getTextCharacters(-1, new char[10], 12, 12);
}
+ @Test(expected = NullPointerException.class)
public void testGetTextCharactersBufferNull() throws Exception {
m_stream.next();
- try {
- m_stream.getTextCharacters(0, null, 12, 12);
- fail(" java.lang.NullPointerException - is if target is null ");
- } catch (java.lang.NullPointerException e) {
- }
-
+ m_stream.getTextCharacters(0, null, 12, 12);
}
+ @Test(expected = IndexOutOfBoundsException.class)
public void testGetTextCharactersLargeSrcOff() throws Exception {
m_stream.next();
- try {
- m_stream.getTextCharacters(110, new char[10], 0, 9);
- fail(" java.lang.IndexOutOfBoundsException - if " +
- "length < 0 or targetStart + length > length of target ");
- } catch (java.lang.IndexOutOfBoundsException e) {
- }
+ m_stream.getTextCharacters(110, new char[10], 0, 9);
}
+ @Test(expected = IndexOutOfBoundsException.class)
public void testGetTextCharactersLargeTrgOff() throws Exception {
m_stream.next();
- try {
- m_stream.getTextCharacters(110, new char[10], 10, 9);
- fail(" java.lang.IndexOutOfBoundsException - if " +
- "length < 0 or targetStart + length > length of target ");
- } catch (java.lang.IndexOutOfBoundsException e) {
- }
+ m_stream.getTextCharacters(110, new char[10], 10, 9);
}
+ @Test(expected = IndexOutOfBoundsException.class)
public void testGetTextCharactersLargeLen() throws Exception {
m_stream.next();
char[] buff = new char[9];
- try {
- int nCopied = m_stream.getTextCharacters(0, buff, 0, 30);
- assertEquals(nCopied, buff.length);
- fail(" java.lang.IndexOutOfBoundsException - if " +
- "length < 0 or targetStart + length > length of target ");
- } catch (java.lang.IndexOutOfBoundsException e) {
- }
-
+ m_stream.getTextCharacters(0, buff, 0, 30);
}
//off+len past end
+ @Test(expected = IndexOutOfBoundsException.class)
public void testGetTextCharactersLargeSum() throws Exception {
m_stream.next();
char[] buff = new char[9];
- try {
- int nCopied = m_stream.getTextCharacters(0, buff, 3, 10);
- fail(" java.lang.IndexOutOfBoundsException - if " +
- "length < 0 or targetStart + length > length of target ");
- } catch (java.lang.IndexOutOfBoundsException e) {
- }
-
+ m_stream.getTextCharacters(0, buff, 3, 10);
}
-
+ @Test
public void testGetText() throws Exception {
try {
assertEquals(XMLStreamConstants.START_DOCUMENT, m_stream.getEventType());
@@ -219,9 +196,9 @@ public abstract class CharactersTest ext
}
}
-
+ @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");
@@ -238,13 +215,9 @@ public abstract class CharactersTest ext
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
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org