• Post Reply Bookmark Topic Watch Topic
  • New Topic

MongoDb Mocks  RSS feed

 
Geane Norm
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have written a Groovy script that reads a set of XML files, convert them into JSON and import them into a MongoDB collection (via the MongoDB Java driver: https://docs.mongodb.org/ecosystem/drivers/java/).
I would like to unit test the connection to a local MongoDb instance and the retrieval of an existing db and collection. I am not sure which is the best way to go, but I have used Mocks (Mockito library) in the past and I wonder whether this is actually what I should be doing. Here is some experimental code:



What is your view? Am I heading to the right direction?

Thank you,

I.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!