/** * Verifies that the actual array contains only the given values and nothing else, in any order. * <p> * Example: * <pre><code class='java'> // assertions will pass * assertThat(new byte[] { 1, 2, 3 }).containsOnly((byte) 1, (byte) 2, (byte) 3); * assertThat(new byte[] { 1, 2, 3 }).containsOnly((byte) 2, (byte) 3, (byte) 1); * assertThat(new byte[] { 1, 1, 2 }).containsOnly((byte) 1, (byte) 2); * * // assertions will fail * assertThat(new byte[] { 1, 2, 3 }).containsOnly((byte) 1, (byte) 2, (byte) 3, (byte) 4); * assertThat(new byte[] { 1, 2, 3 }).containsOnly((byte) 4, (byte) 7);</code></pre> * * @param values the given values. * @return {@code this} assertion object. * @throws NullPointerException if the given argument is {@code null}. * @throws IllegalArgumentException if the given argument is an empty array. * @throws AssertionError if the actual array is {@code null}. * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array * contains some * or none of the given values, or the actual array contains more values than the * given ones. */ public SELF containsOnly(byte... values) { arrays.assertContainsOnly(info, actual, values); return myself; }
/** * Verifies that the actual array contains only the given values and nothing else, in any order. * <p> * Example: * <pre><code class='java'> // assertion will pass * assertThat(new byte[] { 1, 2, 3 }).containsOnly(1, 2, 3); * assertThat(new byte[] { 1, 2, 3 }).containsOnly(2, 3, 1); * assertThat(new byte[] { 1, 1, 2 }).containsOnly(1, 2); * * // assertion will fail * assertThat(new byte[] { 1, 2, 3 }).containsOnly(1, 2, 3, 4); * assertThat(new byte[] { 1, 2, 3 }).containsOnly(4, 7);</code></pre> * * @param values the given values. * @return {@code this} assertion object. * @throws NullPointerException if the given argument is {@code null}. * @throws IllegalArgumentException if the given argument is an empty array. * @throws AssertionError if the actual array is {@code null}. * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array * contains some * or none of the given values, or the actual array contains more values than the * given ones. * @since 2.6.0 / 3.6.0 */ public SELF containsOnly(int... values) { arrays.assertContainsOnly(info, actual, values); return myself; }
/** * Verifies that the actual array contains only the given values and nothing else, in any order. * <p> * Example: * <pre><code class='java'> // assertion will pass * assertThat(new byte[] { 1, 2, 3 }).containsOnly(1, 2, 3); * assertThat(new byte[] { 1, 2, 3 }).containsOnly(2, 3, 1); * assertThat(new byte[] { 1, 1, 2 }).containsOnly(1, 2); * * // assertion will fail * assertThat(new byte[] { 1, 2, 3 }).containsOnly(1, 2, 3, 4); * assertThat(new byte[] { 1, 2, 3 }).containsOnly(4, 7);</code></pre> * * @param values the given values. * @return {@code this} assertion object. * @throws NullPointerException if the given argument is {@code null}. * @throws IllegalArgumentException if the given argument is an empty array. * @throws AssertionError if the actual array is {@code null}. * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array * contains some * or none of the given values, or the actual array contains more values than the * given ones. * @since 2.6.0 / 3.6.0 */ public SELF containsOnly(int... values) { arrays.assertContainsOnly(info, actual, values); return myself; }
/** * Verifies that the actual array contains only the given values and nothing else, in any order. * <p> * Example: * <pre><code class='java'> // assertions will pass * assertThat(new byte[] { 1, 2, 3 }).containsOnly((byte) 1, (byte) 2, (byte) 3); * assertThat(new byte[] { 1, 2, 3 }).containsOnly((byte) 2, (byte) 3, (byte) 1); * assertThat(new byte[] { 1, 1, 2 }).containsOnly((byte) 1, (byte) 2); * * // assertions will fail * assertThat(new byte[] { 1, 2, 3 }).containsOnly((byte) 1, (byte) 2, (byte) 3, (byte) 4); * assertThat(new byte[] { 1, 2, 3 }).containsOnly((byte) 4, (byte) 7);</code></pre> * * @param values the given values. * @return {@code this} assertion object. * @throws NullPointerException if the given argument is {@code null}. * @throws IllegalArgumentException if the given argument is an empty array. * @throws AssertionError if the actual array is {@code null}. * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array * contains some * or none of the given values, or the actual array contains more values than the * given ones. */ public SELF containsOnly(byte... values) { arrays.assertContainsOnly(info, actual, values); return myself; }
arrays.assertContainsOnly(info, actual, values); return myself;