junit4
junit4 copied to clipboard
Create a Rule-like structure that can replicate the behavior of Parameterized without using a custom runner
Highly speculative at this point.
A good start: http://blog.schauderhaft.de/2012/12/16/writing-parameterized-tests-with-junit-rules/
This pattern works well, but changes a fundamental aspect of JUnit tests. Typically, each test gets a fresh instantiation of the test object, but this iterates the parameterized test over the same test object. If your test object uses any state (class member variables), it could affect the outcome of the tests. Would this be categorized as bad design for a test class (for having state), or should the rule be redesigned to construct a new test object for each test invocation?