Managed to get it working by making removing @EnableReactiveMongoRepositories
*/
@SpringBootApplication
// @EnableReactiveMongoRepositories
public class AriesApplication {
public static void main(String[] args) {
SpringApplication.run(AriesApplication.class, args);
}
}
and changing TestRepositoryConfig to
@TestConfiguration
@@EnableAutoConfiguration(exclude = { MongoReactiveRepositoriesAutoConfiguration.class })
public class RepositoryTestConfig {
private final User mockAuthor = new User(new ObjectId("6795b64f525959be00d07c0b"), "rbelmont", "Richter", "Belmont",
"[email protected]", false);
private final Post mockPost = new Post("how to gitgood part two", "you just have to grind 3 hours everyday",
mockAuthor.getUsername(), LocalDateTime.now(), LocalDateTime.now(), false, false);
@Bean
@Profile("mock")
public UserRepository userRepository() {
return mock(UserRepository.class);
}
@Bean
@Profile("mock")
public PostRepository postRepository() {
PostRepository postRepository = mock(PostRepository.class);
when(postRepository.save(any())).thenReturn(Mono.just(mockPost));
return postRepository;
}
}