Search in sources :

Example 1 with OnFieldsComparator

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

the class ObjectArrayAssert_usingElementComparatorOnFields_Test method verify_internal_effects.

@Override
protected void verify_internal_effects() {
    ObjectArrays arrays = getArrays(assertions);
    assertThat(arrays).isNotSameAs(arraysBefore);
    assertThat(arrays.getComparisonStrategy()).isInstanceOf(ComparatorBasedComparisonStrategy.class);
    ComparatorBasedComparisonStrategy strategy = (ComparatorBasedComparisonStrategy) arrays.getComparisonStrategy();
    assertThat(strategy.getComparator()).isInstanceOf(ExtendedByTypesComparator.class);
    assertThat(((OnFieldsComparator) ((ExtendedByTypesComparator) strategy.getComparator()).getComparator()).getFields()).containsOnly("field");
}
Also used : ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) OnFieldsComparator(org.assertj.core.internal.OnFieldsComparator) ObjectArrays(org.assertj.core.internal.ObjectArrays)

Example 2 with OnFieldsComparator

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

the class AtomicReferenceArrayAssert_usingElementComparatorOnFields_Test method verify_internal_effects.

@Override
protected void verify_internal_effects() {
    ObjectArrays arrays = getArrays(assertions);
    assertThat(arrays).isNotSameAs(arraysBefore);
    assertThat(arrays.getComparisonStrategy()).isInstanceOf(ComparatorBasedComparisonStrategy.class);
    ComparatorBasedComparisonStrategy strategy = (ComparatorBasedComparisonStrategy) arrays.getComparisonStrategy();
    assertThat(strategy.getComparator()).isInstanceOf(ExtendedByTypesComparator.class);
    assertThat(((OnFieldsComparator) ((ExtendedByTypesComparator) strategy.getComparator()).getComparator()).getFields()).containsOnly("field");
}
Also used : ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) OnFieldsComparator(org.assertj.core.internal.OnFieldsComparator) ObjectArrays(org.assertj.core.internal.ObjectArrays)

Example 3 with OnFieldsComparator

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

the class IterableAssert_usingElementComparatorOnFields_Test method verify_internal_effects.

@Override
protected void verify_internal_effects() {
    Iterables iterables = getIterables(assertions);
    assertThat(iterables).isNotSameAs(iterablesBefore);
    assertThat(iterables.getComparisonStrategy()).isInstanceOf(ComparatorBasedComparisonStrategy.class);
    ComparatorBasedComparisonStrategy strategy = (ComparatorBasedComparisonStrategy) iterables.getComparisonStrategy();
    assertThat(strategy.getComparator()).isInstanceOf(ExtendedByTypesComparator.class);
    assertThat(((OnFieldsComparator) ((ExtendedByTypesComparator) strategy.getComparator()).getComparator()).getFields()).containsOnly("field");
}
Also used : ComparatorBasedComparisonStrategy(org.assertj.core.internal.ComparatorBasedComparisonStrategy) OnFieldsComparator(org.assertj.core.internal.OnFieldsComparator) Iterables(org.assertj.core.internal.Iterables)

Example 4 with OnFieldsComparator

use of org.assertj.core.internal.OnFieldsComparator 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

OnFieldsComparator (org.assertj.core.internal.OnFieldsComparator)4 ComparatorBasedComparisonStrategy (org.assertj.core.internal.ComparatorBasedComparisonStrategy)3 Iterables (org.assertj.core.internal.Iterables)2 ObjectArrays (org.assertj.core.internal.ObjectArrays)2 ExtendedByTypesComparator (org.assertj.core.internal.ExtendedByTypesComparator)1 Lists (org.assertj.core.internal.Lists)1