In my Spring Boot Application I have below class -
@Component
public class A {
private B<String, String> b;
@Autowired
public A(B b){
this.b = b;
}
public void someMethod(){
}
}
I am trying to Autowire class A in junit as below but I am always getting null for class A.
@RunWith(SpringRunner.class)
@SpringBootTest
public class TestForA {
@Autowired
private A a; // NullPointer
}
Can someone help me how to Autowire in junit. I don't want to use Mock or Mockito framework, I want to test with real classes.