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

x33g5p2x  于2022-01-15 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(94)

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

Assertions.filter介绍

[英]Only delegate to Filters#filter(Object[]) so that Assertions offers a full feature entry point to all AssertJ features (but you can use Filters if you prefer).

Note that the given Iterable is not modified, the filters are performed on a copy.

Typical usage with Condition :

assertThat(filter(players).being(potentialMVP).get()).containsOnly(james, rose);

and with filter language based on java bean property :

assertThat(filter(players).with("pointsPerGame").greaterThan(20) 
.and("assistsPerGame").greaterThan(7).get()) 
.containsOnly(james, rose);

[中]仅委托给Filters#filter(Object[]),以便断言为所有AssertJ功能提供完整的功能入口点(但如果愿意,可以使用过滤器)。
请注意,未修改给定的Iterable,而是在副本上执行过滤器。
典型使用条件:

assertThat(filter(players).being(potentialMVP).get()).containsOnly(james, rose);

并使用基于java bean属性的过滤语言:

assertThat(filter(players).with("pointsPerGame").greaterThan(20) 
.and("assistsPerGame").greaterThan(7).get()) 
.containsOnly(james, rose);

代码示例

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

/**
 * Only delegate to {@link Filters#filter(Object[])} so that Assertions offers a full feature entry point to all
 * AssertJ features (but you can use {@link Filters} if you prefer).
 * <p>
 * Note that the given array is not modified, the filters are performed on an {@link Iterable} copy of the array.
 * <p>
 * Typical usage with {@link Condition} :
 *
 * <pre><code class='java'> assertThat(filter(players).being(potentialMVP).get()).containsOnly(james, rose);</code></pre>
 * <p>
 * and with filter language based on java bean property :
 *
 * <pre><code class='java'> assertThat(filter(players).with(&quot;pointsPerGame&quot;).greaterThan(20).and(&quot;assistsPerGame&quot;).greaterThan(7).get())
 *           .containsOnly(james, rose);</code></pre>
 *
 * @param <E> the array elements type.
 * @param array the array to filter.
 * @return the created <code>{@link Filters}</code>.
 */
default <E> Filters<E> filter(final E[] array) {
 return Assertions.filter(array);
}

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

/**
 * Only delegate to {@link Filters#filter(Object[])} so that Assertions offers a full feature entry point to all
 * AssertJ features (but you can use {@link Filters} if you prefer).
 * <p>
 * Note that the given {@link Iterable} is not modified, the filters are performed on a copy.
 * <p>
 * Typical usage with {@link Condition} :
 *
 * <pre><code class='java'> assertThat(filter(players).being(potentialMVP).get()).containsOnly(james, rose);</code></pre>
 * <p>
 * and with filter language based on java bean property :
 *
 * <pre><code class='java'> assertThat(filter(players).with(&quot;pointsPerGame&quot;).greaterThan(20)
 *                           .and(&quot;assistsPerGame&quot;).greaterThan(7).get())
 *           .containsOnly(james, rose);</code></pre>
 *
 * @param <E> the {@link Iterable} elements type.
 * @param iterableToFilter the {@code Iterable} to filter.
 * @return the created <code>{@link Filters}</code>.
 */
default <E> Filters<E> filter(final Iterable<E> iterableToFilter) {
 return Assertions.filter(iterableToFilter);
}

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

/**
 * Only delegate to {@link Filters#filter(Object[])} so that Assertions offers a full feature entry point to all
 * AssertJ features (but you can use {@link Filters} if you prefer).
 * <p>
 * Note that the given array is not modified, the filters are performed on an {@link Iterable} copy of the array.
 * <p>
 * Typical usage with {@link Condition} :
 *
 * <pre><code class='java'> assertThat(filter(players).being(potentialMVP).get()).containsOnly(james, rose);</code></pre>
 * <p>
 * and with filter language based on java bean property :
 *
 * <pre><code class='java'> assertThat(filter(players).with(&quot;pointsPerGame&quot;).greaterThan(20).and(&quot;assistsPerGame&quot;).greaterThan(7).get())
 *           .containsOnly(james, rose);</code></pre>
 *
 * @param <E> the array elements type.
 * @param array the array to filter.
 * @return the created <code>{@link Filters}</code>.
 */
default <E> Filters<E> filter(final E[] array) {
 return Assertions.filter(array);
}

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

/**
 * Only delegate to {@link Filters#filter(Object[])} so that Assertions offers a full feature entry point to all
 * AssertJ features (but you can use {@link Filters} if you prefer).
 * <p>
 * Note that the given {@link Iterable} is not modified, the filters are performed on a copy.
 * <p>
 * Typical usage with {@link Condition} :
 *
 * <pre><code class='java'> assertThat(filter(players).being(potentialMVP).get()).containsOnly(james, rose);</code></pre>
 * <p>
 * and with filter language based on java bean property :
 *
 * <pre><code class='java'> assertThat(filter(players).with(&quot;pointsPerGame&quot;).greaterThan(20)
 *                           .and(&quot;assistsPerGame&quot;).greaterThan(7).get())
 *           .containsOnly(james, rose);</code></pre>
 *
 * @param <E> the {@link Iterable} elements type.
 * @param iterableToFilter the {@code Iterable} to filter.
 * @return the created <code>{@link Filters}</code>.
 */
default <E> Filters<E> filter(final Iterable<E> iterableToFilter) {
 return Assertions.filter(iterableToFilter);
}

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

/**
  * Delegate call to {@link org.assertj.core.api.Assertions#filter(Iterable)}
  */
 default public <E> Filters<E> filter(final Iterable<E> iterableToFilter) {
  return Assertions.filter(iterableToFilter);
 }
}

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

/**
 * Delegate call to {@link org.assertj.core.api.Assertions#filter(E[])}
 */
default public <E> Filters<E> filter(final E[] array) {
 return Assertions.filter(array);
}

相关文章