JUnit @Rule to pass parameter to test

Posted by 01 on Stack Overflow See other posts from Stack Overflow or by 01
Published on 2010-06-17T10:01:19Z Indexed on 2010/06/17 10:03 UTC
Read the original article Hit count: 194

Filed under:
|
|
|

I'd like to create rule to be able to do something like this

@Test public void testValidationDefault(int i) throws Throwable {..}

Where i is parameter passed to the test by @Rule.

However I do get

java.lang.Exception: Method testValidationDefault should have no parameters

is there any way to bypass it and set the i parameter in the @Rule?

© Stack Overflow or respective owner

Related posts about java

Related posts about parameters