@Test void givenValuesAreNotTheSameAndNoComparisonsItShouldReturnFalse() { TestObject testObject1 = getTestObject(); TestObject testObject2 = getTestObject(); Equals<TestObject> equals = new EqualsImpl.Builder<>(TestObject.class).build(); boolean result = equals.equals(testObject1, testObject2); assertThat(result) .isFalse(); }
@Override public boolean equals(T object, Object otherObject) { if (object == otherObject) { return true; } if (object == null || otherObject == null) { return false; } if (!classMatcher.classesMatch(object, otherObject)) { return false; } return isEqual(object, targetClass.cast(otherObject)); }
EqualsImpl implements Equals<T> { @Override public boolean equals(T object, Object otherObject) { if (object == otherObject) { return true; } if (object == null || otherObject == null) { return false; } if (!classMatcher.classesMatch(object, otherObject)) { return false; } return isEqual(object, targetClass.cast(otherObject)); } }
EqualsImpl implements Equals<T> { @Override public boolean equals(T object, Object otherObject) { if (object == otherObject) { return true; } if (object == null || otherObject == null) { return false; } if (!classMatcher.classesMatch(object, otherObject)) { return false; } return isEqual(object, targetClass.cast(otherObject)); } private  EqualsImpl(Class<T> targetClass, List<? extends ComparisonStep<T>> comparisonSteps, ClassMatcher<T> classMatcher); }
EqualsImpl implements Equals<T> { @Override public boolean equals(T object, Object otherObject) { if (object == otherObject) { return true; } if (object == null || otherObject == null) { return false; } if (!classMatcher.classesMatch(object, otherObject)) { return false; } return isEqual(object, targetClass.cast(otherObject)); } private  EqualsImpl(Class<T> targetClass, List<? extends ComparisonStep<T>> comparisonSteps, ClassMatcher<T> classMatcher); @Override boolean equals(T object, Object otherObject); }
EqualsImpl implements Equals<T> { @Override public boolean equals(T object, Object otherObject) { if (object == otherObject) { return true; } if (object == null || otherObject == null) { return false; } if (!classMatcher.classesMatch(object, otherObject)) { return false; } return isEqual(object, targetClass.cast(otherObject)); } private  EqualsImpl(Class<T> targetClass, List<? extends ComparisonStep<T>> comparisonSteps, ClassMatcher<T> classMatcher); @Override boolean equals(T object, Object otherObject);  }