public boolean areEqualToComparingOnlyGivenFields(Object actual, Object other, Map<String, Comparator<?>> comparatorByPropertyOrField, TypeComparators comparatorByType, String... fields) { return isEqualToComparingOnlyGivenFields(actual, other, comparatorByPropertyOrField, comparatorByType, fields).isFieldsNamesEmpty(); }
public boolean areEqualToComparingOnlyGivenFields(Object actual, Object other, Map<String, Comparator<?>> comparatorByPropertyOrField, TypeComparators comparatorByType, String... fields) { return isEqualToComparingOnlyGivenFields(actual, other, comparatorByPropertyOrField, comparatorByType, fields).isFieldsNamesEmpty(); }
String... fields) { assertNotNull(info, actual); ByFieldsComparison byFieldsComparison = isEqualToComparingOnlyGivenFields(actual, other, comparatorByPropertyOrField, comparatorByType,
String... fields) { assertNotNull(info, actual); ByFieldsComparison byFieldsComparison = isEqualToComparingOnlyGivenFields(actual, other, comparatorByPropertyOrField, comparatorByType,
public boolean areEqualToComparingOnlyGivenFields(Object actual, Object other, String... fields) { return isEqualToComparingOnlyGivenFields(actual, other, fields).isFieldsNamesEmpty(); }
/** * Assert that the given object is lenient equals to other object by comparing given fields value only. * * @param info contains information about the assertion. * @param actual the given object. * @param other the object to compare {@code actual} to. * @param fields accepted fields * @throws NullPointerException if the other type is {@code null}. * @throws AssertionError if actual is {@code null}. * @throws AssertionError if the actual and the given object are not lenient equals. * @throws AssertionError if the other object is not an instance of the actual type. * @throws IntrospectionError if a field does not exist in actual. */ public <A> void assertIsEqualToComparingOnlyGivenFields(AssertionInfo info, A actual, A other, String... fields) { assertNotNull(info, actual); assertOtherTypeIsCompatibleWithActualClass(info, other, actual.getClass()); ByFieldsComparison byFieldsComparison = isEqualToComparingOnlyGivenFields(actual, other, fields); if (byFieldsComparison.isFieldsNamesNotEmpty()) throw failures.failure(info, shouldBeEqualComparingOnlyGivenFields(actual, byFieldsComparison.fieldsNames, byFieldsComparison.rejectedValues, byFieldsComparison.expectedValues, newArrayList(fields))); }