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

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

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

AbstractObjectArrayAssert.haveAtLeast介绍

[英]Verifies that there are at least n elements in the actual array satisfying the given condition.

Example :

int[] oneTwoThree = {1, 2, 3}; 
Condition<Integer> oddNumber = new Condition<>(value % 2 == 1, "odd number"); 
// assertion will pass 
oneTwoThree.haveAtLeast(2, oddNumber); 
// assertion will fail 
oneTwoThree.haveAtLeast(3, oddNumber);

This method is an alias for #areAtLeast(int,Condition).
[中]验证实际数组中至少有n个元素满足给定条件。
例子:

int[] oneTwoThree = {1, 2, 3}; 
Condition<Integer> oddNumber = new Condition<>(value % 2 == 1, "odd number"); 
// assertion will pass 
oneTwoThree.haveAtLeast(2, oddNumber); 
// assertion will fail 
oneTwoThree.haveAtLeast(3, oddNumber);

此方法是#AreatLast(int,Condition)的别名。

代码示例

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

/**
 * Verifies that there is <b>at least <i>one</i></b> element in the actual group satisfying the given condition.
 * <p>
 * This method is an alias for {@code haveAtLeast(1, condition)}.
 * <p>
 * Example:
 * <pre><code class='java'> BasketBallPlayer[] bullsPlayers = {butler, rose};
 *
 * // potentialMvp is a Condition&lt;BasketBallPlayer&gt;
 * assertThat(bullsPlayers).haveAtLeastOne(potentialMvp);</code></pre>
 *
 * @see #haveAtLeast(int, Condition)
 */
@Override
public SELF haveAtLeastOne(Condition<? super ELEMENT> condition) {
 return haveAtLeast(1, condition);
}

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

/**
 * Verifies that there is <b>at least <i>one</i></b> element in the actual array satisfying the given condition.
 * <p>
 * This method is an alias for {@code haveAtLeast(1, condition)}.
 * <p>
 * Example:
 * <pre><code class='java'> BasketBallPlayer[] bullsPlayers = {butler, rose};
 *
 * // potentialMvp is a Condition&lt;BasketBallPlayer&gt;
 * assertThat(bullsPlayers).haveAtLeastOne(potentialMvp);</code></pre>
 *
 * @see #haveAtLeast(int, Condition)
 */
@Override
public SELF haveAtLeastOne(Condition<? super ELEMENT> condition) {
 return haveAtLeast(1, condition);
}

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

/** {@inheritDoc} */
@Override
public S haveAtLeastOne(Condition<? super T> condition) {
 return haveAtLeast(1, condition);
}

相关文章