Comments (8)
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.
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.
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.
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.
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.
>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.
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.
Original comment by [email protected]
on 14 Jan 2009 at 10:48
- Added labels: Milestone-Release1.7
from mockito.
Related Issues (20)
- NPE on verification when multiple threads used HOT 4
- New spying feature HOT 9
- allow stubbing with callbacks HOT 4
- Want to extend Mockito class to include my own matchers HOT 3
- Arguments are saved by a reference HOT 4
- PATCH : Performance Enhancement for MockHandler : Search matchers once instead of twice HOT 7
- ArrayEquals throws exception HOT 4
- @Mock annotation does not work very well with Eclipse and IDEA HOT 3
- when arguments are different the exception now allows using the comparison window HOT 2
- add junit runners that automaticaly initialize mocks annotated with @Mock HOT 2
- interaction gets remembered between tests HOT 13
- Can't stub spied object HOT 5
- Javadocs don't tell all the truth about Mockito spies HOT 3
- InOrder.verify() displays the actual invocation on error when arguments are different HOT 19
- verify throws an IllegalArgumentException for overloaded method where array argument is incorrect HOT 4
- make spy working with Anonymous classes HOT 36
- Checking the method calls ordering in multi-thread environment. HOT 7
- Varargs stubbing produces incorrect behavior HOT 3
- Upload mockito to the Central Repository
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mockito.