Skip to content

Commit

Permalink
936: Changes after review.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-qlogic committed Feb 13, 2019
1 parent 20daa8f commit fbc0256
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,11 @@ public final void setUnknownKeys(Map<String, Object> unknownFields) {

@Override
public boolean equals(Object o) {
if (o == this) {
return true;
if (!(o instanceof GenericData)) {
return false;
}
if (o instanceof GenericData) {
GenericData that = (GenericData) o;
return super.equals(that) && Objects.equals(this.classInfo, that.classInfo);
}
return false;
GenericData that = (GenericData) o;
return super.equals(that) && Objects.equals(this.classInfo, that.classInfo);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public void testEquals_Symmetric() {
GenericData actual = new GenericData1();
actual.set("fieldA", "bar");
GenericData expected = new GenericData2();
// Test that objects are equal
// Test that objects are equal.
expected.set("fieldA", "bar");
assertNotSame(expected, actual);
assertTrue(expected.equals(expected) && actual.equals(actual));
// Test that objects not are equal
// Test that objects not are equal.
expected.set("fieldA", "far");
assertFalse(expected.equals(actual) || actual.equals(expected));
assertFalse(expected.hashCode() == actual.hashCode());
Expand All @@ -84,7 +84,7 @@ public void testEquals_SymmetricWithSameClass() {
GenericData actual = new MyData();
actual.set("fieldA", "bar");
GenericData expected = new MyData();
// Test that objects are equal
// Test that objects are equal.
expected.set("fieldA", "bar");
assertNotSame(expected, actual);
assertTrue(expected.equals(expected) && actual.equals(actual));
Expand All @@ -95,7 +95,7 @@ public void testNotEquals_SymmetricWithSameClass() {
GenericData actual = new MyData();
actual.set("fieldA", "bar");
GenericData expected = new MyData();
// Test that objects are not equal
// Test that objects are not equal.
expected.set("fieldA", "far");
assertNotSame(expected, actual);
assertFalse(expected.equals(actual) || actual.equals(expected));
Expand Down

0 comments on commit fbc0256

Please sign in to comment.