• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JUnit giving null pointer exception but temp variable fixes exception

 
Gulshan Singh
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The relevant code is:


All variables used have been initialized; that's not the problem.
This test gives me a null pointer exception at the first verify line:


But this test works:


Why does the second test work?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33716
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you already got an answer on StackOverflow. Cross posting is fine although we do recommend you link between the posts so people know when it has been answered.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic