title: JUnit 4's @Suite, passing data, @Rule and deprecating @Before and @After
body: <p>I'm working with some legacy test code which makes use of a TestSetup class to setup and teardown a server around a test suite of classes containing tests. I've converted the classes to use junit annotations and have attempted to use the @Suite and @Suite.Classes annotations to define the suite. But I've hit a wall. </p>
  
  <p>The old version of the tests extend TestSetup to loop through all the instantiated test classes and inject various references to server objects into them. An example being a reference to the Spring framework web context.</p>
  
  <p>My problem is that using the annotations I cannot see how to pass fixture data to the instantiated test classes before the tests are executed.</p>
  
  <p>I've looked into the new @Rule and MethodRule techniques, but (frankly) they just appear to be a complex, but limited solution to a problem that's not really clear. Anyway, I could not see how they could solve my problem. An additional concern being that it would appear that the JUnit authors are intent on eventually removing the @Before/@After concept from JUnit.</p>
  
  <p>So does anyone know how to pass data from a class annotated with @Suite to each test that the Suite class runs?</p>