use of org.assertj.core.test.Person in project assertj-core by joel-costigliola.
the class Objects_assertDoesNotHaveNotSameClassAs_Test method should_fail_if_actual_has_same_type_as_other.
@Test
public void should_fail_if_actual_has_same_type_as_other() {
AssertionInfo info = someInfo();
try {
objects.assertDoesNotHaveSameClassAs(info, actual, new Person("Luke"));
failBecauseExpectedAssertionErrorWasNotThrown();
} catch (AssertionError err) {
verify(failures).failure(info, shouldNotHaveSameClass(actual, new Person("Luke")));
}
}
use of org.assertj.core.test.Person in project assertj-core by joel-costigliola.
the class Objects_assertHasSameClassAs_Test method should_fail_if_actual_is_null.
@Test
public void should_fail_if_actual_is_null() {
thrown.expectAssertionError(actualIsNull());
objects.assertHasSameClassAs(someInfo(), null, new Person("Luke"));
}
use of org.assertj.core.test.Person in project assertj-core by joel-costigliola.
the class Objects_assertIsEqualToComparingOnlyGivenFields_Test method should_pass_when_fields_are_equal_even_if_objects_types_differ.
@Test
public void should_pass_when_fields_are_equal_even_if_objects_types_differ() {
CartoonCharacter actual = new CartoonCharacter("Homer Simpson");
Person other = new Person("Homer Simpson");
objects.assertIsEqualToComparingOnlyGivenFields(someInfo(), actual, other, noFieldComparators(), defaultTypeComparators(), "name");
}
use of org.assertj.core.test.Person in project assertj-core by joel-costigliola.
the class Objects_assertNotSame_Test method should_fail_if_objects_are_same.
@Test
public void should_fail_if_objects_are_same() {
AssertionInfo info = someInfo();
Object actual = new Person("Yoda");
try {
objects.assertNotSame(info, actual, actual);
} catch (AssertionError e) {
verify(failures).failure(info, shouldNotBeSame(actual));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
use of org.assertj.core.test.Person in project assertj-core by joel-costigliola.
the class ObjectAssert_hasNoNullFieldsOrProperties_Test method should_fail_if_a_property_is_null.
@Test
public void should_fail_if_a_property_is_null() {
Person nobody = new Person(null);
thrown.expectAssertionError("%n" + "Expecting%n" + " <Person[name='null']>%n" + "not to have any null property or field, but <\"name\"> was null.%n" + "Check was performed on all fields/properties");
assertThat(nobody).hasNoNullFieldsOrProperties();
}
Aggregations