Hey Eric,
I have prototyped a few tests using Mockito and enjoy its ease-of-use
and functionality. However, like Paul's ScalaMock, is there any
ability, or planned implementation, for mocking Scala objects. It may
be my current naivety with the product, but it seems that the mocking
is limited to classes and traits.
Thanks,
Ryan
On Mar 6, 1:59 am, etorreborre <
etorrebo...@gmail.com> wrote:
> Hi Jon, Mirco,
>
> You can have a look at the latest specs2 1.9-SNAPSHOT.
>
> I've added some support for:
>
> - byname parameters
> - functions/partial functions parameters verification<
http://etorreborre.github.com/specs2/guide-SNAPSHOT/org.specs2.guide....> (Jon,
> please note that the updated Mockito doc is on the specs2 project now)
>
> Jon, I also tested the following with specs2 and it works fine for me:
>
> *import org.specs2.mutable.Specification*
> *import org.specs2.mock.Mockito*
>
> *class TestSpec extends Specification with Mockito {*
> * val m = mock[ToMock]*
> *
> *
> * "try that" >> {*
> * m.amount returns 3*
> * m.amount === 3*
> * }*
> *}*
> *
> *
> *trait ToMock {*
> * lazy val amount: Int = 0*
> * def fn(arg1: =>String): Any*
> *}*
>
> I don't claim that specs2/Mockito is "offering complete mocking for Scala"
> but it's nice to see that it can be pushed that far. Please test the
> SNAPSHOT and report any issue (I wouldn't be surprised to see some corner
> cases coming up) or feature requests.
>
> Thanks,
>
> Eric.
>
>
>
>
>
>
>
> On Tuesday, March 6, 2012 9:57:00 AM UTC+11, Jon wrote:
>
> > Hi Eric,
>
> > We only dabbled in Mockito.
>
> > We stumbled into this issue on ScalaMock, basically part of a more general
> > problem that ScalaMock needs to mock the entire class hierarchy and Traits:
> >
https://github.com/paulbutcher/ScalaMock/issues/3
> > TDD shops need richer support for mocking in Scala at least than ScalaMock
> > has right now.
>
> > How close do you feel Mockito is to offering complete mocking for Scala?
> > What is Mockito for Scala missing? Is this the best documentation
> > regarding?
http://code.google.com/p/specs/wiki/UsingMockito
>
> > Thanks,
> > Jon
>
> > On Mon, Mar 5, 2012 at 5:34 PM, etorreborre <
etorrebo...@gmail.com> wrote:
>
> >> Hi Jon,
>
> >> I'm currently working on a solution to help with mocking of byname
> >> arguments with Mockito. There might also be a way to deal with functions like
> >> that<
https://groups.google.com/forum/#!msg/specs2-users/R3DS_ZPe29w/WvmkfJ...>
> >> .