Thoppan / powermock

Automatically exported from code.google.com/p/powermock
Apache License 2.0
0 stars 0 forks source link

TestNG PowerMockObjectFactory and Thread's contextClassLoader #315

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The PowerMockRunner class sets the current's thread contextClassLoader with the 
mock'd classloader, this is not done in TestNG PowerMockObjectFactory.  
Consequently if there is dependent classes that are using reflection by pulling 
the contextClassLoader from the current thread, it has class cast exception 
issues.  

I ran accross the issue trying to use Drools with TestNG + PowerMock.  Simply 
ignoring the drools packages keeps the rules it runs to properly recognize the 
classes.

I've attached a patch that will set the thread accordingly.

Original issue reported on code.google.com by mathos.m...@gmail.com on 10 Mar 2011 at 6:16

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry for taking so long to reply. I've applied your patch and committed the 
result to trunk (r1592). Thanks for the patch!

Original comment by johan.ha...@gmail.com on 5 Apr 2011 at 6:45