This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MongoDb Mocks

 
Geane Norm
Ranch Hand
Posts: 31
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic