This page is no longer maintained — Please continue to the home page at www.scala-lang.org

"Power" mocking in Scala

No replies
paulbutcher
Joined: 2010-03-08,
User offline. Last seen 10 weeks 5 days ago.

Over the last few weeks, I’ve been working on major enhancements for Borachio (my native mocking library for Scala) to add facilities similar to those provided byPowerMock for Java. As well as interfaces and functions, it can now mock:

- Classes
- Final classes and classes with final methods
- Classes with private constructors
- Singleton (companion) objects
- Object creation (i.e. new)

And, as an extra bonus, mocks are now typesafe :-)

It’s not completely finished yet, but it is close enough that it’s worth soliciting feedback.

There's a writeup on my blog here:

http://www.paulbutcher.com/2011/07/power-mocking-in-scala-with-borachio/

I hope that it's complete enough to be useful. Certainly it’s complete enough that I’d welcome feedback on anything that doesn’t work or could be done better. I'd be particularly interested in feedback from anyone who's familiar with compiler internals or compiler plugins to point out things I could be doing better in the plugin.

--
paul.butcher->msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: paul [at] paulbutcher [dot] com
AIM: paulrabutcher
Skype: paulrabutcher

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland