Reputation: 1254
I am using afMongo for accessing a Mongo DB from a Fantom web app and I'm wondering if it is possible to mock the MongoClient or the ConnectionManager so that the Test classes don't need a Mongo DB running.
Upvotes: 1
Views: 46
Reputation: 5139
The short answer is no.
The long answer is yes, but you need to write the mock yourself and it's quite low level.
Connection
is the thing to mock because it's a mixin. Internally, afMongo uses MockMongoConnection so you could try using / extending that.
Typical usage would be:
mmc = MockMongoConnection()
conMgr = ConnectionManagerLocal(mmc, ``)
mmc.reset.reply(...your map obj...)
You're probably better off wrapping your Mongo calls in your own DAO service and mocking that.
Upvotes: 1