use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ShouldBeEqualIgnoringGivenFields_create_Test method should_create_error_message_with_single_field_difference.
@Test
public void should_create_error_message_with_single_field_difference() {
factory = shouldBeEqualToIgnoringGivenFields(new Jedi("Yoda", "blue"), newArrayList("lightSaberColor"), newArrayList((Object) "blue"), newArrayList((Object) "green"), newArrayList("someIgnoredField"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting value <\"green\"> in field <\"lightSaberColor\"> " + "but was <\"blue\"> in <Yoda the Jedi>.%n" + "Comparison was performed on all fields but <[\"someIgnoredField\"]>"));
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ShouldBeEqualIgnoringGivenFields_create_Test method should_create_error_message_with_all_fields_differences.
@Test
public void should_create_error_message_with_all_fields_differences() {
factory = shouldBeEqualToIgnoringGivenFields(new Jedi("Yoda", "blue"), newArrayList("name", "lightSaberColor"), newArrayList((Object) "Yoda", "blue"), newArrayList((Object) "Yoda", "green"), newArrayList("someIgnoredField"));
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting values:%n" + " <[\"Yoda\", \"green\"]>%n" + "in fields:%n" + " <[\"name\", \"lightSaberColor\"]>%n" + "but were:%n" + " <[\"Yoda\", \"blue\"]>%n" + "in <Yoda the Jedi>.%n" + "Comparison was performed on all fields but <[\"someIgnoredField\"]>"));
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ThrowableAssert_built_from_lambda_Test method should_build_ThrowableAssert_with_checked_exception_thrown_by_lambda.
@Test
public void should_build_ThrowableAssert_with_checked_exception_thrown_by_lambda() {
Jedi yoda = new Jedi("Yoda", "Green");
// @format:off
assertThatThrownBy(() -> {
throw new Exception(yoda + " is no Sith");
}).isInstanceOf(Exception.class).hasMessage(yoda + " is no Sith");
// @format:on
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ExtendedByTypesComparator_compareTo_Test method should_return_are_not_equal_if_objects_are_not_equal_by_default_comparator.
@Test
public void should_return_are_not_equal_if_objects_are_not_equal_by_default_comparator() {
assertThat(EXTENDED_STANDARD_COMPARATOR.compare(new Jedi("Yoda", "Green"), new Jedi("Luke", "Blue"))).isNotZero();
assertThat(EXTENDED_FIELD_BY_FIELD_COMPARATOR.compare(new Jedi("Yoda", "Green"), new Jedi("Yoda", "Any"))).isNotZero();
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class IterableAssert_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(singletonList(actual)).usingComparatorForElementFieldsWithNames(ALWAY_EQUALS_STRING, "name").usingComparatorForElementFieldsWithType(comparator, String.class).usingElementComparatorIgnoringFields("lightSaberColor").contains(other);
}
Aggregations