here are a couple of tips if you need when you implement a Junit Parameterized test with powermock:</p>

  • Use the @RunWith(Parameterized.class) annotation for your class</p>
  • Use the @PrepareForTest() annotation at the class level, not the method !
  • Add a Junit PowerMockRule : @Rule public PowerMockRule rule = new PowerMockRule();
  • If you get error with class loader,

... Caused by: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. ... Or an exception with java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl etc...

try to ignore the class where you get the error (or the one which is invoking SAXParserFactoryImpl, for instance): @PowerMockIgnore({"myapp.utils.addresses.*", "org.apache.commons.logging.*"}) etc.

Get more info here and here !