I am trying to mock a service thats fetch data from redis.I have injected the beans in spring context in a new context file test-context.xml But I have other contexts files A.xml,B.xml which referes to methods in the beanS in test-context.xml.I read the question in enter link description here
It creates a BaseTest class but when i inherit the class my context file in child class gets loaded first instead it should load the context file of base class first as beans in child class contexts are dependent on base class context.
@ContextConfiguration(locations = { "/META-INF/spring/testContext.xml" })
public abstract class myBaseTest {
@Before
public void init() {
// custom initialization code for resources loaded by testContext.xml
}
@After
public void cleanup() {
// custom cleanup code for resources loaded by testContext.xml
}
}
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/META-INF/spring/A.xml",
"/META- INF/spring/B.xml" })
public class childTest extends myBaseTest { ... }