|
Re: Eclipse/JUnit null pointer error [message #168998 is a reply to message #168980] |
Fri, 16 July 2004 07:27  |
Eclipse User |
|
|
|
Originally posted by: kk_oop.yahoo.com
Ken wrote:
> Hi.
> I saw an interesting article about making Mock Objects for JUnit. I tried
> it out in Eclipse and I got a null pointer error. Could someone take a
> look at or try running the code to see if this is a problem with the way
> Eclipse is running JUnit? The code is in the article at:
> http://www-106.ibm.com/developerworks/library/j-mocktest.htm l
> It's in listings 4, 5 and 6.
> Thanks for any input!
> Ken
Hi. I'm answering my own post again :).
As it turns out, when I was trying to instantiate the mock object in my
constructor. So, if you looked at the article, in listing 4, I had the
line:
Transaction transaction = createTransaction();
in my production class' constructor. I see now in the listing, they have
it outside the constructor in one of the production class' methods. Works
fine if I do it that way.
Thanks,
Ken
|
|
|
Powered by
FUDForum. Page generated in 0.03008 seconds