You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a class (EntityUnderTest) which has only one property.
If I initalize this object at either in the constructor of the EntityUnderTest or direct at declaration I'll get an NotEqualEqualsAssertionError error.
If a remove the inilization the test passes.
Here is the EntityUnderTest
public class EntityUnderTest
private ChildEntity faultInjectionParameters = new ChildEntity();
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EntityUnderTest that = (EntityUnderTest) o;
return Objects.equals(faultInjectionParameters, that.faultInjectionParameters);
}
@Override
public int hashCode() {
return Objects.hash(faultInjectionParameters);
}
And the child entity
public class ChildEntity {
private String string;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ChildEntity that = (ChildEntity) o;
return Objects.equals(string, that.string);
}
@Override
public int hashCode() {
return Objects.hash(string);
}
}
Version: 0.7.6
I have a class (
EntityUnderTest
) which has only one property.If I initalize this object at either in the constructor of the
EntityUnderTest
or direct at declaration I'll get an NotEqualEqualsAssertionError error.If a remove the inilization the test passes.
Here is the
EntityUnderTest
And the child entity
I also added a short reprocuder here: https://github.com/jacobhampel/pojoTestReproducer
The error message says:
But the hashCode returns both the same value. So, I would expect that the test will pass.
The text was updated successfully, but these errors were encountered: