Version 5.0
I am getting what appears to be a reflection related
exception (InvocationTargetException):
[sqlunit] Running test[1]:
TestSQLUnit_TestDefaultParameterValues_1: Call stored
proc using all default parameters values (0ms)
[sqlunit] DEBUG [main] (SQLUnitResult.java:108) -
>> getLastException()
[sqlunit] org.jdom.Element.addContent
(Lorg/jdom/Element;)Lorg/jdom/Element;
[sqlunit] DEBUG [main] (SymbolTable.java:148) - >>
getSymbols()
[sqlunit] Tearing down test...
org.jdom.Element.addContent(Lorg/jdom/Element;)
Lorg/jdom/Element;
This only happens when the test fails. I think this
is caused by the method Assertions.invokeAssertions:
try {
Method method =
Assertions.class.getDeclaredMethod(
methodName, paramClasses);
method.invoke(null, params);
} catch (InvocationTargetException e) {
// this will be an SQLUnitException
throw new SQLUnitException(e.getCause
().getMessage(),
e.getCause());
I believe this to be versioning issue between the
compiled version and the released dependent jdom libs.
Additional information when running my build.xml
[sqlunit] FATAL [main] (SQLUnit.java:223) - SQLUnit
Tests Failed: In file: C:\My
Code\OASISServiceDatabaseUnitTest\test\first.xml,
tests: 1, failures: 1, errors = 0
[sqlunit] net.sourceforge.sqlunit.SQLUnitException:
SQLUnit Tests Failed: In file: C:\My
Code\OASISServiceDatabaseUnitTest\test\first.xml,
tests: 1, failures: 1, errors = 0
[sqlunit] at
net.sourceforge.sqlunit.SQLUnit.testWrapper
(SQLUnit.java:245)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.runTest
(SQLUnit.java:220)
[sqlunit] at
net.sourceforge.sqlunit.ant.SqlunitTask.execute
(SqlunitTask.java:115)
[sqlunit] at
org.apache.tools.ant.UnknownElement.execute
(UnknownElement.java:275)
[sqlunit] at org.apache.tools.ant.Task.perform
(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute
(Target.java:341)
[sqlunit] at
org.apache.tools.ant.Target.performTasks
(Target.java:369)
[sqlunit] at
org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216)
[sqlunit] at
org.apache.tools.ant.Project.executeTarget
(Project.java:1185)
[sqlunit] at
org.apache.tools.ant.helper.DefaultExecutor.executeTar
gets(DefaultExecutor.java:40)
[sqlunit] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultE
xecutor.executeTargets(EclipseDefaultExecutor.java:32)
[sqlunit] at
org.apache.tools.ant.Project.executeTargets
(Project.java:1068)
[sqlunit] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunn
er.run(InternalAntRunner.java:423)
[sqlunit] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunn
er.main(InternalAntRunner.java:137)
[sqlunit] Caused by:
net.sourceforge.sqlunit.SQLUnitException:
org.jdom.Element.addContent(Lorg/jdom/Element;)
Lorg/jdom/Element;
[sqlunit] at
net.sourceforge.sqlunit.Assertions.invokeAssertion
(Assertions.java:832)
[sqlunit] at
net.sourceforge.sqlunit.Assertions.assertIsTrue
(Assertions.java:120)
[sqlunit] at
net.sourceforge.sqlunit.handlers.TestHandler.process
(TestHandler.java:234)
[sqlunit] at
net.sourceforge.sqlunit.SQLUnit.processDoc
(SQLUnit.java:327)
[sqlunit] at
net.sourceforge.sqlunit.SQLUnit.testWrapper
(SQLUnit.java:243)
[sqlunit] ... 13 more
[sqlunit] Caused by:
net.sourceforge.sqlunit.SQLUnitException:
org.jdom.Element.addContent(Lorg/jdom/Element;)
Lorg/jdom/Element;
[sqlunit] at
net.sourceforge.sqlunit.Assertions.invokeAssertion
(Assertions.java:832)
[sqlunit] at
net.sourceforge.sqlunit.Assertions.assertIsTrue
(Assertions.java:120)
[sqlunit] at
net.sourceforge.sqlunit.Assertions.assertEqual
(Assertions.java:195)
[sqlunit] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[sqlunit] at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
[sqlunit] at
sun.reflect.DelegatingMethodAccessorImpl.invoke
(Unknown Source)
[sqlunit] at java.lang.reflect.Method.invoke
(Unknown Source)
[sqlunit] at
net.sourceforge.sqlunit.Assertions.invokeAssertion
(Assertions.java:829)
[sqlunit] ... 17 more
[sqlunit] Caused by: java.lang.NoSuchMethodError:
org.jdom.Element.addContent(Lorg/jdom/Element;)
Lorg/jdom/Element;
[sqlunit] at
net.sourceforge.sqlunit.beans.Row.toElement
(Row.java:160)
[sqlunit] at
net.sourceforge.sqlunit.beans.ResultSetBean.toElement
(ResultSetBean.java:265)
[sqlunit] at
net.sourceforge.sqlunit.beans.DatabaseResult.toElement
(DatabaseResult.java:242)
[sqlunit] at
net.sourceforge.sqlunit.beans.DatabaseResult.toString
(DatabaseResult.java:255)
[sqlunit] at
net.sourceforge.sqlunit.Assertions.subAssertResultSets
Equal(Assertions.java:990)
[sqlunit] at
net.sourceforge.sqlunit.Assertions.assertResultSetsEqu
al(Assertions.java:464)
[sqlunit] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[sqlunit] at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
[sqlunit] at
sun.reflect.DelegatingMethodAccessorImpl.invoke
(Unknown Source)
[sqlunit] at java.lang.reflect.Method.invoke
(Unknown Source)
[sqlunit] at
net.sourceforge.sqlunit.Assertions.invokeAssertion
(Assertions.java:829)
[sqlunit] ... 24 more
[sqlunit] sqlunit-ant: SQLUnit Tests Failed: In
file: C:\My
Code\OASISServiceDatabaseUnitTest\test\first.xml,
tests: 1, failures: 1, errors = 0
[sqlunit] net.sourceforge.sqlunit.SQLUnitException:
One or more SQLUnit Tests failed, see the console for
details
[sqlunit] at
net.sourceforge.sqlunit.ant.SqlunitTask.execute
(SqlunitTask.java:132)
[sqlunit] at
org.apache.tools.ant.UnknownElement.execute
(UnknownElement.java:275)
[sqlunit] at org.apache.tools.ant.Task.perform
(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute
(Target.java:341)
[sqlunit] at
org.apache.tools.ant.Target.performTasks
(Target.java:369)
[sqlunit] at
org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216)
[sqlunit] at
org.apache.tools.ant.Project.executeTarget
(Project.java:1185)
[sqlunit] at
org.apache.tools.ant.helper.DefaultExecutor.executeTar
gets(DefaultExecutor.java:40)
[sqlunit] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultE
xecutor.executeTargets(EclipseDefaultExecutor.java:32)
[sqlunit] at
org.apache.tools.ant.Project.executeTargets
(Project.java:1068)
[sqlunit] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunn
er.run(InternalAntRunner.java:423)
[sqlunit] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunn
er.main(InternalAntRunner.java:137)
[sqlunit] One or more SQLUnit Tests failed, see the
console for details
Logged In: NO
I recompiled the sqlunit-5.0.jar using the build.xml included in the release, against jdom 1.1, and this problem went away...