Du kan deaktivere Spring Boots automatiske konfiguration af MongoDB ved at tilføje følgende annotation til dine ApplicationTests klasse:
@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class, MongoDataAutoConfiguration.class})
Dette vil forhindre Spring Boot i at oprette MongoClient (forudsat at der ikke er nogen andre klasser i din testkontekst kommenteret med @EnableAutoConfiguration eller @SpringBootApplication ).