Unit testing MongoIterable in java async driver

42 views
Skip to first unread message

Rohit Jain

unread,
Feb 6, 2018, 12:11:09 PM2/6/18
to mongodb-user
I am looking for ways to unit test java async MongoIterable. Is there a way I could mock response back from mongo before any action(forEach() etc) is invoked on it via iterator ?

Ross Lawley

unread,
Feb 9, 2018, 5:12:09 AM2/9/18
to mongod...@googlegroups.com
Hi Rohit,

As MongoIterable is an interface you should be able to Mock / Stub it easily.  It really depends on how your code is organised as to what is the best strategy for your code base and how best to test.

I can't provide anymore definitive advice than that, without knowing more about what you are trying to achieve and how your code is organised.

Ross

On Tue, Feb 6, 2018 at 5:11 PM, Rohit Jain <rohi...@gmail.com> wrote:
I am looking for ways to unit test java async MongoIterable. Is there a way I could mock response back from mongo before any action(forEach() etc) is invoked on it via iterator ?

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/e543901c-f862-44e7-bc65-83f9260b3d13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--


{ name     : "Ross Lawley",
  title    : "Senior Software Engineer",
  location : "London, UK",
  twitter  : ["@RossC0", "@MongoDB"],
  facebook :"MongoDB"}

Reply all
Reply to author
Forward
0 new messages