I have a class defined in src/main/java:
Class A{
@Autowired
B b;
public void method1() {}
}
The corresponding test class is:
Class ATest {
A a;
@Test
public void method1Test() {}
}
B is null when ATest is unit tested. (run as junit test).
I only have spring-context library, and not spring boot application. Further, I have defined @ComponentScan(basePackage="com")
and class A is inside of the same package.
Please let me know how to unit test in this scenario.