Unit test failure & Exception handling

2 views
Skip to first unread message

Ashok

unread,
Apr 17, 2009, 4:27:47 AM4/17/09
to akomantoso-dev
Hi Luca,

1) I am getting a unit test failure on OATranslatorTest with the
following exceptions : see stacktrace [1] and [2]

2) Unit tests - Currently the only unit tests are for the main
OATranslator API ... I would suggest a few more Unit tests for some of
the other API classes in the system to allow more granular testing.

3) Exception handling -- currently there is not much exception
handling in the translator .. most exceptions are thrown to the
calling API ... which in some cases nests down multiple levels ... so
in the end we have a parent API function which throws multiple kinds
of exceptions including a generic checked Exception. This makes it
very difficult to debug or trace problems in the library since there
is no local exception handling.

I would suggest the following --
-- Add exception logging with log4j - as currently the catch() blocks
simply do a ex.printStackTrace() which isnt very helpful.
-- Add localized exception handling and logging for checked exceptions
and exceptions related to the semantics of that particular API (e.g.
it doesnt make sense for some internal xml parsing function to throw a
validation exception up the chain when the parent calling API isnt
anything to do with validation...)

I am happy to add the log4j support to the translator APIs since it
allows me to test things faster.

Ashok


Stacktraces ::

[1]

java.lang.NullPointerException
at
org.un.bungeni.translators.utility.schemavalidator.SchemaValidator.validate
(SchemaValidator.java:85)
at
org.un.bungeni.translators.odttoakn.translator.OATranslator.translate
(OATranslator.java:124)
at translatortest.OATranslatorTest.testTranslate
(OATranslatorTest.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody
(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected
(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected
(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod
(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run
(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod
(TestClassMethodsRunner.java:66)
at org.junit.internal.runners.TestClassMethodsRunner.run
(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected
(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected
(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run
(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run
(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run
(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
(RemoteTestRunner.java:196)


[2]

java.util.MissingResourceException: Can't find bundle for base name
org.un.bungeni.translators.localization.Messages, locale en_US
at java.util.ResourceBundle.throwMissingResourceException
(ResourceBundle.java:836)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:549)
at
org.un.bungeni.translators.utility.exceptionmanager.ExceptionManager.<init>
(ExceptionManager.java:50)
at
org.un.bungeni.translators.utility.exceptionmanager.ExceptionManager.getInstance
(ExceptionManager.java:65)
at
org.un.bungeni.translators.utility.schemavalidator.SchemaValidator.validate
(SchemaValidator.java:85)
at
org.un.bungeni.translators.odttoakn.translator.OATranslator.translate
(OATranslator.java:124)
at translatortest.OATranslatorTest.testTranslate
(OATranslatorTest.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody
(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected
(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected
(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod
(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run
(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod
(TestClassMethodsRunner.java:66)
at org.junit.internal.runners.TestClassMethodsRunner.run
(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected
(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected
(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run
(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run
(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run
(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
(RemoteTestRunner.java:196)

Luca Cervone

unread,
Apr 17, 2009, 5:48:26 AM4/17/09
to akomant...@googlegroups.com
Dear Ashok,
I'll resolve all the issues below during the week end.

Ciao
Luca
Luca Cervone
Web and XML solutions designer

e-mail:     cervo...@gmail.com

mobile phone:    0039 348 26 27 545
home   phone:  0039 051 199 82 854

skype:   cervoneluca



Luca Cervone

unread,
Apr 20, 2009, 8:39:22 AM4/20/09
to akomant...@googlegroups.com
Dear Ashok, 
Please checkout the new version of the translator and let me know if now it is better. 

Ciao
Luca
Reply all
Reply to author
Forward
0 new messages