News for hackers. Stuff that matters.
Re:On Scala's future by aschobel on Friday August 07, 2009 @08:58PM (#748810)
I can't comment on lift since we use scala with WebWork/struts2.

Testing with specs and mockit has been much easier for us than in the bad ole Java days.

  val m = mock[java.util.List[String]] // a concrete class would be mocked with: mock(new java.util.LinkedList[String])
  // stub a method call with a return value
  m.get(0) returns "one"

  // call the method
  m.get(0)

  // verify that the call happened, this is an expectation which will throw a FailureException if that is not the case
  m.get(0) was called

  // we can also check that another call did not occur
  m.get(1) wasnt called // or m.get(1) was notCalled
http://code.google.com/p/specs/wiki/UsingMockito

Being able to write a test like this seems like a pretty big win.

re: newcomer-unfriendly, the people I've spoken with all seem really excited about the language and want to share the love. shrug

There are no comments on this comment yet.