use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_isEqualToIgnoringGivenFields_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).isEqualToIgnoringGivenFields(other, "lightSaberColor");
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_isEqualToIgnoringGivenFields_Test method should_be_able_to_use_a_comparator_for_specified_fields.
@Test
public void should_be_able_to_use_a_comparator_for_specified_fields() {
Jedi actual = new Jedi("Yoda", "Green");
Jedi other = new Jedi("Luke", "Blue");
assertThat(actual).usingComparatorForFields(ALWAY_EQUALS_STRING, "name").isEqualToIgnoringGivenFields(other, "lightSaberColor");
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_isEqualToIgnoringGivenFields_Test method should_be_able_to_use_a_comparator_for_specified_type.
@Test
public void should_be_able_to_use_a_comparator_for_specified_type() {
Jedi actual = new Jedi("Yoda", "green");
Jedi other = new Jedi("Luke", "blue");
assertThat(actual).usingComparatorForType(ALWAY_EQUALS_STRING, String.class).isEqualToIgnoringGivenFields(other, "lightSaberColor");
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectArrayAssert_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(array(actual)).usingComparatorForElementFieldsWithNames(ALWAY_EQUALS_STRING, "name").usingComparatorForElementFieldsWithType(comparator, String.class).usingElementComparatorOnFields("name", "lightSaberColor").contains(other);
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectArrayAssert_usingElementComparatorOnFields_Test method should_be_able_to_use_a_comparator_for_specified_fields_of_elements_when_using_element_comparator_on_fields.
@Test
public void should_be_able_to_use_a_comparator_for_specified_fields_of_elements_when_using_element_comparator_on_fields() {
Jedi actual = new Jedi("Yoda", "green");
Jedi other = new Jedi("Luke", "green");
assertThat(array(actual)).usingComparatorForElementFieldsWithNames(ALWAY_EQUALS_STRING, "name").usingElementComparatorOnFields("name", "lightSaberColor").contains(other);
}
Aggregations