Package org.assertj.core.internal

Examples of org.assertj.core.internal.Iterables


  @Before
  public void setUp() {
    actual = newArrayList("Luke", "Yoda", "Leia");
    failures = spy(new Failures());
    iterables = new Iterables();
    iterables.failures = failures;
    comparisonStrategy = new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance);
    iterablesWithCaseInsensitiveComparisonStrategy = new Iterables(comparisonStrategy);
    iterablesWithCaseInsensitiveComparisonStrategy.failures = failures;
  }
View Full Code Here


  }

  @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(FieldByFieldComparator.class);
  Comparator<?> iterablesElementComparator = ((ComparatorBasedComparisonStrategy) iterables.getComparisonStrategy()).getComparator();
  assertThat(iterablesElementComparator).isInstanceOf(FieldByFieldComparator.class);
  }
View Full Code Here

  }

  @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(OnFieldsComparator.class);
  assertThat(((OnFieldsComparator) listsElementComparator).getFields()).containsOnly("field");
  Comparator<?> iterablesElementComparator = ((ComparatorBasedComparisonStrategy) iterables.getComparisonStrategy()).getComparator();
  assertThat(iterablesElementComparator).isInstanceOf(OnFieldsComparator.class);
  assertThat(((OnFieldsComparator) iterablesElementComparator).getFields()).containsOnly("field");
  }
View Full Code Here

  }

  @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(IgnoringFieldsComparator.class);
  assertThat(((IgnoringFieldsComparator) listsElementComparator).getFields()).containsOnly("field");
  Comparator<?> iterablesElementComparator = ((ComparatorBasedComparisonStrategy) iterables.getComparisonStrategy()).getComparator();
  assertThat(iterablesElementComparator).isInstanceOf(IgnoringFieldsComparator.class);
  assertThat(((IgnoringFieldsComparator) iterablesElementComparator).getFields()).containsOnly("field");
  }
View Full Code Here

  return assertions.usingElementComparatorIgnoringFields("field");
  }

  @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(IgnoringFieldsComparator.class);
  assertThat(((IgnoringFieldsComparator) strategy.getComparator()).getFields()).containsOnly("field");
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public S usingElementComparator(Comparator<? super T> elementComparator) {
  this.iterables = new Iterables(new ComparatorBasedComparisonStrategy(elementComparator));
  // to have the same semantics on base assertions like isEqualTo, we need to use an iterable comparator comparing
  // elements with elementComparator parameter
  objects = new Objects(new IterableElementComparisonStrategy<T>(elementComparator));
  return myself;
  }
View Full Code Here

  public S usingElementComparatorOnFields(String... fields) {
  return usingElementComparator(new OnFieldsComparator(fields));
  }

  protected S usingComparisonStrategy(ComparisonStrategy comparisonStrategy) {
  iterables = new Iterables(comparisonStrategy);
  return myself;
  }
View Full Code Here

  return assertions.usingElementComparatorOnFields("field");
  }

  @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(OnFieldsComparator.class);
  assertThat(((OnFieldsComparator)strategy.getComparator()).getFields()).containsOnly("field");
  }
View Full Code Here

TOP

Related Classes of org.assertj.core.internal.Iterables

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.