aspose file tools*
The moose likes Testing and the fly likes Exception when using setup() in a junit testcase Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Exception when using setup() in a junit testcase" Watch "Exception when using setup() in a junit testcase" New topic
Author

Exception when using setup() in a junit testcase

Kamal Ahmed
Ranch Hand

Joined: Feb 15, 2005
Posts: 91
Hi List,

I have a rather basic question regarding junit/eclipse.

When I run the following class as a junit test in eclipse, it works ok


But when I have a setup method, like:

I get exception:



You have any ideas?

Thanks,

-Kamal.


(EDIT: edited the post to use UBB code tags)
[ January 24, 2006: Message edited by: Lasse Koskela ]
Eric Nielsen
Ranch Hand

Joined: Dec 14, 2004
Posts: 194
You have to use setUp() not setup() as the method name. With your current name, the test runner code isn't calling the test fixture initialization code and therefore you get the null pointer exception.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception when using setup() in a junit testcase