I have a spring based (no springboot) application inside which I have a class as below:
public class MyClass {
private static final ApplicationContext context = new AnnotationConfigApplicationContext(AppContext.class);
MyClass (){
//get the beans from the applicationcontext that myClass is dependent on
}
//class methods
}
I am trying to unit test MyClass class , but I am unable to mock the context that is loaded here -
private static final ApplicationContext context = new
AnnotationConfigApplicationContext(AppContext.class);
Please help me here!!!