Code Monkey home page Code Monkey logo

Comments (8)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 27, 2024
Hi,

I wish this could be fixed. I think about it as a trade-off of elegant syntax.

Was the exception message any helpful for you to find the reason of the problem?

Original comment by [email protected] on 6 Nov 2008 at 9:36

from mockito.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 27, 2024
No, actually it took me quite a while to track down the issue.  Here is the 
exception
that I get:

org.mockito.exceptions.verification.WantedButNotInvoked: 
Wanted but not invoked:
testInterface.method2();

It seems like this problem could be fixed if you attached your MockingProgress 
object
to the actual mock object that the verification is done on (possibly with a 
map),
instead of keeping a static reference to it.  That way it would be lost when 
the test
is over, and not affect other tests. I don't know what all of the side effects 
of
this would be, but I almost always run into problems when I try to keep static 
data
while testing.

Original comment by [email protected] on 6 Nov 2008 at 9:16

from mockito.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 27, 2024
Oh, I see now. The exception is really confusing. Let me look at it.

Original comment by [email protected] on 6 Nov 2008 at 9:48

from mockito.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 27, 2024
I don't know how to fix it :( because in java there is no difference between:

verify(mock).foo();

and:

verify(mock);
mock.foo();

Do you have any ideas?

Original comment by [email protected] on 6 Nov 2008 at 11:00

from mockito.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 27, 2024
Is there something wrong with what I had suggested in Comment 2?  Other than 
that, I
can't think of anything that would allow you to keep the elegant syntax.

Original comment by [email protected] on 12 Nov 2008 at 9:35

from mockito.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 27, 2024
>That way it would be lost when the test is over, and not affect other tests.

I guess it wouldn't be lost unless I used weak references and system.gc() :)

I'm thinking of validating a state on mock creation. This means you would get 
much
better error message. I'll let you know when it's done.

Original comment by [email protected] on 12 Nov 2008 at 11:06

from mockito.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 27, 2024
Now, the state is validated on mock/spy creation so the exception message will 
be
much better. You might try it with the trunk version.

Fixed in trunk

Original comment by [email protected] on 12 Nov 2008 at 11:23

  • Changed state: Fixed

from mockito.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 27, 2024

Original comment by [email protected] on 14 Jan 2009 at 10:48

  • Added labels: Milestone-Release1.7

from mockito.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.