_From [email protected] on August 26, 2013 20:11:29_
What steps will reproduce the problem? 1.create any unit test with a setup() method, which create hadoop local file system
2.make dumb/empty test method, run the test make sure it pass
3.add @RunWith and @PrepareForTest at the top of the test What is the expected output? What do you see instead? test should still pass, but instead i got error message:
java.io.IOException: failure to login
at org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:490)
at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:452)
at org.apache.hadoop.fs.FileSystem$Cache$Key.
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1395)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:254)
at org.apache.hadoop.fs.FileSystem.getLocal(FileSystem.java:225) What version of the product are you using? On what operating system? powermock-module-junit4 1.5.1
powermock-api-mockito 1.5.1
mockito-core 1.9.5-rc1
Mac OS X 10.8.4 Please provide any additional information below. please see the attached sample code
Attachment: TestExample.java
_Original issue: http://code.google.com/p/powermock/issues/detail?id=455_
_From [email protected] on August 26, 2013 11:20:22_
also found a url about a similar issue, not sure if it helps: https://groups.google.com/a/cloudera.org/forum/#!msg/cdh-user/GpwgXf_tKv4/w6oZiBXb4McJ
_From [email protected] on September 12, 2013 15:53:18_
I had a similar issue. You can try telling PowerMock to defer the classloading
of specific packages to the system classloader
I was only interested in having PowerMock mock my own packages, so I ignore the others like this:
@PowerMockIgnore({"javax.management_", "javax.xml._", "org.w3c._", "org.apache.apache._", "com.sun.*"})
_From [email protected] on January 21, 2014 13:42:50_
Just tried this with Powermock 1.5.3 and the test passes for me.
Most helpful comment
_From [email protected] on September 12, 2013 15:53:18_
I had a similar issue. You can try telling PowerMock to defer the classloading
of specific packages to the system classloader
I was only interested in having PowerMock mock my own packages, so I ignore the others like this:
@PowerMockIgnore({"javax.management_", "javax.xml._", "org.w3c._", "org.apache.apache._", "com.sun.*"})