My test class looks like:
@WebFluxTest(controllers = IndexContoller.class)
@Import(UserServiceImpl.class)
class IndexContollerTest {
private static final String PATH = "/";
private static final String ADD_USER = "/signup";
@MockBean
private UserRepo userRepo;
@Autowired
private WebTestClient webClient;
@Autowired
private ReactiveUserDetailsService userService;
@Test
void saveUser() throws Exception {
Mockito.when(userRepo.save(any())).thenReturn(Mono.just(new User()));
webClient.post()
.uri(ADD_USER)
.contentType(MediaType.APPLICATION_JSON)
.body(BodyInserters.fromObject(new User()))
.exchange()
.expectStatus()
.is2xxSuccessful();}
}
and after i ran it it falls with
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'skillGroupRepository' defined in com.gmail.qwertygoog.roadmap.repository.SkillGroupRepository defined in @EnableR2dbcRepositories declared on RoadmapApplication: Cannot resolve reference to bean 'r2dbcEntityTemplate' while setting bean property 'entityOperations'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'r2dbcEntityTemplate' available
Basically it searches for different service bean's dependency and falls after cant instantiate it.I also tried to add @SpringExtension withought any difference in output. Any suggestions?