use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class Objects_assertIsEqualToIgnoringGivenFields_Test method should_fail_when_one_of_actual_field_to_compare_can_not_be_found_in_the_other_object.
@Test
public void should_fail_when_one_of_actual_field_to_compare_can_not_be_found_in_the_other_object() {
Jedi actual = new Jedi("Yoda", "Green");
Employee other = new Employee();
thrown.expectIntrospectionErrorWithMessageContaining("Can't find any field or property with name 'lightSaberColor'");
objects.assertIsEqualToIgnoringGivenFields(someInfo(), actual, other, noFieldComparators(), defaultTypeComparators(), "name");
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class Objects_assertIsEqualToIgnoringGivenFields_Test method should_pass_when_fields_are_equal.
@Test
public void should_pass_when_fields_are_equal() {
Jedi actual = new Jedi("Yoda", "Green");
Jedi other = new Jedi("Yoda", "Green");
// strangeNotReadablePrivateField fields are compared and are null in both actual and other
objects.assertIsEqualToIgnoringGivenFields(someInfo(), actual, other, noFieldComparators(), defaultTypeComparators());
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class Objects_assertIsEqualToIgnoringGivenFields_Test method should_fail_when_some_field_value_is_null_on_one_object_only.
@Test
public void should_fail_when_some_field_value_is_null_on_one_object_only() {
AssertionInfo info = someInfo();
Jedi actual = new Jedi("Yoda", null);
Jedi other = new Jedi("Yoda", "Green");
try {
objects.assertIsEqualToIgnoringGivenFields(info, actual, other, noFieldComparators(), defaultTypeComparators(), "name");
} catch (AssertionError err) {
List<Object> expected = newArrayList((Object) "Green");
verify(failures).failure(info, shouldBeEqualToIgnoringGivenFields(actual, newArrayList("lightSaberColor"), newArrayList((Object) null), expected, newArrayList("name")));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class Objects_assertIsEqualToIgnoringGivenFields_Test method should_fail_when_some_inherited_field_values_differ.
@Test
public void should_fail_when_some_inherited_field_values_differ() {
AssertionInfo info = someInfo();
Jedi actual = new Jedi("Yoda", "Green");
Jedi other = new Jedi("Luke", "Green");
try {
objects.assertIsEqualToIgnoringGivenFields(info, actual, other, noFieldComparators(), defaultTypeComparators(), "lightSaberColor");
} catch (AssertionError err) {
verify(failures).failure(info, shouldBeEqualToIgnoringGivenFields(actual, newArrayList("name"), newArrayList((Object) "Yoda"), newArrayList((Object) "Luke"), newArrayList("lightSaberColor")));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class Objects_assertIsEqualToIgnoringGivenFields_Test method should_fail_when_some_field_values_differ_and_no_fields_are_ignored.
@Test
public void should_fail_when_some_field_values_differ_and_no_fields_are_ignored() {
AssertionInfo info = someInfo();
Jedi actual = new Jedi("Yoda", "Green");
Jedi other = new Jedi("Yoda", "Blue");
try {
objects.assertIsEqualToIgnoringGivenFields(info, actual, other, noFieldComparators(), defaultTypeComparators());
} catch (AssertionError err) {
verify(failures).failure(info, shouldBeEqualToIgnoringGivenFields(actual, newArrayList("lightSaberColor"), newArrayList((Object) "Green"), newArrayList((Object) "Blue"), new ArrayList<String>()));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
Aggregations