/** * <p> * Verifies that the actual group contains only the given values and nothing else, <b>in order</b>. * <p> * If you want to set a precision for the comparison either use {@link #containsExactly(double[], Offset)} * or {@link #usingComparatorWithPrecision(Double)} before calling the assertion. * <p> * Example : * <pre><code class='java'> double[] values = new double[] { 1.0, 2.0, 3.0 }; * * // assertions will pass * assertThat(values).containsExactly(1.0, 2.0, 3.0) * .usingComparatorWithPrecision(0.2) * .containsExactly(1.1, 2.1, 2.9); * * // assertion will fail as actual and expected order differ * assertThat(values).containsExactly(2.0, 1.0, 3.0);</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 group is {@code null}. * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group * contains some or none of the given values, or the actual group contains more values than the given ones * or values are the same but the order is not. */ public SELF containsExactly(double... values) { arrays.assertContainsExactly(info, actual, values); return myself; }
/** * <p> * Verifies that the actual group contains only the given values and nothing else, <b>in order</b>. * <p> * If you want to set a precision for the comparison either use {@link #containsExactly(double[], Offset)} * or {@link #usingComparatorWithPrecision(Double)} before calling the assertion. * <p> * Example : * <pre><code class='java'> double[] values = new double[] { 1.0, 2.0, 3.0 }; * * // assertions will pass * assertThat(values).containsExactly(1.0, 2.0, 3.0) * .usingComparatorWithPrecision(0.2) * .containsExactly(1.1, 2.1, 2.9); * * // assertion will fail as actual and expected order differ * assertThat(values).containsExactly(2.0, 1.0, 3.0);</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 group is {@code null}. * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group * contains some or none of the given values, or the actual group contains more values than the given ones * or values are the same but the order is not. */ public SELF containsExactly(double... values) { arrays.assertContainsExactly(info, actual, values); return myself; }