use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class IterableAssert_usingElementComparatorIgnoringFields_Test method should_be_able_to_use_a_comparator_for_specified_fields_of_elements_when_using_element_comparator_ignoring_fields.
@Test
public void should_be_able_to_use_a_comparator_for_specified_fields_of_elements_when_using_element_comparator_ignoring_fields() {
Jedi actual = new Jedi("Yoda", "green");
Jedi other = new Jedi("Luke", "green");
assertThat(singletonList(actual)).usingComparatorForElementFieldsWithNames(ALWAY_EQUALS_STRING, "name").usingElementComparatorIgnoringFields("lightSaberColor").contains(other);
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class IterableAssert_usingElementComparatorOnFields_Test method should_be_able_to_use_a_comparator_for_element_fields_with_specified_type_using_element_comparator_on_fields.
@Test
public void should_be_able_to_use_a_comparator_for_element_fields_with_specified_type_using_element_comparator_on_fields() {
Jedi actual = new Jedi("Yoda", "green");
Jedi other = new Jedi("Luke", "blue");
assertThat(singletonList(actual)).usingComparatorForElementFieldsWithType(ALWAY_EQUALS_STRING, String.class).usingElementComparatorOnFields("name", "lightSaberColor").contains(other);
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class IterableAssert_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(singletonList(actual)).usingComparatorForElementFieldsWithNames(ALWAY_EQUALS_STRING, "name").usingComparatorForElementFieldsWithType(comparator, String.class).usingFieldByFieldElementComparator().contains(other);
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class IterableAssert_usingFieldByFieldElementComparator_Test method should_be_able_to_use_a_comparator_for_specified_fields_of_elements_when_using_field_by_field_element_comparator.
@Test
public void should_be_able_to_use_a_comparator_for_specified_fields_of_elements_when_using_field_by_field_element_comparator() {
Jedi actual = new Jedi("Yoda", "green");
Jedi other = new Jedi("Luke", "green");
assertThat(singletonList(actual)).usingComparatorForElementFieldsWithNames(ALWAY_EQUALS_STRING, "name").usingFieldByFieldElementComparator().contains(other);
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class IterableAssert_hasOnlyOneElementSatisfying_Test method succeeds_if_iterable_has_only_one_element_and_that_element_statisfies_the_given_assertion.
@Test
public void succeeds_if_iterable_has_only_one_element_and_that_element_statisfies_the_given_assertion() {
List<Jedi> jedis = asList(new Jedi("Yoda", "red"));
assertThat(jedis).hasOnlyOneElementSatisfying(yoda -> assertThat(yoda.getName()).startsWith("Y"));
}
Aggregations