Junit Parameterized tests together with Powermock - how!?

Posted by Subtwo on Stack Overflow See other posts from Stack Overflow or by Subtwo
Published on 2010-03-16T13:03:14Z Indexed on 2010/03/16 13:06 UTC
Read the original article Hit count: 303

Filed under:
|
|

Hi!

I've been trying to figure out how to run parameterized tests in Junit4 together with PowerMock. The problem is that to use PowerMock you need to decorate your test class with

@RunWith(PowerMock.class)

and to use parameterized tests you have to decorate with

@RunWith(Parameterized.class)

From what I can see they seem mutually excluded!? Is this true? Is there any way around this? I've tried to create a parameterized class within a class running with PowerMock; something like this:

@RunWith(PowerMock.class)
class MyTestClass {
     @RunWith(Parameterized.class)
     class ParamTestClass {
          // Yadayada
     }
}

But unfortunately this doesn't do much good... The ParamTestClass still doesn't run with PowerMock support (not that surprisingly maybe)... And I've kind of run out of ideas so any help is greatly appreciated!

© Stack Overflow or respective owner

Related posts about junit

Related posts about powermock