File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception when using setup() in a junit testcase

 
Kamal Ahmed
Ranch Hand
Posts: 91
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 194
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic