In my Test class, I am trying to send a request to an API and compare the results with the ones that are sent from Springboot using elastic search data.
I am able to send the request via WebClient. However, the Service and Repository objects are always null. Any help would be great. Thanks
@RunWith(SpringRunner.class)
class MyTest {
    
      @Autowired
      private ESService esService; //this is null
      @Autowired
      private OtherRepository otherRepo; //this is null
      @Test
      private void testFunction(){
          TestObject Object = esService.doSomething();
          double value = new TestObject(otherRepo).getValue();
   }
}
    @Service
    public interface ESService{
        TestObject doSomething();
    }
@Service
public class ESServiceImpl implements ESService{
    
        @Autowired
        private ESRepository esRepository;
        
        TestObject doSomething(){
          return esRepository.doSomething();
      }
}
@Repository
public interface ESRepository extends ElasticsearchRepository<QueryResponse, String>, ESRepositoryCustom {
}
pom.xml
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>5.8.2</version>
    <scope>test</scope>
</dependency>
 
    