use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_hasFieldOrProperty_Test method should_fail_if_field_or_property_does_not_exists.
@Test
public void should_fail_if_field_or_property_does_not_exists() {
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).hasFieldOrProperty("not_exists_in_jedi_object");
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_hasNoNullFieldsOrProperties_Test method should_fail_if_a_public_field_is_null.
@Test
public void should_fail_if_a_public_field_is_null() {
Jedi jedi = new Jedi("Yoda", null);
thrown.expectAssertionError("%n" + "Expecting%n" + " <Yoda the Jedi>%n" + "not to have any null property or field, but <\"lightSaberColor\"> was null.%n" + "Check was performed on all fields/properties except: <[\"name\", \"strangeNotReadablePrivateField\"]>");
assertThat(jedi).hasNoNullFieldsOrPropertiesExcept("name", "strangeNotReadablePrivateField");
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_hasNoNullFieldsOrProperties_Test method should_pass_if_all_fields_or_properties_but_the_ignored_ones_are_set.
@Test
public void should_pass_if_all_fields_or_properties_but_the_ignored_ones_are_set() {
Jedi jedi = new Jedi("Yoda", null);
assertThat(jedi).hasNoNullFieldsOrPropertiesExcept("lightSaberColor", "strangeNotReadablePrivateField");
}
use of org.assertj.core.test.Jedi in project assertj-core by joel-costigliola.
the class ObjectAssert_hasNoNullFieldsOrProperties_Test method should_fail_if_a_private_field_is_null.
@Test
public void should_fail_if_a_private_field_is_null() {
Jedi jedi = new Jedi("Yoda", "Blue");
thrown.expectAssertionError("%n" + "Expecting%n" + " <Yoda the Jedi>%n" + "not to have any null property or field, but <\"strangeNotReadablePrivateField\"> was null.%n" + "Check was performed on all fields/properties");
assertThat(jedi).hasNoNullFieldsOrProperties();
}
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_type.
@Test
public void should_be_able_to_use_a_comparator_for_specified_type() {
Jedi actual = new Jedi("Yoda", "green");
Jedi other = new Jedi("Luke", "blue");
assertThat(actual).usingComparatorForType(ALWAY_EQUALS_STRING, String.class).isEqualToComparingOnlyGivenFields(other, "name");
}
Aggregations