use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_hasFieldOrPropertyWithValue_Test method should_pass_if_both_are_null.
@Test
public void should_pass_if_both_are_null() {
Jedi jedi = new Jedi(null, "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_if_field_or_property_value_is_not_equal_to_the_expected_value.
@Test
public void should_fail_if_field_or_property_value_is_not_equal_to_the_expected_value() {
thrown.expectAssertionError("%nExpecting%n <Yoda the Jedi>%nto have a property or a field named <\"name\"> with value%n <1000>%nbut value was:%n <\"Yoda\">");
Jedi jedi = new Jedi("Yoda", "Blue");
assertThat(jedi).hasFieldOrPropertyWithValue(FIELD_NAME, 1000);
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_hasFieldOrPropertyWithValue_Test method should_fail_if_given_field_or_property_does_not_exist.
@Test
public void should_fail_if_given_field_or_property_does_not_exist() {
thrown.expectAssertionError("%nExpecting%n <Yoda the Jedi>%nto have a property or a field named <\"not_exists_in_jedi_object\">");
Jedi jedi = new Jedi("Yoda", "Blue");
assertThat(jedi).hasFieldOrPropertyWithValue("not_exists_in_jedi_object", FIELD_VALUE);
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_hasFieldOrPropertyWithValue_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).hasFieldOrPropertyWithValue(null, FIELD_VALUE);
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_isEqualToComparingOnlyGivenFields_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").isEqualToComparingOnlyGivenFields(other, "name");
}
Aggregations