org.assertj.core.api.IterableAssert.usingElementComparator()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(79)

本文整理了Java中org.assertj.core.api.IterableAssert.usingElementComparator()方法的一些代码示例,展示了IterableAssert.usingElementComparator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IterableAssert.usingElementComparator()方法的具体详情如下:
包路径:org.assertj.core.api.IterableAssert
类名称:IterableAssert
方法名:usingElementComparator

IterableAssert.usingElementComparator介绍

暂无

代码示例

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new instance of <code>{@link IterableAssert}</code>.
 *
 * @param <ELEMENT> the type of elements.
 * @param actual the actual value.
 * @return the created assertion object.
 */
public static <ELEMENT> IterableAssert<ELEMENT> assertThat(Iterable<? extends ELEMENT> actual) {
 if (actual instanceof SortedSet) {
  @SuppressWarnings("unchecked")
  SortedSet<ELEMENT> sortedSet = (SortedSet<ELEMENT>) actual;
  Comparator<? super ELEMENT> comparator = sortedSet.comparator();
  return comparator == null
    ? new IterableAssert<>(actual)
    : new IterableAssert<ELEMENT>(actual).usingElementComparator(comparator);
 }
 return new IterableAssert<>(actual);
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * Creates a new instance of <code>{@link IterableAssert}</code>.
 *
 * @param <ELEMENT> the type of elements.
 * @param actual the actual value.
 * @return the created assertion object.
 */
@CheckReturnValue
public static <ELEMENT> IterableAssert<ELEMENT> assertThat(Iterable<? extends ELEMENT> actual) {
 if (actual instanceof SortedSet) {
  @SuppressWarnings("unchecked")
  SortedSet<ELEMENT> sortedSet = (SortedSet<ELEMENT>) actual;
  Comparator<? super ELEMENT> comparator = sortedSet.comparator();
  return comparator == null
    ? new IterableAssert<>(actual)
    : new IterableAssert<ELEMENT>(actual).usingElementComparator(comparator);
 }
 return new IterableAssert<>(actual);
}

代码示例来源:origin: eclipse/ditto

/**
 * Asserts that the specified collection of Bson objects is equal to this value.
 *
 * @param expected the expected collection of Bson objects.
 * @return this assertion object to allow method chaining.
 */
public <T extends Bson> BsonCollectionAssert isEqualToInAnyOrder(final Iterable<T> expected) {
  assertBothOrNonNull(expected);
  Assertions.assertThat(actual)
      .hasSameElementsAs(expected)
      .usingElementComparator(areBsonObjectsEqualComparator);
  return myself;
}

代码示例来源:origin: eclipse/ditto

/**
 * Asserts that the specified collection of Bson objects is equal to this value.
 * <em>The order of the collections is taken into account!</em>
 *
 * @param expected the expected collection of Bson objects.
 * @return this assertion object to allow method chaining.
 */
public <T extends Bson> BsonCollectionAssert isEqualTo(final Collection<T> expected) {
  assertBothOrNonNull(expected);
  Assertions.assertThat(actual)
      .isEqualTo(expected)
      .usingElementComparator(areBsonObjectsEqualComparator);
  return myself;
}

相关文章

微信公众号

最新文章

更多