As I’m constructing a JUnit test case for a Spring Boot application, I keep getting an error saying that the test case cannot find any beans with entityManagerFatory and cannot create a repository.
error message below:-
Error creating bean with name ‘customerReportDistributionRepository’ defined in com.mastercard.eservice.eventframework.oracleConfig.CustomerReportDistributionRepository defined in @EnableJpaRepositories declared on CustomerReportDistributionConfigConsumerTest: Cannot create inner bean ‘(inner bean)#4db4431b’ of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property ‘entityManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘(inner bean)#4db4431b’: Cannot resolve reference to bean ‘entityManagerFactory’ while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘entityManagerFactory’ available
Please check the test case and code structure