0

Currently, we are using real MongoDB server for integration testing and it's connection configurations are defined in .yml file as follows:

mongodb:
replica_set: ip/port,ip/port
dbname: mydb
username: abc
password: abc@123

Now we want to use below dependency for embedded MongoDB to mock MongoDB to perform integration testing.

<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>1.50.5</version>
</dependency>

How to define embedded MongoDB connection configurations in .yml file? Any help is really appreciated.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117
Awadesh
  • 3,530
  • 2
  • 20
  • 32
  • create `application-test.yml` file and place all those properties into that file – Ryuzaki L Jul 26 '19 at 04:00
  • Yes I am doing that only, but do not know what will be the values for replica_set, dbname, username, the password for embedded MongoDB – Awadesh Jul 26 '19 at 04:02
  • https://stackoverflow.com/questions/48039644/how-to-make-the-junit-tests-use-the-embedded-mongodb-in-a-springboot-application – Ryuzaki L Jul 26 '19 at 04:41
  • https://stackoverflow.com/questions/31568351/how-do-you-configure-embedded-mongdb-for-integration-testing-in-a-spring-boot-ap – Ryuzaki L Jul 26 '19 at 04:41

0 Answers0