Search in sources :

Example 86 with Jedi

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

the class Objects_assertIsEqualToIgnoringNullFields_Test method should_fail_if_actual_is_null.

@Test
public void should_fail_if_actual_is_null() {
    thrown.expectAssertionError(actualIsNull());
    Jedi other = new Jedi("Yoda", "Green");
    objects.assertIsEqualToIgnoringNullFields(someInfo(), null, other, noFieldComparators(), defaultTypeComparators());
}
Also used : Jedi(org.assertj.core.test.Jedi) ObjectsBaseTest(org.assertj.core.internal.ObjectsBaseTest) Test(org.junit.Test)

Example 87 with Jedi

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

the class Objects_assertIsEqualToIgnoringNullFields_Test method should_fail_when_one_of_actual_field_to_compare_can_not_be_found_in_the_other_object.

@Test
public void should_fail_when_one_of_actual_field_to_compare_can_not_be_found_in_the_other_object() {
    thrown.expectIntrospectionErrorWithMessageContaining("Can't find any field or property with name 'lightSaberColor'");
    Jedi actual = new Jedi("Yoda", "Green");
    Employee other = new Employee();
    objects.assertIsEqualToIgnoringNullFields(someInfo(), actual, other, noFieldComparators(), defaultTypeComparators());
}
Also used : Jedi(org.assertj.core.test.Jedi) Employee(org.assertj.core.test.Employee) ObjectsBaseTest(org.assertj.core.internal.ObjectsBaseTest) Test(org.junit.Test)

Example 88 with Jedi

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

the class Objects_assertIsEqualToIgnoringNullFields_Test method should_fail_when_a_field_differ.

@Test
public void should_fail_when_a_field_differ() {
    AssertionInfo info = someInfo();
    Jedi actual = new Jedi("Yoda", "Green");
    Jedi other = new Jedi("Soda", "Green");
    try {
        objects.assertIsEqualToIgnoringNullFields(info, actual, other, noFieldComparators(), defaultTypeComparators());
    } catch (AssertionError err) {
        verify(failures).failure(info, shouldBeEqualToIgnoringGivenFields(actual, newArrayList("name"), newArrayList((Object) "Yoda"), newArrayList((Object) "Soda"), newArrayList("strangeNotReadablePrivateField")));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) Jedi(org.assertj.core.test.Jedi) ObjectsBaseTest(org.assertj.core.internal.ObjectsBaseTest) Test(org.junit.Test)

Example 89 with Jedi

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

the class Assumptions_assumeThat_involving_iterable_navigation_Test method setup.

@Before
public void setup() {
    yoda = new Jedi("Yoda", "green");
    luke = new Jedi("Luke", "green");
    jedis = newLinkedHashSet(yoda, luke);
}
Also used : Jedi(org.assertj.core.test.Jedi) Before(org.junit.Before)

Example 90 with Jedi

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

the class Assumptions_assumeThat_with_extracting_Test method setup.

@Before
public void setup() {
    yoda = new Jedi("Yoda", "green");
    luke = new Jedi("Luke", "green");
    jedis = newHashSet(yoda, luke);
    bart = new CartoonCharacter("Bart Simpson");
    lisa = new CartoonCharacter("Lisa Simpson");
    maggie = new CartoonCharacter("Maggie Simpson");
    homer = new CartoonCharacter("Homer Simpson");
    homer.addChildren(bart, lisa, maggie);
    pebbles = new CartoonCharacter("Pebbles Flintstone");
    fred = new CartoonCharacter("Fred Flintstone");
    fred.addChildren(pebbles);
}
Also used : Jedi(org.assertj.core.test.Jedi) CartoonCharacter(org.assertj.core.test.CartoonCharacter) Before(org.junit.Before)

Aggregations

Jedi (org.assertj.core.test.Jedi)108 Test (org.junit.Test)104 ObjectsBaseTest (org.assertj.core.internal.ObjectsBaseTest)30 ObjectAssertBaseTest (org.assertj.core.api.ObjectAssertBaseTest)26 Comparator (java.util.Comparator)14 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)14 ALWAY_EQUALS_STRING (org.assertj.core.test.AlwaysEqualComparator.ALWAY_EQUALS_STRING)13 Before (org.junit.Before)13 AssertionInfo (org.assertj.core.api.AssertionInfo)10 AtomicReferenceArrayAssertBaseTest (org.assertj.core.api.AtomicReferenceArrayAssertBaseTest)9 IterableAssertBaseTest (org.assertj.core.api.IterableAssertBaseTest)9 ObjectArrayAssertBaseTest (org.assertj.core.api.ObjectArrayAssertBaseTest)9 ComparatorBasedComparisonStrategy (org.assertj.core.internal.ComparatorBasedComparisonStrategy)9 Lists.newArrayList (org.assertj.core.util.Lists.newArrayList)7 TextDescription (org.assertj.core.description.TextDescription)6 ExtendedByTypesComparator (org.assertj.core.internal.ExtendedByTypesComparator)6 ObjectArrays (org.assertj.core.internal.ObjectArrays)6 StandardRepresentation (org.assertj.core.presentation.StandardRepresentation)6 List (java.util.List)5 TypeComparators.defaultTypeComparators (org.assertj.core.internal.TypeComparators.defaultTypeComparators)5