use of org.assertj.core.test.AlwaysEqualComparator.ALWAY_EQUALS_STRING in project assertj-core by joel-costigliola.
the class ObjectAssert_isEqualsToComparingFields_Test method comparators_for_fields_should_have_precedence_over_comparators_for_types.
@Test
public void comparators_for_fields_should_have_precedence_over_comparators_for_types() {
Comparator<String> comparator = (o1, o2) -> o1.compareTo(o2);
Jedi actual = new Jedi("Yoda", "green");
Jedi other = new Jedi("Luke", "green");
assertThat(actual).usingComparatorForFields(ALWAY_EQUALS_STRING, "name").usingComparatorForType(comparator, String.class).isEqualToComparingFieldByField(other);
}
use of org.assertj.core.test.AlwaysEqualComparator.ALWAY_EQUALS_STRING in project assertj-core by joel-costigliola.
the class AtomicReferenceArrayAssert_usingElementComparatorIgnoringFields_Test method comparators_for_element_field_names_should_have_precedence_over_comparators_for_element_field_types_using_element_comparator_ignoring_fields.
@Test
public void comparators_for_element_field_names_should_have_precedence_over_comparators_for_element_field_types_using_element_comparator_ignoring_fields() {
Comparator<String> comparator = (o1, o2) -> o1.compareTo(o2);
Jedi actual = new Jedi("Yoda", "green");
Jedi other = new Jedi("Luke", "green");
assertThat(atomicArrayOf(actual)).usingComparatorForElementFieldsWithNames(ALWAY_EQUALS_STRING, "name").usingComparatorForElementFieldsWithType(comparator, String.class).usingElementComparatorIgnoringFields("lightSaberColor").contains(other);
}
use of org.assertj.core.test.AlwaysEqualComparator.ALWAY_EQUALS_STRING in project assertj-core by joel-costigliola.
the class ObjectAssert_isEqualToComparingOnlyGivenFields_Test method comparators_for_fields_should_have_precedence_over_comparators_for_types.
@Test
public void comparators_for_fields_should_have_precedence_over_comparators_for_types() {
Comparator<String> comparator = (o1, o2) -> o1.compareTo(o2);
Jedi actual = new Jedi("Yoda", "green");
Jedi other = new Jedi("Luke", "green");
assertThat(actual).usingComparatorForFields(ALWAY_EQUALS_STRING, "name").usingComparatorForType(comparator, String.class).isEqualToComparingOnlyGivenFields(other, "name");
}
use of org.assertj.core.test.AlwaysEqualComparator.ALWAY_EQUALS_STRING in project assertj-core by joel-costigliola.
the class AtomicReferenceArrayAssert_usingElementComparatorOnFields_Test method comparators_for_element_field_names_should_have_precedence_over_comparators_for_element_field_types_using_element_comparator_on_fields.
@Test
public void comparators_for_element_field_names_should_have_precedence_over_comparators_for_element_field_types_using_element_comparator_on_fields() {
Comparator<String> comparator = (o1, o2) -> o1.compareTo(o2);
Jedi actual = new Jedi("Yoda", "green");
Jedi other = new Jedi("Luke", "green");
assertThat(atomicArrayOf(actual)).usingComparatorForElementFieldsWithNames(ALWAY_EQUALS_STRING, "name").usingComparatorForElementFieldsWithType(comparator, String.class).usingElementComparatorOnFields("name", "lightSaberColor").contains(other);
}
use of org.assertj.core.test.AlwaysEqualComparator.ALWAY_EQUALS_STRING in project assertj-core by joel-costigliola.
the class AtomicReferenceArrayAssert_usingFieldByFieldElementComparator_Test method comparators_for_element_field_names_should_have_precedence_over_comparators_for_element_field_types_when_using_field_by_field_element_comparator.
@Test
public void comparators_for_element_field_names_should_have_precedence_over_comparators_for_element_field_types_when_using_field_by_field_element_comparator() {
Comparator<String> comparator = (o1, o2) -> o1.compareTo(o2);
Jedi actual = new Jedi("Yoda", "green");
Jedi other = new Jedi("Luke", "green");
assertThat(atomicArrayOf(actual)).usingComparatorForElementFieldsWithNames(ALWAY_EQUALS_STRING, "name").usingComparatorForElementFieldsWithType(comparator, String.class).usingFieldByFieldElementComparator().contains(other);
}
Aggregations