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.
@Test
public void should_fail_when_some_field_values_differ() {
AssertionInfo info = someInfo();
Jedi actual = new Jedi("Yoda", "Green");
Jedi other = new Jedi("Yoda", "Blue");
try {
objects.assertIsEqualToIgnoringGivenFields(info, actual, other, noFieldComparators(), defaultTypeComparators(), "name");
} catch (AssertionError err) {
verify(failures).failure(info, shouldBeEqualToIgnoringGivenFields(actual, newArrayList("lightSaberColor"), newArrayList((Object) "Green"), newArrayList((Object) "Blue"), newArrayList("name")));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class Objects_assertIsEqualToIgnoringNullFields_Test method should_fail_when_some_actual_field_is_null_but_not_other.
@Test
public void should_fail_when_some_actual_field_is_null_but_not_other() {
AssertionInfo info = someInfo();
Jedi actual = new Jedi("Yoda", null);
Jedi other = new Jedi("Yoda", "Green");
try {
objects.assertIsEqualToIgnoringNullFields(info, actual, other, noFieldComparators(), defaultTypeComparators());
} catch (AssertionError err) {
verify(failures).failure(info, shouldBeEqualToIgnoringGivenFields(actual, newArrayList("lightSaberColor"), newArrayList((Object) null), newArrayList((Object) "Green"), newArrayList("strangeNotReadablePrivateField")));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_hasFieldOrPropertyWithValue_Test method should_fail_if_field_or_property_value_is_not_null_when_expected_value_is.
@Test
public void should_fail_if_field_or_property_value_is_not_null_when_expected_value_is() {
thrown.expectAssertionError("%nExpecting%n <Yoda the Jedi>%nto have a property or a field named <\"name\"> with value%n <null>%nbut value was:%n <\"Yoda\">");
Jedi jedi = new Jedi("Yoda", "Blue");
assertThat(jedi).hasFieldOrPropertyWithValue(FIELD_NAME, null);
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_hasFieldOrPropertyWithValue_Test method should_fail_when_property_or_field_value_is_null_and_expected_value_is_not.
@Test
public void should_fail_when_property_or_field_value_is_null_and_expected_value_is_not() {
thrown.expectAssertionError("%nExpecting%n <null the Jedi>%nto have a property or a field named <\"name\"> with value%n <\"Yoda\">%nbut value was:%n <null>");
Jedi jedi = new Jedi(null, "Blue");
assertThat(jedi).hasFieldOrPropertyWithValue(FIELD_NAME, FIELD_VALUE);
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_hasFieldOrProperty_Test method should_fail_if_given_field_or_property_name_is_null.
@Test
public void should_fail_if_given_field_or_property_name_is_null() {
thrown.expectIllegalArgumentException("The name of the property/field to read should not be null");
Jedi jedi = new Jedi("Yoda", "Blue");
assertThat(jedi).hasFieldOrProperty(null);
}
Aggregations