How to use toPrimitiveIntArray method of org.assertj.core.api.AbstractIntArrayAssert class

Best Assertj code snippet using org.assertj.core.api.AbstractIntArrayAssert.toPrimitiveIntArray

Source:AbstractIntArrayAssert.java Github

copy

Full Screen

...204 * @since 3.19.0205 */206 public SELF contains(Integer[] values) {207 requireNonNullParameter(values, "values");208 arrays.assertContains(info, actual, toPrimitiveIntArray(values));209 return myself;210 }211 /**212 * Verifies that the actual array contains only the given values and nothing else, in any order.213 * <p>214 * Example:215 * <pre><code class='java'> // assertions will pass216 * assertThat(new int[] { 1, 2, 3 }).containsOnly(1, 2, 3);217 * assertThat(new int[] { 1, 2, 3 }).containsOnly(2, 3, 1);218 * assertThat(new int[] { 1, 1, 2 }).containsOnly(1, 2);219 *220 * // assertions will fail221 * assertThat(new int[] { 1, 2, 3 }).containsOnly(1, 2, 3, 4);222 * assertThat(new int[] { 1, 2, 3 }).containsOnly(4, 7);</code></pre>223 *224 * @param values the given values.225 * @return {@code this} assertion object.226 * @throws NullPointerException if the given argument is {@code null}.227 * @throws IllegalArgumentException if the given argument is an empty array.228 * @throws AssertionError if the actual array is {@code null}.229 * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array contains some230 * or none of the given values, or the actual array contains more values than the given ones.231 */232 public SELF containsOnly(int... values) {233 arrays.assertContainsOnly(info, actual, values);234 return myself;235 }236 /**237 * Verifies that the actual array contains only the values of the given array and nothing else, in any order.238 * <p>239 * Example:240 * <pre><code class='java'> // assertions will pass241 * assertThat(new int[] { 1, 2, 3 }).containsOnly(new Integer[] { 1, 2, 3 });242 * assertThat(new int[] { 1, 2, 3 }).containsOnly(new Integer[] { 2, 3, 1 });243 * assertThat(new int[] { 1, 1, 2 }).containsOnly(new Integer[] { 1, 2 });244 *245 * // assertions will fail246 * assertThat(new int[] { 1, 2, 3 }).containsOnly(new Integer[] { 1, 2, 3, 4 });247 * assertThat(new int[] { 1, 2, 3 }).containsOnly(new Integer[] { 4, 7 });</code></pre>248 *249 * @param values the given values.250 * @return {@code this} assertion object.251 * @throws NullPointerException if the given argument is {@code null}.252 * @throws IllegalArgumentException if the given argument is an empty array.253 * @throws AssertionError if the actual array is {@code null}.254 * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array contains some255 * or none of the given values, or the actual array contains more values than the given ones.256 * @since 3.19.0257 */258 public SELF containsOnly(Integer[] values) {259 requireNonNullParameter(values, "values");260 arrays.assertContainsOnly(info, actual, toPrimitiveIntArray(values));261 return myself;262 }263 /**264 * Verifies that the actual array contains the given values only once.265 * <p>266 * Examples :267 * <pre><code class='java'> // assertion will pass268 * assertThat(new int[] { 1, 2, 3 }).containsOnlyOnce(1, 2);269 *270 * // assertions will fail271 * assertThat(new int[] { 1, 2, 1 }).containsOnlyOnce(1);272 * assertThat(new int[] { 1, 2, 3 }).containsOnlyOnce(4);273 * assertThat(new int[] { 1, 2, 3, 3 }).containsOnlyOnce(0, 1, 2, 3, 4, 5);</code></pre>274 *275 * @param values the given values.276 * @return {@code this} assertion object.277 * @throws NullPointerException if the given argument is {@code null}.278 * @throws IllegalArgumentException if the given argument is an empty array.279 * @throws AssertionError if the actual array is {@code null}.280 * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array contains some281 * or none of the given values, or the actual array contains more than once these values.282 */283 public SELF containsOnlyOnce(int... values) {284 arrays.assertContainsOnlyOnce(info, actual, values);285 return myself;286 }287 /**288 * Verifies that the actual array contains the values of the given array only once.289 * <p>290 * Examples :291 * <pre><code class='java'> // assertion will pass292 * assertThat(new int[] { 1, 2, 3 }).containsOnlyOnce(new Integer[] { 1, 2 });293 *294 * // assertions will fail295 * assertThat(new int[] { 1, 2, 1 }).containsOnlyOnce(new Integer[] { 1 });296 * assertThat(new int[] { 1, 2, 3 }).containsOnlyOnce(new Integer[] { 4 });297 * assertThat(new int[] { 1, 2, 3, 3 }).containsOnlyOnce(new Integer[] { 0, 1, 2, 3, 4, 5 });</code></pre>298 *299 * @param values the given values.300 * @return {@code this} assertion object.301 * @throws NullPointerException if the given argument is {@code null}.302 * @throws IllegalArgumentException if the given argument is an empty array.303 * @throws AssertionError if the actual array is {@code null}.304 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group contains some305 * or none of the given values, or the actual group contains more than once these values.306 * @since 3.19.0307 */308 public SELF containsOnlyOnce(Integer[] values) {309 requireNonNullParameter(values, "values");310 arrays.assertContainsOnlyOnce(info, actual, toPrimitiveIntArray(values));311 return myself;312 }313 /**314 * Verifies that the actual array contains the given sequence, without any other values between them.315 * <p>316 * Example:317 * <pre><code class='java'> // assertion will pass318 * assertThat(new int[] { 1, 2, 3 }).containsSequence(1, 2);319 *320 * // assertion will fail321 * assertThat(new int[] { 1, 2, 3 }).containsSequence(1, 3);322 * assertThat(new int[] { 1, 2, 3 }).containsSequence(2, 1);</code></pre>323 *324 * @param sequence the sequence of values to look for.325 * @return myself assertion object.326 * @throws AssertionError if the actual array is {@code null}.327 * @throws AssertionError if the given array is {@code null}.328 * @throws AssertionError if the actual array does not contain the given sequence.329 */330 public SELF containsSequence(int... sequence) {331 arrays.assertContainsSequence(info, actual, sequence);332 return myself;333 }334 /**335 * Verifies that the actual array contains the given sequence, without any other values between them.336 * <p>337 * Example:338 * <pre><code class='java'> // assertion will pass339 * assertThat(new int[] { 1, 2, 3 }).containsSequence(new Integer[] { 1, 2 });340 *341 * // assertion will fail342 * assertThat(new int[] { 1, 2, 3 }).containsSequence(new Integer[] { 1, 3 });343 * assertThat(new int[] { 1, 2, 3 }).containsSequence(new Integer[] { 2, 1 });</code></pre>344 *345 * @param sequence the sequence of values to look for.346 * @return myself assertion object.347 * @throws AssertionError if the actual array is {@code null}.348 * @throws AssertionError if the given array is {@code null}.349 * @throws AssertionError if the actual array does not contain the given sequence.350 * @since 3.19.0351 */352 public SELF containsSequence(Integer[] sequence) {353 requireNonNullParameter(sequence, "sequence");354 arrays.assertContainsSequence(info, actual, toPrimitiveIntArray(sequence));355 return myself;356 }357 /**358 * Verifies that the actual array contains the given subsequence (possibly with other values between them).359 * <p>360 * Example:361 * <pre><code class='java'> // assertion will pass362 * assertThat(new int[] { 1, 2, 3 }).containsSubsequence(1, 2);363 * assertThat(new int[] { 1, 2, 3 }).containsSubsequence(1, 3);364 *365 * // assertion will fail366 * assertThat(new int[] { 1, 2, 3 }).containsSubsequence(2, 1);</code></pre>367 *368 * @param subsequence the subsequence of values to look for.369 * @return myself assertion object.370 * @throws AssertionError if the actual array is {@code null}.371 * @throws AssertionError if the given array is {@code null}.372 * @throws AssertionError if the actual array does not contain the given subsequence.373 */374 public SELF containsSubsequence(int... subsequence) {375 arrays.assertContainsSubsequence(info, actual, subsequence);376 return myself;377 }378 /**379 * Verifies that the actual array contains the given subsequence (possibly with other values between them).380 * <p>381 * Example:382 * <pre><code class='java'> // assertion will pass383 * assertThat(new int[] { 1, 2, 3 }).containsSubsequence(new Integer[] { 1, 2 });384 * assertThat(new int[] { 1, 2, 3 }).containsSubsequence(new Integer[] { 1, 3 });385 *386 * // assertion will fail387 * assertThat(new int[] { 1, 2, 3 }).containsSubsequence(new Integer[] { 2, 1 });</code></pre>388 *389 * @param subsequence the subsequence of values to look for.390 * @return myself assertion object.391 * @throws AssertionError if the actual array is {@code null}.392 * @throws AssertionError if the given array is {@code null}.393 * @throws AssertionError if the actual array does not contain the given subsequence.394 * @since 3.19.0395 */396 public SELF containsSubsequence(Integer[] subsequence) {397 requireNonNullParameter(subsequence, "subsequence");398 arrays.assertContainsSubsequence(info, actual, toPrimitiveIntArray(subsequence));399 return myself;400 }401 /**402 * Verifies that the actual array contains the given value at the given index.403 * <p>404 * Example:405 * <pre><code class='java'> // assertions will pass406 * assertThat(new int[] { 1, 2, 3 }).contains(1, atIndex(O));407 * assertThat(new int[] { 1, 2, 3 }).contains(3, atIndex(2));408 *409 * // assertions will fail410 * assertThat(new int[] { 1, 2, 3 }).contains(1, atIndex(1));411 * assertThat(new int[] { 1, 2, 3 }).contains(4, atIndex(2));</code></pre>412 *413 * @param value the value to look for.414 * @param index the index where the value should be stored in the actual array.415 * @return myself assertion object.416 * @throws AssertionError if the actual array is {@code null} or empty.417 * @throws NullPointerException if the given {@code Index} is {@code null}.418 * @throws IndexOutOfBoundsException if the value of the given {@code Index} is equal to or greater than the size of419 * the actual array.420 * @throws AssertionError if the actual array does not contain the given value at the given index.421 */422 public SELF contains(int value, Index index) {423 arrays.assertContains(info, actual, value, index);424 return myself;425 }426 /**427 * Verifies that the actual array does not contain the given values.428 * <p>429 * Example:430 * <pre><code class='java'> // assertion will pass431 * assertThat(new int[] { 1, 2, 3 }).doesNotContain(4);432 *433 * // assertion will fail434 * assertThat(new int[] { 1, 2, 3 }).doesNotContain(2);</code></pre>435 *436 * @param values the given values.437 * @return {@code this} assertion object.438 * @throws NullPointerException if the given argument is {@code null}.439 * @throws IllegalArgumentException if the given argument is an empty array.440 * @throws AssertionError if the actual array is {@code null}.441 * @throws AssertionError if the actual array contains any of the given values.442 */443 public SELF doesNotContain(int... values) {444 arrays.assertDoesNotContain(info, actual, values);445 return myself;446 }447 /**448 * Verifies that the actual array does not contain the values of the given array.449 * <p>450 * Example:451 * <pre><code class='java'> // assertion will pass452 * assertThat(new int[] { 1, 2, 3 }).doesNotContain(new Integer[] { 4 });453 *454 * // assertion will fail455 * assertThat(new int[] { 1, 2, 3 }).doesNotContain(new Integer[] { 2 });</code></pre>456 *457 * @param values the given values.458 * @return {@code this} assertion object.459 * @throws NullPointerException if the given argument is {@code null}.460 * @throws IllegalArgumentException if the given argument is an empty array.461 * @throws AssertionError if the actual array is {@code null}.462 * @throws AssertionError if the actual array contains any of the given values.463 * @since 3.19.0464 */465 public SELF doesNotContain(Integer[] values) {466 requireNonNullParameter(values, "values");467 arrays.assertDoesNotContain(info, actual, toPrimitiveIntArray(values));468 return myself;469 }470 /**471 * Verifies that the actual array does not contain the given value at the given index.472 * <p>473 * Example:474 * <pre><code class='java'> // assertions will pass475 * assertThat(new int[] { 1, 2, 3 }).doesNotContain(1, atIndex(1));476 * assertThat(new int[] { 1, 2, 3 }).doesNotContain(2, atIndex(0));477 *478 * // assertions will fail479 * assertThat(new int[] { 1, 2, 3 }).doesNotContain(1, atIndex(0));480 * assertThat(new int[] { 1, 2, 3 }).doesNotContain(2, atIndex(1));</code></pre>481 *482 * @param value the value to look for.483 * @param index the index where the value should be stored in the actual array.484 * @return myself assertion object.485 * @throws AssertionError if the actual array is {@code null}.486 * @throws NullPointerException if the given {@code Index} is {@code null}.487 * @throws AssertionError if the actual array contains the given value at the given index.488 */489 public SELF doesNotContain(int value, Index index) {490 arrays.assertDoesNotContain(info, actual, value, index);491 return myself;492 }493 /**494 * Verifies that the actual array does not contain duplicates.495 * <p>496 * Example:497 * <pre><code class='java'> // assertion will pass498 * assertThat(new int[] { 1, 2, 3 }).doesNotHaveDuplicates();499 *500 * // assertion will fail501 * assertThat(new int[] { 1, 1, 2, 3 }).doesNotHaveDuplicates();</code></pre>502 *503 * @return {@code this} assertion object.504 * @throws AssertionError if the actual array is {@code null}.505 * @throws AssertionError if the actual array contains duplicates.506 */507 public SELF doesNotHaveDuplicates() {508 arrays.assertDoesNotHaveDuplicates(info, actual);509 return myself;510 }511 /**512 * Verifies that the actual array starts with the given sequence of values, without any other values between them.513 * Similar to <code>{@link #containsSequence(int...)}</code>, but it also verifies that the first element in the514 * sequence is also first element of the actual array.515 * <p>516 * Example:517 * <pre><code class='java'> // assertion will pass518 * assertThat(new int[] { 1, 2, 3 }).startsWith(1, 2);519 *520 * // assertion will fail521 * assertThat(new int[] { 1, 2, 3 }).startsWith(2, 3);</code></pre>522 *523 * @param sequence the sequence of values to look for.524 * @return myself assertion object.525 * @throws NullPointerException if the given argument is {@code null}.526 * @throws IllegalArgumentException if the given argument is an empty array.527 * @throws AssertionError if the actual array is {@code null}.528 * @throws AssertionError if the actual array does not start with the given sequence.529 */530 public SELF startsWith(int... sequence) {531 arrays.assertStartsWith(info, actual, sequence);532 return myself;533 }534 /**535 * Verifies that the actual array starts with the given sequence of values, without any other values between them.536 * Similar to <code>{@link #containsSequence(int...)}</code>, but it also verifies that the first element in the537 * sequence is also first element of the actual array.538 * <p>539 * Example:540 * <pre><code class='java'> // assertion will pass541 * assertThat(new int[] { 1, 2, 3 }).startsWith(new Integer[] { 1, 2 });542 *543 * // assertion will fail544 * assertThat(new int[] { 1, 2, 3 }).startsWith(new Integer[] { 2, 3 });</code></pre>545 *546 * @param sequence the sequence of values to look for.547 * @return myself assertion object.548 * @throws NullPointerException if the given argument is {@code null}.549 * @throws IllegalArgumentException if the given argument is an empty array.550 * @throws AssertionError if the actual array is {@code null}.551 * @throws AssertionError if the actual array does not start with the given sequence.552 * @since 3.19.0553 */554 public SELF startsWith(Integer[] sequence) {555 requireNonNullParameter(sequence, "sequence");556 arrays.assertStartsWith(info, actual, toPrimitiveIntArray(sequence));557 return myself;558 }559 /**560 * Verifies that the actual array ends with the given sequence of values, without any other values between them.561 * Similar to <code>{@link #containsSequence(int...)}</code>, but it also verifies that the last element in the562 * sequence is also last element of the actual array.563 * <p>564 * Example:565 * <pre><code class='java'> // assertion will pass566 * assertThat(new int[] { 1, 2, 3 }).endsWith(2, 3);567 *568 * // assertion will fail569 * assertThat(new int[] { 1, 2, 3 }).endsWith(3, 4);</code></pre>570 *571 * @param sequence the sequence of values to look for.572 * @return myself assertion object.573 * @throws NullPointerException if the given argument is {@code null}.574 * @throws IllegalArgumentException if the given argument is an empty array.575 * @throws AssertionError if the actual array is {@code null}.576 * @throws AssertionError if the actual array does not end with the given sequence.577 */578 public SELF endsWith(int... sequence) {579 arrays.assertEndsWith(info, actual, sequence);580 return myself;581 }582 /**583 * Verifies that the actual array ends with the given sequence of values, without any other values between them.584 * Similar to <code>{@link #containsSequence(int...)}</code>, but it also verifies that the last element in the585 * sequence is also last element of the actual array.586 * <p>587 * Example:588 * <pre><code class='java'> // assertion will pass589 * assertThat(new int[] { 1, 2, 3 }).endsWith(new Integer[] { 2, 3 });590 *591 * // assertion will fail592 * assertThat(new int[] { 1, 2, 3 }).endsWith(new Integer[] { 3, 4 });</code></pre>593 *594 * @param sequence the sequence of values to look for.595 * @return myself assertion object.596 * @throws NullPointerException if the given argument is {@code null}.597 * @throws IllegalArgumentException if the given argument is an empty array.598 * @throws AssertionError if the actual array is {@code null}.599 * @throws AssertionError if the actual array does not end with the given sequence.600 * @since 3.19.0601 */602 public SELF endsWith(Integer[] sequence) {603 requireNonNullParameter(sequence, "sequence");604 arrays.assertEndsWith(info, actual, toPrimitiveIntArray(sequence));605 return myself;606 }607 /** {@inheritDoc} */608 @Override609 public SELF isSorted() {610 arrays.assertIsSorted(info, actual);611 return myself;612 }613 /** {@inheritDoc} */614 @Override615 public SELF isSortedAccordingTo(Comparator<? super Integer> comparator) {616 arrays.assertIsSortedAccordingToComparator(info, actual, comparator);617 return myself;618 }619 /** {@inheritDoc} */620 @Override621 @CheckReturnValue622 public SELF usingElementComparator(Comparator<? super Integer> customComparator) {623 this.arrays = new IntArrays(new ComparatorBasedComparisonStrategy(customComparator));624 return myself;625 }626 /** {@inheritDoc} */627 @Override628 @CheckReturnValue629 public SELF usingDefaultElementComparator() {630 this.arrays = IntArrays.instance();631 return myself;632 }633 /**634 * Verifies that the actual array contains only the given values and nothing else, <b>in order</b>.635 * <p>636 * Example :637 * <pre><code class='java'> int[] ints = { 1, 2, 3 };638 *639 * // assertion will pass640 * assertThat(ints).containsExactly(1, 2, 3);641 *642 * // assertion will fail as actual and expected order differ643 * assertThat(ints).containsExactly(2, 1, 3);</code></pre>644 *645 * @param values the given values.646 * @return {@code this} assertion object.647 * @throws NullPointerException if the given argument is {@code null}.648 * @throws AssertionError if the actual array is {@code null}.649 * @throws AssertionError if the actual array does not contain the given values with same order, i.e. the actual array650 * contains some or none of the given values, or the actual array contains more values than the given ones651 * or values are the same but the order is not.652 */653 public SELF containsExactly(int... values) {654 arrays.assertContainsExactly(info, actual, values);655 return myself;656 }657 /**658 * Verifies that the actual group contains only the values of the given array and nothing else, <b>in order</b>.659 * <p>660 * Example :661 * <pre><code class='java'> // assertion will pass662 * assertThat(new int[] { 1, 2, 3 }).containsExactly(new Integer[] { 1, 2, 3 });663 *664 * // assertion will fail as actual and expected order differ665 * assertThat(new int[] { 1, 2, 3 }).containsExactly(new Integer[] { 1, 3, 2 });</code></pre>666 *667 * @param values the given values.668 * @return {@code this} assertion object.669 * @throws NullPointerException if the given argument is {@code null}.670 * @throws AssertionError if the actual group is {@code null}.671 * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group672 * contains some or none of the given values, or the actual group contains more values than the given ones673 * or values are the same but the order is not.674 * @since 3.19.0675 */676 public SELF containsExactly(Integer[] values) {677 requireNonNullParameter(values, "values");678 arrays.assertContainsExactly(info, actual, toPrimitiveIntArray(values));679 return myself;680 }681 /**682 * Verifies that the actual array contains exactly the given values and nothing else, <b>in any order</b>.<br>683 * <p>684 * Example :685 * <pre><code class='java'> // assertions will pass686 * assertThat(new int[] { 1, 2 }).containsExactlyInAnyOrder(1, 2);687 * assertThat(new int[] { 1, 2, 1 }).containsExactlyInAnyOrder(1, 1, 2);688 *689 * // assertions will fail690 * assertThat(new int[] { 1, 2 }).containsExactlyInAnyOrder(1);691 * assertThat(new int[] { 1 }).containsExactlyInAnyOrder(1, 2);692 * assertThat(new int[] { 1, 2, 1 }).containsExactlyInAnyOrder(1, 2);</code></pre>693 *694 * @param values the given values.695 * @return {@code this} assertion object.696 * @throws NullPointerException if the given argument is {@code null}.697 * @throws AssertionError if the actual array is {@code null}.698 * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array699 * contains some or none of the given values, or the actual array contains more values than the given ones.700 * @since 2.6.0 / 3.6.0701 */702 public SELF containsExactlyInAnyOrder(int... values) {703 arrays.assertContainsExactlyInAnyOrder(info, actual, values);704 return myself;705 }706 /**707 * Verifies that the actual group contains exactly the values of the given array and nothing else, <b>in any order</b>.<br>708 * <p>709 * Example :710 * <pre><code class='java'> // assertions will pass711 * assertThat(new int[] { 1, 2 }).containsExactlyInAnyOrder(new Integer[] { 2, 1 });712 * assertThat(new int[] { 1, 2, 3 }).containsExactlyInAnyOrder(new Integer[] { 3, 2, 1 });713 *714 * // assertions will fail715 * assertThat(new int[] { 1, 2 }).containsExactlyInAnyOrder(new Integer[] { 1, 4 });716 * assertThat(new int[] { 1 }).containsExactlyInAnyOrder(new Integer[] { 4, 1 });717 * assertThat(new int[] { 1, 2, 3 }).containsExactlyInAnyOrder(new Integer[] { 1, 2 });</code></pre>718 *719 * @param values the given values.720 * @return {@code this} assertion object.721 * @throws NullPointerException if the given argument is {@code null}.722 * @throws AssertionError if the actual group is {@code null}.723 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group724 * contains some or none of the given values, or the actual group contains more values than the given ones.725 * @since 3.19.0726 */727 public SELF containsExactlyInAnyOrder(Integer[] values) {728 requireNonNullParameter(values, "values");729 arrays.assertContainsExactlyInAnyOrder(info, actual, toPrimitiveIntArray(values));730 return myself;731 }732 /**733 * Verifies that the actual array contains at least one of the given values.734 * <p>735 * Example :736 * <pre><code class='java'> int[] oneTwoThree = { 1, 2, 3 };737 *738 * // assertions will pass739 * assertThat(oneTwoThree).containsAnyOf(2)740 * .containsAnyOf(2, 3)741 * .containsAnyOf(1, 2, 3)742 * .containsAnyOf(1, 2, 3, 4)743 * .containsAnyOf(5, 6, 7, 2);744 *745 * // assertions will fail746 * assertThat(oneTwoThree).containsAnyOf(4);747 * assertThat(oneTwoThree).containsAnyOf(4, 5, 6, 7);</code></pre>748 *749 * @param values the values whose at least one which is expected to be in the array under test.750 * @return {@code this} assertion object.751 * @throws NullPointerException if the array of values is {@code null}.752 * @throws IllegalArgumentException if the array of values is empty and the array under test is not empty.753 * @throws AssertionError if the array under test is {@code null}.754 * @throws AssertionError if the array under test does not contain any of the given {@code values}.755 * @since 2.9.0 / 3.9.0756 */757 public SELF containsAnyOf(int... values) {758 arrays.assertContainsAnyOf(info, actual, values);759 return myself;760 }761 /**762 * Verifies that the actual array contains at least one of the values of the given array.763 * <p>764 * Example :765 * <pre><code class='java'> int[] oneTwoThree = { 1, 2, 3 };766 *767 * // assertions will pass768 * assertThat(oneTwoThree).containsAnyOf(new Integer[] { 2 })769 * .containsAnyOf(new Integer[] { 2, 3 })770 * .containsAnyOf(new Integer[] { 1, 2, 3 })771 * .containsAnyOf(new Integer[] { 1, 2, 3, 4 })772 * .containsAnyOf(new Integer[] { 5, 6, 7, 2 });773 *774 * // assertions will fail775 * assertThat(oneTwoThree).containsAnyOf(new Integer[] { 4 });776 * assertThat(oneTwoThree).containsAnyOf(new Integer[] { 4, 5, 6, 7 });</code></pre>777 *778 * @param values the values whose at least one which is expected to be in the array under test.779 * @return {@code this} assertion object.780 * @throws NullPointerException if the array of values is {@code null}.781 * @throws IllegalArgumentException if the array of values is empty and the array under test is not empty.782 * @throws AssertionError if the array under test is {@code null}.783 * @throws AssertionError if the array under test does not contain any of the given {@code values}.784 * @since 3.19.0785 */786 public SELF containsAnyOf(Integer[] values) {787 requireNonNullParameter(values, "values");788 arrays.assertContainsAnyOf(info, actual, toPrimitiveIntArray(values));789 return myself;790 }791 private static int[] toPrimitiveIntArray(Integer[] values) {792 return Arrays.stream(values).mapToInt(Integer::intValue).toArray();793 }794}...

Full Screen

Full Screen

toPrimitiveIntArray

Using AI Code Generation

copy

Full Screen

1import org.assertj.core.api.Assert;2import org.assertj.core.api.Assertions;3import org.assertj.core.api.SoftAssertions;4import org.assertj.core.api.ThrowableAssert.ThrowingCallable;5import org.assertj.core.api.WritableAssertionInfo;6import org.assertj.core.error.ShouldBeEqual;7import org.assertj.core.error.ShouldBeGreater;8import org.assertj.core.error.ShouldBeGreaterOrEqual;9import org.assertj.core.error.ShouldBeLess;10import org.assertj.core.error.ShouldBeLessOrEqual;11import org.assertj.core.error.ShouldContain;12import org.assertj.core.error.ShouldContainOnly;13import org.assertj.core.error.ShouldEndWith;14import org.assertj.core.error.ShouldHave;15import org.assertj.core.error.ShouldHaveSameClassAs;16import org.assertj.core.error.ShouldHaveSameSizeAs;17import org.assertj.core.error.ShouldHaveToString;18import org.assertj.core.error.ShouldNotBeEqual;19import org.assertj.core.error.ShouldNotContain;20import org.assertj.core.error.ShouldNotContainNull;21import org.assertj.core.error.ShouldNotHave;22import org.assertj.core.error.ShouldNotHaveSameClassAs;23import org.assertj.core.error.ShouldNotHaveSameSizeAs;24import org.assertj.core.error.ShouldNotHaveToString;25import org.assertj.core.error.ShouldNotStartWith;26import org.assertj.core.error.ShouldStartWith;27import org.assertj.core.error.ShouldThrow;28import org.assertj.core.internal.CommonErrors;29import org.assertj.core.internal.ComparatorBasedComparisonStrategy;30import org.assertj.core.internal.ComparisonStrategy;31import org.assertj.core.internal.Failures;32import org.assertj.core.internal.IntArrays;33import org.assertj.core.internal.Objects;34import org.assertj.core.presentation.Representation;35import org.assertj.core.util.CheckReturnValue;36import org.assertj.core.util.VisibleForTesting;37import java.util.Comparator;38import java.util.List;39import java.util.function.BiConsumer;40import java.util.function.Consumer;41import java.util.function.Function;42import java.util.function.Predicate;43import java.util.stream.IntStream;44import static java.lang.String.format;45import static org.assertj.core.api.Assertions.assertThat;46import static org.assertj.core.error.ShouldContainOnly.shouldContainOnly;47import static org.assertj.core.error.ShouldContainOnlyNulls.shouldContainOnlyNulls;48import static org.assertj.core.error.ShouldContainNull.shouldContainNull;49import static org.assertj.core.error.ShouldHaveSize.shouldHaveSize;50import static org.assertj.core.error.ShouldNotContainNulls.shouldNotContainNulls;51import static org.assertj.core.error.ShouldNotHaveSize.shouldNotHaveSize;52import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty;53import static org.assertj.core.error.ShouldBeEmpty

Full Screen

Full Screen

toPrimitiveIntArray

Using AI Code Generation

copy

Full Screen

1import static org.assertj.core.api.Assertions.assertThat;2import static org.assertj.core.api.Assertions.atIndex;3int[] actual = { 1, 2, 3 };4assertThat(actual).usingElementComparatorIgnoringFields("name").containsExactly(1, 2, 3);5import static org.assertj.core.api.Assertions.assertThat;6import static org.assertj.core.api.Assertions.atIndex;7long[] actual = { 1L, 2L, 3L };8assertThat(actual).usingElementComparatorIgnoringFields("name").containsExactly(1L, 2L, 3L);9import static org.assertj.core.api.Assertions.assertThat;10import static org.assertj.core.api.Assertions.atIndex;11short[] actual = { 1, 2, 3 };12assertThat(actual).usingElementComparatorIgnoringFields("name").containsExactly(1, 2, 3);13import static org.assertj.core.api.Assertions.assertThat;14import static org.assertj.core.api.Assertions.atIndex;15boolean[] actual = { true, false, true };16assertThat(actual

Full Screen

Full Screen

toPrimitiveIntArray

Using AI Code Generation

copy

Full Screen

1int[] emptyIntArray = new int[0];2int[] intArray = { 1, 2, 3, 4, 5 };3assertThat(emptyIntArray).toPrimitiveIntArray().isEmpty();4assertThat(intArray).toPrimitiveIntArray().containsExactly(1, 2, 3, 4, 5);5assertThat(emptyIntArray).toPrimitiveIntArray().isEmpty();6assertThat(intArray).toPrimitiveIntArray().containsExactly(1, 2, 3, 4, 5);7assertThat(emptyIntArray).toPrimitiveIntArray().isEmpty();8assertThat(intArray).toPrimitiveIntArray().containsExactly(1, 2, 3, 4, 5);9assertThat(emptyIntArray).toPrimitiveIntArray().isEmpty();10assertThat(intArray).toPrimitiveIntArray().containsExactly(1, 2, 3, 4, 5);11assertThat(emptyIntArray).toPrimitiveIntArray().isEmpty();12assertThat(intArray).toPrimitiveIntArray().containsExactly(1, 2, 3, 4, 5);13assertThat(emptyIntArray).toPrimitiveIntArray().isEmpty();14assertThat(intArray).toPrimitiveIntArray().containsExactly(1, 2, 3, 4, 5);15assertThat(emptyIntArray).toPrimitiveIntArray().isEmpty();16assertThat(intArray).toPrimitiveIntArray().containsExactly(1, 2, 3, 4, 5);17assertThat(emptyIntArray).toPrimitiveIntArray().isEmpty();18assertThat(intArray).toPrimitiveIntArray().containsExactly(1, 2, 3, 4, 5);19assertThat(emptyIntArray).toPrimitiveIntArray().isEmpty();

Full Screen

Full Screen

toPrimitiveIntArray

Using AI Code Generation

copy

Full Screen

1public class IntArrayAssert_primitiveIntArray_Test {2 public void test_primitiveIntArray() {3 Integer[] integers = {1, 2, 3};4 int[] ints = Assertions.assertThat(integers).usingRecursiveComparison().isEqualTo(integers).primitiveIntArray();5 assertThat(ints).containsExactly(1, 2, 3);6 }7}8This is the output of the test using the primitiveIntArray() method:9This is the output of the test using the usingElementComparator(Comparator) method:10This is the output of the test using the usingComparatorForType(Comparator, Class) method:11This is the output of the test using the usingComparatorForFields(Comparator, String...) method:12This is the output of the test using the usingComparatorForFields(Comparator, Iterable) method:13This is the output of the test using the usingComparatorForFields(

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful