• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

test won't go through try block in gui

 
Dan Maples
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written a test with a try and catch. When tested with the Text version of junit it runs perfectly. When tested with the gui version of junit, the try block never try's, and it always goes to the catch statment. I don't see what the difference is. I have had problems similar to this before (differences between text and gui results) and I am wondering if there is something wrong with the way my system is set up or something along those lines. Any help is greatly appriciated, thanks in advance -Dan

This calls on getcost(string,int) which returns string.length()*int;

[ June 28, 2004: Message edited by: dan maples ]
 
Jeff Langr
author
Ranch Hand
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try clicking off the checkbox that says "Reload classes every run" (which requires JUnit to use its own custom classloader).

-j-
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would probably help if you told us what exception you do get...

Also take a look at the FAQ: http://junit.sourceforge.net/doc/faq/faq.htm#running_8
 
Dan Maples
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help guys, the server that this calls on is down today, I will try again as soon as it comes up. When it does I will try unclicking the checkbox and if that doesn't work I will copy down the error and post it. Thanks-Dan
 
Dan Maples
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff unchecking the box worked!, the test passed. What is the difference between having the box checked or unchecked, I don't understand how that effects the try/catch blocks. Ilja- the exception that I was receiving was:

java.lang.ClassCastException
at weblogic.xml.schema.binding.internal.TypeMappingBase.addTypeMapping(T
ypeMappingBase.java:549)
at weblogic.xml.schema.binding.internal.TypeMappingBase.readXML(TypeMapp
ingBase.java:782)
at weblogic.xml.schema.binding.internal.TypeMappingBase.readXML(TypeMapp
ingBase.java:511)
at weblogic.webservice.core.encoding.DefaultRegistry.<init>(DefaultRegis
try.java:70)
at weblogic.webservice.core.rpc.ServiceImpl.<init>(ServiceImpl.java:72)
at weblogic.jws.proxies.CostAnalysisService_Impl.<init>(CostAnalysisServ
ice_Impl.java:23)
at weblogic.jws.proxies.CostAnalysisService_Impl.<init>(CostAnalysisServ
ice_Impl.java:17)
at CostTest.testSoapProxy(CostTest.java:9)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.swingui.TestRunner$16.run(TestRunner.java:623)

what does that mean? Thank you both again!
[ July 02, 2004: Message edited by: dan maples ]
 
Jeff Langr
author
Ranch Hand
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The checkbox allows JUnit to dynamically reload classes when they change. In order to do so, JUnit uses a custom classloader. This classloader can't deal with whatever dynamic classloading is going on in the rpc mechanism embedded in the code in the try block.

Or something like that.

-j-
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic