juan_gandhi: (VP)
Juan-Carlos Gandhi ([personal profile] juan_gandhi) wrote2014-02-12 01:27 pm
Entry tags:

mocking in Scala

Now, say, I have a class class ParseBCBSofTX(val be: BrowsingExec, pat_ins: Patient_ins)

and I want to run my tests without having to talk to any database.

Here's what I write in my unittest:
  lazy val mockParser = new ParseBCBSofTX(null, pi) with MockDB { thisParser => /*overriding some methods*/


I do override stuff, but actually all I need to get rid of actual db is this: with MockDB

That's it.

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting