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
One can also solve this by undoing what was done in @Before
setup inside test case.
This is how it may look,
@Before
public void setup() {
TestDataSetupClass.setupTestData();
}
@Test
public void testServiceWithIgnoreCommonSetup() {
TestDataSetupClass.unSet();
//Perform Test
}
There will be pros and cons for solutions here. Minor con for this is, unnecessary cycle of setting and un-setting step. But goes well if one needs to do it for only a test case out of hundreds and avoid overhead of writing self AOP or maintaining multiple inner test classes.