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.
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?