Skip to content

Commit

Permalink
fix AbstractObjectArrayAssert#containsExactlyInAnyOrder javadoc (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalSchumacher committed May 31, 2016
1 parent b04897e commit 2a84286
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/main/java/org/assertj/core/api/AbstractObjectArrayAssert.java
Expand Up @@ -383,19 +383,24 @@ public S containsExactly(@SuppressWarnings("unchecked") T... values) {
}

/**
* Same as {@link #containsExactly(Object...)} but handle the {@link Iterable} to array conversion : verifies that
* actual contains all the elements of the given iterable and nothing else <b>in the same order</b>.
* Verifies that the actual array contains exactly the given values and nothing else, <b>in any order</b>.<br>
*
* <p>
* Example :
* <pre><code class='java'> Ring[] elvesRings = {vilya, nenya, narya};
*
* <pre><code class='java'> Ring[] elvesRings = {vilya, nenya, narya, vilya};
*
* // assertion will pass
* assertThat(elvesRings).containsExactlyElementsOf(newLinkedList(vilya, nenya, narya));
*
* // assertion will fail as actual and expected order differ
* assertThat(elvesRings).containsExactlyElementsOf(newLinkedList(nenya, vilya, narya));</code></pre>
* assertThat(elvesRings).containsExactlyInAnyOrder(vilya, vilya, nenya, narya);
*
* @param iterable the given {@code Iterable} we will get elements from.
* // assertion will fail as vilya exists twice in elvesRings
* assertThat(elvesRings).containsExactlyInAnyOrder(nenya, vilya, narya);</code></pre>
*
* @param values the given values.
* @return {@code this} assertion object.
* @throws NullPointerException if the given argument is {@code null}.
* @throws AssertionError if the actual array is {@code null}.
* @throws AssertionError if the actual arrray does not contain the given values, i.e. the actual array
* contains some or none of the given values, or the actual group contains more values than the given ones.
*/
@Override
public S containsExactlyInAnyOrder(@SuppressWarnings("unchecked") T... values) {
Expand Down

0 comments on commit 2a84286

Please sign in to comment.