Comments (8)
Hey,
Perhaps Mockito is too aggressive with this validation. The thing is that this code could break if you stub some of those methods. @bric3, thoughts?
Thanks for reporting! Can you update your code and add Serializable / default constructor?
from mockito.
I just experienced the same issue when I wanted to test our custom DSL API on my current project. I believe there was some issue sometime ago before we moved to github about serialization, it may relate to deep stubs.
from mockito.
https://code.google.com/p/mockito/issues/detail?id=399 right?
I don't really understand this validation - if I have no interest in my code being serializable nor serializing a mock/stub; why do I have to make it so (and add default constructors, allowing partially constructed objects) just to use deep stubs? Shouldn't I have to opt-in if I need/want my deep stubs to be serializable or am I missing something?
from mockito.
@szczepiq Hi, for one occurence I was able to implement a default constructor. For another occurence, it did not feel sensible to add a default constructor. I changed this and mocked all used method calls manually. For me it's ok now.
btw: Thank you very much for sharing and caring for mockito!
from mockito.
For some reason the deep stub code was enabling children stubs to be always serializable which doesn't make sense. In the plane I crafted a fix. I'll push it asap.
from mockito.
It should be fixed in 1.10.8
from mockito.
Excellent, thanks @bric3 ! Let me take this chance to add that Mockito is an excellent piece of software and a near-perfect mocking library IMO - all of your efforts are highly appreciated :) I was at a workshop with Michael Feathers recently and was asking him whether he planned to update his book Working Effectively with Legacy Code to reflect the invent of modern (non-strict!) mocking frameworks such as Mockito as in my opinion they have revolutionized dependency-breaking and bringing legacy code under test. No luck, but maybe someone should write a new updated such book :)
from mockito.
Hey,
1.10.8 was released to Bintray/jcenter. For some reason, maven central sync
didn't work :(
What do you think needs to be fixed so that mockito is perfect? :)
On Fri, Oct 10, 2014 at 5:33 AM, Chad [email protected] wrote:
Excellent, thanks @bric3 https://github.com/bric3 ! Let me take this
chance to add that Mockito is an excellent piece of software and a
near-perfect mocking library IMO - all of your efforts are highly
appreciated :) I was at a workshop with Michael Feathers recently and was
asking him whether he planned to update his book Working Effectively with
Legacy Code to reflect the invent of modern (non-strict!) mocking
frameworks such as Mockito as in my opinion they have revolutionized
dependency-breaking and bringing legacy code under test. No luck, but maybe
someone should write a new updated such book :)Reply to this email directly or view it on GitHub
#99 (comment).
Szczepan Faber
Core dev@gradle; Founder@mockito
from mockito.
Related Issues (20)
- Mockito is calling real function instead of calling mocked function
- Mockito bom missing artifact in maven central for java21 HOT 3
- Unable to @InjectMocks on instance of android.app.Activity HOT 1
- Mockito's deep-stub mocking doesn't do well when lambda arguments are involved
- Adding @MockitoSettings to field with @RegisterExtension makes test fail with PreconditionViolationException
- Adding @MockitoSettings to class changes order of extensions in @ExtendWith
- MockSettings.strictness() not observed HOT 2
- Mockito verify message not accurate if type is fields are of Object
- when does not throw MissingMethodInvocationException HOT 1
- Spy annotation does not seem to work after switching from Mockito 4.8.1 to 5.10.0 HOT 1
- `mockStatic` fails with `class redefinition failed: invalid class` HOT 5
- mockito
- Field with generics is not injected using @InjectMocks HOT 1
- Possible race condition HOT 3
- MissingMethodInvocationException is thrown when mocking native method in 5.x HOT 1
- ByteBuddy agent fails to install on GraalVM HOT 1
- Incorrect documentation for RETURNS_MOCKS HOT 3
- Mockito.only() points to the wanted call as unwanted if it is the first being called.
- Mockito vs EasyMock performance HOT 4
- @Mock and MockedConstruction
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.