Search in sources :

Example 1 with Patient

use of org.assertj.core.test.Patient in project assertj-core by joel-costigliola.

the class ObjectAssert_isEqualsToComparingFields_Test method should_handle_null_field_with_field_comparator.

@Test
public void should_handle_null_field_with_field_comparator() {
    // GIVEN
    Patient adam = new Patient(null);
    Patient eve = new Patient(new Timestamp(3L));
    // THEN
    assertThat(adam).usingComparatorForFields(ALWAY_EQUALS, "dateOfBirth").isEqualToComparingFieldByField(eve);
}
Also used : Patient(org.assertj.core.test.Patient) Timestamp(java.sql.Timestamp) Test(org.junit.Test) ObjectAssertBaseTest(org.assertj.core.api.ObjectAssertBaseTest)

Example 2 with Patient

use of org.assertj.core.test.Patient in project assertj-core by joel-costigliola.

the class ObjectAssert_isEqualsToComparingFields_Test method should_not_bother_with_comparators_when_fields_are_the_same.

@Test
public void should_not_bother_with_comparators_when_fields_are_the_same() {
    // GIVEN
    Timestamp dateOfBirth = new Timestamp(3L);
    Patient adam = new Patient(dateOfBirth);
    Patient eve = new Patient(dateOfBirth);
    // THEN
    assertThat(adam).usingComparatorForFields(NEVER_EQUALS, "dateOfBirth").isEqualToComparingFieldByField(eve);
}
Also used : Patient(org.assertj.core.test.Patient) Timestamp(java.sql.Timestamp) Test(org.junit.Test) ObjectAssertBaseTest(org.assertj.core.api.ObjectAssertBaseTest)

Example 3 with Patient

use of org.assertj.core.test.Patient in project assertj-core by joel-costigliola.

the class Objects_assertIsEqualToComparingFieldByFieldRecursive_Test method should_handle_null_field_with_field_comparator.

@Test
public void should_handle_null_field_with_field_comparator() {
    // GIVEN
    Patient adam = new Patient(null);
    Patient eve = new Patient(new Timestamp(3L));
    // THEN
    assertThat(adam).usingComparatorForFields(ALWAY_EQUALS, "dateOfBirth", "health").isEqualToComparingFieldByFieldRecursively(eve);
}
Also used : Patient(org.assertj.core.test.Patient) Timestamp(java.sql.Timestamp) ObjectsBaseTest(org.assertj.core.internal.ObjectsBaseTest) Test(org.junit.Test)

Example 4 with Patient

use of org.assertj.core.test.Patient in project assertj-core by joel-costigliola.

the class Objects_assertIsEqualToComparingFieldByFieldRecursive_Test method should_not_bother_with_comparators_when_fields_are_the_same.

@Test
public void should_not_bother_with_comparators_when_fields_are_the_same() {
    // GIVEN
    Timestamp dateOfBirth = new Timestamp(3L);
    Patient adam = new Patient(dateOfBirth);
    Patient eve = new Patient(dateOfBirth);
    // THEN
    assertThat(adam).usingComparatorForFields(NEVER_EQUALS, "dateOfBirth").isEqualToComparingFieldByFieldRecursively(eve);
}
Also used : Patient(org.assertj.core.test.Patient) Timestamp(java.sql.Timestamp) ObjectsBaseTest(org.assertj.core.internal.ObjectsBaseTest) Test(org.junit.Test)

Example 5 with Patient

use of org.assertj.core.test.Patient in project assertj-core by joel-costigliola.

the class Objects_assertIsEqualToComparingFieldByFieldRecursive_Test method should_handle_null_field_with_type_comparator.

@Test
public void should_handle_null_field_with_type_comparator() {
    // GIVEN
    Patient adam = new Patient(null);
    Patient eve = new Patient(new Timestamp(3L));
    // THEN
    assertThat(adam).usingComparatorForType(ALWAY_EQUALS_TIMESTAMP, Timestamp.class).isEqualToComparingFieldByFieldRecursively(eve);
}
Also used : Patient(org.assertj.core.test.Patient) Timestamp(java.sql.Timestamp) ObjectsBaseTest(org.assertj.core.internal.ObjectsBaseTest) Test(org.junit.Test)

Aggregations

Timestamp (java.sql.Timestamp)5 Patient (org.assertj.core.test.Patient)5 Test (org.junit.Test)5 ObjectsBaseTest (org.assertj.core.internal.ObjectsBaseTest)3 ObjectAssertBaseTest (org.assertj.core.api.ObjectAssertBaseTest)2