Search in sources :

Example 1 with Lists

use of org.assertj.core.internal.Lists in project assertj-core by joel-costigliola.

the class AbstractListAssert method usingComparisonStrategy.

// can't really honor basic assertion consistently with this comparisonStrategy
@Override
protected SELF usingComparisonStrategy(ComparisonStrategy comparisonStrategy) {
    super.usingComparisonStrategy(comparisonStrategy);
    lists = new Lists(comparisonStrategy);
    return myself;
}
Also used : Lists(org.assertj.core.internal.Lists)

Example 2 with Lists

use of org.assertj.core.internal.Lists in project assertj-core by joel-costigliola.

the class AbstractListAssert method usingElementComparator.

@Override
@CheckReturnValue
public SELF usingElementComparator(Comparator<? super ELEMENT> customComparator) {
    super.usingElementComparator(customComparator);
    lists = new Lists(new ComparatorBasedComparisonStrategy(customComparator));
    return myself;
}
Also used : Lists(org.assertj.core.internal.Lists) ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) CheckReturnValue(org.assertj.core.util.CheckReturnValue)

Example 3 with Lists

use of org.assertj.core.internal.Lists in project assertj-core by joel-costigliola.

the class ListsBaseTest method setUp.

@Before
public void setUp() {
    failures = spy(new Failures());
    lists = new Lists();
    lists.failures = failures;
    comparisonStrategy = new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance);
    listsWithCaseInsensitiveComparisonStrategy = new Lists(comparisonStrategy);
    listsWithCaseInsensitiveComparisonStrategy.failures = failures;
}
Also used : Lists(org.assertj.core.internal.Lists) ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Failures(org.assertj.core.internal.Failures) Before(org.junit.Before)

Example 4 with Lists

use of org.assertj.core.internal.Lists in project assertj-core by joel-costigliola.

the class ListAssert_usingElementComparatorIgnoringFields_Test method verify_internal_effects.

@Override
protected void verify_internal_effects() {
    Lists lists = getLists(assertions);
    Iterables iterables = getIterables(assertions);
    assertThat(lists).isNotSameAs(listsBefore);
    assertThat(iterables).isNotSameAs(iterablesBefore);
    assertThat(iterables.getComparisonStrategy()).isInstanceOf(ComparatorBasedComparisonStrategy.class);
    assertThat(lists.getComparisonStrategy()).isInstanceOf(ComparatorBasedComparisonStrategy.class);
    Comparator<?> listsElementComparator = ((ComparatorBasedComparisonStrategy) lists.getComparisonStrategy()).getComparator();
    assertThat(listsElementComparator).isInstanceOf(ExtendedByTypesComparator.class);
    assertThat(((IgnoringFieldsComparator) ((ExtendedByTypesComparator) listsElementComparator).getComparator()).getFields()).containsOnly("field");
    Comparator<?> iterablesElementComparator = ((ComparatorBasedComparisonStrategy) iterables.getComparisonStrategy()).getComparator();
    assertThat(iterablesElementComparator).isInstanceOf(ExtendedByTypesComparator.class);
    assertThat(((IgnoringFieldsComparator) ((ExtendedByTypesComparator) iterablesElementComparator).getComparator()).getFields()).containsOnly("field");
}
Also used : IgnoringFieldsComparator(org.assertj.core.internal.IgnoringFieldsComparator) Lists(org.assertj.core.internal.Lists) ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) Iterables(org.assertj.core.internal.Iterables)

Example 5 with Lists

use of org.assertj.core.internal.Lists in project assertj-core by joel-costigliola.

the class ListAssert_usingElementComparatorOnFields_Test method verify_internal_effects.

@Override
protected void verify_internal_effects() {
    Lists lists = getLists(assertions);
    Iterables iterables = getIterables(assertions);
    assertThat(lists).isNotSameAs(listsBefore);
    assertThat(iterables).isNotSameAs(iterablesBefore);
    assertThat(iterables.getComparisonStrategy()).isInstanceOf(ComparatorBasedComparisonStrategy.class);
    assertThat(lists.getComparisonStrategy()).isInstanceOf(ComparatorBasedComparisonStrategy.class);
    Comparator<?> listsElementComparator = ((ExtendedByTypesComparator) ((ComparatorBasedComparisonStrategy) lists.getComparisonStrategy()).getComparator()).getComparator();
    assertThat(listsElementComparator).isInstanceOf(OnFieldsComparator.class);
    assertThat(((OnFieldsComparator) listsElementComparator).getFields()).containsOnly("field");
    Comparator<?> iterablesElementComparator = ((ExtendedByTypesComparator) ((ComparatorBasedComparisonStrategy) iterables.getComparisonStrategy()).getComparator()).getComparator();
    assertThat(iterablesElementComparator).isInstanceOf(OnFieldsComparator.class);
    assertThat(((OnFieldsComparator) iterablesElementComparator).getFields()).containsOnly("field");
}
Also used : Lists(org.assertj.core.internal.Lists) OnFieldsComparator(org.assertj.core.internal.OnFieldsComparator) Iterables(org.assertj.core.internal.Iterables) ExtendedByTypesComparator(org.assertj.core.internal.ExtendedByTypesComparator)

Aggregations

Lists (org.assertj.core.internal.Lists)6 ComparatorBasedComparisonStrategy (org.assertj.core.internal.ComparatorBasedComparisonStrategy)3 Iterables (org.assertj.core.internal.Iterables)3 ExtendedByTypesComparator (org.assertj.core.internal.ExtendedByTypesComparator)2 Failures (org.assertj.core.internal.Failures)1 IgnoringFieldsComparator (org.assertj.core.internal.IgnoringFieldsComparator)1 OnFieldsComparator (org.assertj.core.internal.OnFieldsComparator)1 CheckReturnValue (org.assertj.core.util.CheckReturnValue)1 Before (org.junit.Before)1