aspose file tools*
The moose likes Testing and the fly likes  powermock : ProcessBuilder redirectErrorStream giving nullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark " powermock : ProcessBuilder redirectErrorStream giving nullPointerException" Watch " powermock : ProcessBuilder redirectErrorStream giving nullPointerException" New topic
Author

powermock : ProcessBuilder redirectErrorStream giving nullPointerException

Kaustubh Patil
Ranch Hand

Joined: Aug 13, 2001
Posts: 164
I am using powermock to mock some native command invocation using process builder. the strange thing is these test pass sometimes and fail sometimes giving a NPE. Is this a powermock issue or some gotcha in the program.

the snippet of the class under test is..

and the unit test case is ..

I get an error on execution an the test case fails..


Note : I do not get this error on all executions. Sometimes it passes and sometimes it fails. I am not able to understand this behavior.
Also, I have camouflaged some variable names because of the copyright issues.. Please bear !!




Kaustubh. Mumbai, India.
Kaustubh Patil
Ranch Hand

Joined: Aug 13, 2001
Posts: 164
Experts ?? any clues why is this happening ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: powermock : ProcessBuilder redirectErrorStream giving nullPointerException
 
Similar Threads
Mocking final class with Powermock + Easymock + testNG
Help: problem with EasyMock
Catching InputStream from Runtime/Process
PowerMock: StackOverFlow
Problem creating mock using PowerMock