Skip to content

Concrete Change classes: implement structural equality #384

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

Closed
mfulton26 opened this issue Jun 10, 2016 · 2 comments
Closed

Concrete Change classes: implement structural equality #384

mfulton26 opened this issue Jun 10, 2016 · 2 comments

Comments

@mfulton26
Copy link
Contributor

I'm using JaVers to compare two objects in a test. I have some expected changes that I want to remove from the list of changes but ValueChange et. al. do not override the default hashCode/equals so I can't use convenient List methods like in change.removeAll(expectedChanges) after which I would assert that the list of changes is empty.

I took a look at ValueChange and some other concrete Change classes and from what I can tell GlobalId, Atomic, etc. all override the default hashCode/equals.

Can ValueChange et. al. be updated to also support structural equality instead of referential equality (default hashCode/equals)?

@bartoszwalacik
Copy link
Member

I think ValueChange could implement equals and hashcode based on left and right values. Diff and all its child objects have to remain immutable. You can came up with a PR if you want.

@bartoszwalacik
Copy link
Member

released in 2.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants