All tests in my test class execute a \'before\' method (annotated with JUnit\'s @Before
) before the execution of each test.
I need a particular test not
Consider using the @Enclosed
runner to allow you to have two inner test classes. One with the required @Before
method, the other without.
Enclosed
@RunWith(Enclosed.class)
public class Outer{
public static class Inner1{
@Before public void setup(){}
@Test public void test1(){}
}
public static class Inner2{
// include or not the setup
@Before public void setup2(){}
@Test public void test2(){}
}
}