-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
equals method should not be overriden on interfaces #103
Comments
I propose that when we construct a proxy for interfaces or abstract classes, we only fixture abstract methods. Everything else should be forwarded to the existing (parent) classes. |
Only fixturing the abstract methods should not be hard. This can easily be reflected - maybe the Edit: yes, |
For interfaces I want to keep the |
The commits above should fix that. As a bonus, when concrete methods throw an exception, the caller will see it. |
(Will be closed as resolved with the next release.) |
- Bugfix: Sets can now contain more than one element (#102) - Bugfix: The `equals`-method will no longer be proxied for abstract specimen (#103) - Feature: Collections will now contain unique elements instead of a number of copies of the same instance - Experimental: Failures to fixture an object will now contain more information about what was attempted and what went wrong
Fixed since version 2.11.0. |
While working on a fix for #102 I noticed that the following test fails:
This fails for interfaces and abstract classes because we create a proxy that returns a random value for any called method.
You have to run it multiple times, because the result of
equals
is a random boolean, so for some created fixtures it's true, for others it's false.If we create random values for this, we violate the Java contract for
equals
andhashCode
. This might lead to unexpected behaviour.I believe this should be fixed before the fix for #102 can be merged.
The text was updated successfully, but these errors were encountered: