Announcing Borachio: Native Scala mocking

Borachio is now ScalaMock.

I’ve recently been working in my spare time on a native Scala mocking framework.

I now have something which, although far from “done”, is close enough that I think it should be useful. So I’d like to announce and solicit feedback on Borachio – a native Scala mocking framework:

Homepage: http://borachio.com/
GitHub: https://github.com/paulbutcher/borachio
Documentation: http://borachio.com/api/com/borachio/package.html

A couple of examples:

def testTurtle {
  val t = mock[Turtle]

  t expects 'penDown
  t expects 'turn withArgs (90.0)
  t expects 'forward withArgs (10.0)
  t expects 'getPosition returning (0.0, 10.0)

  drawLine(t)
}
def testFoldLeft() {
  val f = mockFunction[String, Int, String]

  f expects ("initial", 0) returning "intermediate one"
  f expects ("intermediate one", 1) returning "intermediate two"
  f expects ("intermediate two", 2) returning "intermediate three"
  f expects ("intermediate three", 3) returning "final"

  expect("final") { Seq(0, 1, 2, 3).foldLeft("initial")(f) }
}

1 Response to “Announcing Borachio: Native Scala mocking”



  1. 1 Mocking in Scala with Borachio step-by-step | Paul Butcher Trackback on February 27, 2011 at 1:55 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





Follow

Get every new post delivered to your Inbox.

Join 242 other followers

%d bloggers like this: