How to use toPrimitiveLongArray method of org.assertj.core.api.AbstractLongArrayAssert class

Best Assertj code snippet using org.assertj.core.api.AbstractLongArrayAssert.toPrimitiveLongArray

Source:AbstractLongArrayAssert.java Github

copy

Full Screen

...204 * @since 3.19.0205 */206 public SELF contains(Long[] values) {207 requireNonNullParameter(values, "values");208 arrays.assertContains(info, actual, toPrimitiveLongArray(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 long[] { 1L, 2L, 3L }).containsOnly(1L, 2L, 3L);217 * assertThat(new long[] { 1L, 2L, 3L }).containsOnly(2L, 3L, 1L);218 * assertThat(new long[] { 1L, 1L, 2L }).containsOnly(1L, 2L);219 *220 * // assertions will fail221 * assertThat(new long[] { 1L, 2L, 3L }).containsOnly(1L, 2L, 3L, 4L);222 * assertThat(new long[] { 1L, 2L, 3L }).containsOnly(4L, 7L);</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(long... 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 long[] { 1L, 2L, 3L }).containsOnly(new Long[] { 1L, 2L, 3L });242 * assertThat(new long[] { 1L, 2L, 3L }).containsOnly(new Long[] { 2L, 3L, 1L });243 * assertThat(new long[] { 1L, 1L, 2L }).containsOnly(new Long[] { 1L, 2L });244 *245 * // assertions will fail246 * assertThat(new long[] { 1L, 2L, 3L }).containsOnly(new Long[] { 1L, 2L, 3L, 4L });247 * assertThat(new long[] { 1L, 2L, 3L }).containsOnly(new Long[] { 4L, 7L });</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(Long[] values) {259 requireNonNullParameter(values, "values");260 arrays.assertContainsOnly(info, actual, toPrimitiveLongArray(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 long[] { 1, 2, 3 }).containsOnlyOnce(1, 2);269 *270 * // assertions will fail271 * assertThat(new long[] { 1, 2, 1 }).containsOnlyOnce(1);272 * assertThat(new long[] { 1, 2, 3 }).containsOnlyOnce(4);273 * assertThat(new long[] { 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 group does not contain the given values, i.e. the actual group contains some281 * or none of the given values, or the actual group contains more than once these values.282 */283 public SELF containsOnlyOnce(long... 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 long[] { 1, 2, 3 }).containsOnlyOnce(new Long[] { 1, 2 });293 *294 * // assertions will fail295 * assertThat(new long[] { 1, 2, 1 }).containsOnlyOnce(new Long[] { 1 });296 * assertThat(new long[] { 1, 2, 3 }).containsOnlyOnce(new Long[] { 4 });297 * assertThat(new long[] { 1, 2, 3, 3 }).containsOnlyOnce(new Long[] { 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(Long[] values) {309 requireNonNullParameter(values, "values");310 arrays.assertContainsOnlyOnce(info, actual, toPrimitiveLongArray(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 long[] { 1, 2, 3 }).containsSequence(1, 2);319 *320 * // assertion will fail321 * assertThat(new long[] { 1, 2, 3 }).containsSequence(1, 3);322 * assertThat(new long[] { 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(long... 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 long[] { 1, 2, 3 }).containsSequence(new Long[] { 1, 2 });340 *341 * // assertion will fail342 * assertThat(new long[] { 1, 2, 3 }).containsSequence(new Long[] { 1, 3 });343 * assertThat(new long[] { 1, 2, 3 }).containsSequence(new Long[] { 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(Long[] sequence) {353 requireNonNullParameter(sequence, "sequence");354 arrays.assertContainsSequence(info, actual, toPrimitiveLongArray(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 long[] { 1, 2, 3 }).containsSubsequence(1, 2);363 * assertThat(new long[] { 1, 2, 3 }).containsSubsequence(1, 3);364 *365 * // assertion will fail366 * assertThat(new long[] { 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(long... 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 long[] { 1, 2, 3 }).containsSubsequence(new Long[] { 1, 2 });384 * assertThat(new long[] { 1, 2, 3 }).containsSubsequence(new Long[] { 1, 3 });385 *386 * // assertion will fail387 * assertThat(new long[] { 1, 2, 3 }).containsSubsequence(new Long[] { 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(Long[] subsequence) {397 requireNonNullParameter(subsequence, "subsequence");398 arrays.assertContainsSubsequence(info, actual, toPrimitiveLongArray(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 long[] { 1L, 2L, 3L }).contains(1L, atIndex(O));407 * assertThat(new long[] { 1L, 2L, 3L }).contains(3L, atIndex(2));408 *409 * // assertions will fail410 * assertThat(new long[] { 1L, 2L, 3L }).contains(1L, atIndex(1));411 * assertThat(new long[] { 1L, 2L, 3L }).contains(4L, 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(long 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 long[] { 1L, 2L, 3L }).doesNotContain(4L);432 *433 * // assertion will fail434 * assertThat(new long[] { 1L, 2L, 3L }).doesNotContain(2L);</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(long... 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 long[] { 1L, 2L, 3L }).doesNotContain(new Long[] { 4L });453 *454 * // assertion will fail455 * assertThat(new long[] { 1L, 2L, 3L }).doesNotContain(new Long[] { 2L });</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(Long[] values) {466 requireNonNullParameter(values, "values");467 arrays.assertDoesNotContain(info, actual, toPrimitiveLongArray(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 long[] { 1L, 2L, 3L }).doesNotContain(1L, atIndex(1));476 * assertThat(new long[] { 1L, 2L, 3L }).doesNotContain(2L, atIndex(0));477 *478 * // assertions will fail479 * assertThat(new long[] { 1L, 2L, 3L }).doesNotContain(1L, atIndex(0));480 * assertThat(new long[] { 1L, 2L, 3L }).doesNotContain(2L, 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(long 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 long[] { 1L, 2L, 3L }).doesNotHaveDuplicates();499 *500 * // assertion will fail501 * assertThat(new long[] { 1L, 1L, 2L, 3L }).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(long...)}</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 long[] { 1L, 2L, 3L }).startsWith(1L, 2L);519 *520 * // assertion will fail521 * assertThat(new long[] { 1L, 2L, 3L }).startsWith(2L, 3L);</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(long... 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(Long[])}</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 long[] { 1L, 2L, 3L }).startsWith(new Long[] { 1L, 2L });542 *543 * // assertion will fail544 * assertThat(new long[] { 1L, 2L, 3L }).startsWith(new Long[] { 2L, 3L });</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(Long[] sequence) {555 requireNonNullParameter(sequence, "sequence");556 arrays.assertStartsWith(info, actual, toPrimitiveLongArray(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(long...)}</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 long[] { 1L, 2L, 3L }).endsWith(2L, 3L);567 *568 * // assertion will fail569 * assertThat(new long[] { 1L, 2L, 3L }).endsWith(3L, 4L);</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(long... 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(Long[])}</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 long[] { 1L, 2L, 3L }).endsWith(new Long[] { 2L, 3L });590 *591 * // assertion will fail592 * assertThat(new long[] { 1L, 2L, 3L }).endsWith(new Long[] { 3L, 4L });</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(Long[] sequence) {603 requireNonNullParameter(sequence, "sequence");604 arrays.assertEndsWith(info, actual, toPrimitiveLongArray(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 Long> comparator) {616 arrays.assertIsSortedAccordingToComparator(info, actual, comparator);617 return myself;618 }619 /** {@inheritDoc} */620 @Override621 @CheckReturnValue622 public SELF usingElementComparator(Comparator<? super Long> customComparator) {623 this.arrays = new LongArrays(new ComparatorBasedComparisonStrategy(customComparator));624 return myself;625 }626 /** {@inheritDoc} */627 @Override628 @CheckReturnValue629 public SELF usingDefaultElementComparator() {630 this.arrays = LongArrays.instance();631 return myself;632 }633 /**634 * Verifies that the actual group contains only the given values and nothing else, <b>in order</b>.635 * <p>636 * Example :637 * <pre><code class='java'> long[] longs = { 1, 2, 3 };638 *639 * // assertion will pass640 * assertThat(longs).containsExactly(1, 2, 3);641 *642 * // assertion will fail as actual and expected order differ643 * assertThat(longs).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 group is {@code null}.649 * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group650 * contains some or none of the given values, or the actual group contains more values than the given ones651 * or values are the same but the order is not.652 */653 public SELF containsExactly(long... 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'> long[] longs = { 1, 2, 3 };662 *663 * // assertion will pass664 * assertThat(longs).containsExactly(new Long[] { 1, 2, 3 });665 *666 * // assertion will fail as actual and expected order differ667 * assertThat(longs).containsExactly(new Long[] { 2, 1, 3 });</code></pre>668 *669 * @param values the given values.670 * @return {@code this} assertion object.671 * @throws NullPointerException if the given argument is {@code null}.672 * @throws AssertionError if the actual group is {@code null}.673 * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group674 * contains some or none of the given values, or the actual group contains more values than the given ones675 * or values are the same but the order is not.676 * @since 3.19.0677 */678 public SELF containsExactly(Long[] values) {679 requireNonNullParameter(values, "values");680 arrays.assertContainsExactly(info, actual, toPrimitiveLongArray(values));681 return myself;682 }683 /**684 * Verifies that the actual group contains exactly the given values and nothing else, <b>in any order</b>.<br>685 * <p>686 * Example :687 * <pre><code class='java'> // assertions will pass688 * assertThat(new long[] { 1L, 2L }).containsExactlyInAnyOrder(1L, 2L);689 * assertThat(new long[] { 1L, 2L, 1L }).containsExactlyInAnyOrder(1L, 1L, 2L);690 *691 * // assertions will fail692 * assertThat(new long[] { 1L, 2L }).containsExactlyInAnyOrder(1L);693 * assertThat(new long[] { 1L }).containsExactlyInAnyOrder(1L, 2L);694 * assertThat(new long[] { 1L, 2L, 1L }).containsExactlyInAnyOrder(1L, 2L);</code></pre>695 *696 * @param values the given values.697 * @return {@code this} assertion object.698 * @throws NullPointerException if the given argument is {@code null}.699 * @throws AssertionError if the actual group is {@code null}.700 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group701 * contains some or none of the given values, or the actual group contains more values than the given ones.702 * @since 2.6.0 / 3.6.0703 */704 public SELF containsExactlyInAnyOrder(long... values) {705 arrays.assertContainsExactlyInAnyOrder(info, actual, values);706 return myself;707 }708 /**709 * Verifies that the actual group contains exactly the values of the given array and nothing else, <b>in any order</b>.<br>710 * <p>711 * Example :712 * <pre><code class='java'> // assertions will pass713 * assertThat(new long[] { 1L, 2L }).containsExactlyInAnyOrder(new Long[] { 1L, 2L });714 * assertThat(new long[] { 1L, 2L, 1L }).containsExactlyInAnyOrder(new Long[] { 1L, 1L, 2L });715 *716 * // assertions will fail717 * assertThat(new long[] { 1L, 2L }).containsExactlyInAnyOrder(new Long[] { 1L });718 * assertThat(new long[] { 1L }).containsExactlyInAnyOrder(new Long[] { 1L, 2L });719 * assertThat(new long[] { 1L, 2L, 1L }).containsExactlyInAnyOrder(new Long[] { 1L, 2L });</code></pre>720 *721 * @param values the given values.722 * @return {@code this} assertion object.723 * @throws NullPointerException if the given argument is {@code null}.724 * @throws AssertionError if the actual group is {@code null}.725 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group726 * contains some or none of the given values, or the actual group contains more values than the given ones.727 * @since 3.19.0728 */729 public SELF containsExactlyInAnyOrder(Long[] values) {730 requireNonNullParameter(values, "values");731 arrays.assertContainsExactlyInAnyOrder(info, actual, toPrimitiveLongArray(values));732 return myself;733 }734 /**735 * Verifies that the actual array contains at least one of the given values.736 * <p>737 * Example :738 * <pre><code class='java'> long[] oneTwoThree = { 1L, 2L, 3L };739 *740 * // assertions will pass741 * assertThat(oneTwoThree).containsAnyOf(2L)742 * .containsAnyOf(2L, 3L)743 * .containsAnyOf(1L, 2L, 3L)744 * .containsAnyOf(1L, 2L, 3L, 4L)745 * .containsAnyOf(5L, 6L, 7L, 2L);746 *747 * // assertions will fail748 * assertThat(oneTwoThree).containsAnyOf(4L);749 * assertThat(oneTwoThree).containsAnyOf(4L, 5L, 6L, 7L);</code></pre>750 *751 * @param values the values whose at least one which is expected to be in the array under test.752 * @return {@code this} assertion object.753 * @throws NullPointerException if the array of values is {@code null}.754 * @throws IllegalArgumentException if the array of values is empty and the array under test is not empty.755 * @throws AssertionError if the array under test is {@code null}.756 * @throws AssertionError if the array under test does not contain any of the given {@code values}.757 * @since 2.9.0 / 3.9.0758 */759 public SELF containsAnyOf(long... values) {760 arrays.assertContainsAnyOf(info, actual, values);761 return myself;762 }763 /**764 * Verifies that the actual array contains at least one value of the given array.765 * <p>766 * Example :767 * <pre><code class='java'> long[] oneTwoThree = { 1L, 2L, 3L };768 *769 * // assertions will pass770 * assertThat(oneTwoThree).containsAnyOf(new Long[] { 2L })771 * .containsAnyOf(new Long[] { 2L, 3L })772 * .containsAnyOf(new Long[] { 1L, 2L, 3L })773 * .containsAnyOf(new Long[] { 1L, 2L, 3L, 4L })774 * .containsAnyOf(new Long[] { 5L, 6L, 7L, 2L });775 *776 * // assertions will fail777 * assertThat(oneTwoThree).containsAnyOf(new Long[] { 4L });778 * assertThat(oneTwoThree).containsAnyOf(new Long[] { 4L, 5L, 6L, 7L });</code></pre>779 *780 * @param values the array of values whose at least one which is expected to be in the array under test.781 * @return {@code this} assertion object.782 * @throws NullPointerException if the array of values is {@code null}.783 * @throws IllegalArgumentException if the array of values is empty and the array under test is not empty.784 * @throws AssertionError if the array under test is {@code null}.785 * @throws AssertionError if the array under test does not contain any of the given {@code values}.786 * @since 3.19.0787 */788 public SELF containsAnyOf(Long[] values) {789 requireNonNullParameter(values, "values");790 arrays.assertContainsAnyOf(info, actual, toPrimitiveLongArray(values));791 return myself;792 }793 private static long[] toPrimitiveLongArray(Long[] values) {794 return Arrays.stream(values).mapToLong(Long::longValue).toArray();795 }796}...

Full Screen

Full Screen

toPrimitiveLongArray

Using AI Code Generation

copy

Full Screen

1LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});2assertions.toPrimitiveLongArray();3LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});4assertions.toPrimitiveLongArray();5LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});6assertions.toPrimitiveLongArray();7LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});8assertions.toPrimitiveLongArray();9LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});10assertions.toPrimitiveLongArray();11LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});12assertions.toPrimitiveLongArray();13LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});14assertions.toPrimitiveLongArray();15LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});16assertions.toPrimitiveLongArray();17LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});18assertions.toPrimitiveLongArray();19LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});20assertions.toPrimitiveLongArray();21LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});22assertions.toPrimitiveLongArray();23LongArrayAssert assertions = assertThat(new long[]{1, 2, 3});24assertions.toPrimitiveLongArray();

Full Screen

Full Screen

toPrimitiveLongArray

Using AI Code Generation

copy

Full Screen

1Long[] longArray = {1L, 2L, 3L, 4L, 5L};2long[] primitiveLongArray = assertThat(longArray).toPrimitiveLongArray();3public long[] toPrimitiveLongArray()4public long[] toPrimitiveLongArray() {5 return LongArrays.toPrimitive(actual);6}7public static long[] toPrimitive(Long[] array)8public static long[] toPrimitive(Long[] array) {9 if (array == null) {10 return null;11 } else if (array.length == 0) {12 return new long[0];13 }14 final long[] result = new long[array.length];15 for (int i = 0; i < array.length; i++) {16 }17 return result;18}19Long[] longArray = {1L, 2L, 3L, 4L, 5L};20long[] primitiveLongArray = assertThat(longArray).toPrimitiveLongArray();21assertThat(primitiveLongArray).containsExactly(1L, 2L, 3L, 4L, 5L);22public long[] toPrimitiveLongArray()23public long[] toPrimitiveLongArray() {24 return LongArrays.toPrimitive(actual);25}26public static long[] toPrimitive(Long[] array)27public static long[] toPrimitive(Long[] array) {28 if (array == null) {29 return null;30 } else if (array.length == 0) {31 return new long[0];32 }33 final long[] result = new long[array.length];34 for (int i = 0; i < array.length; i++) {35 }36 return result;

Full Screen

Full Screen

toPrimitiveLongArray

Using AI Code Generation

copy

Full Screen

1import org.assertj.core.api.LongArrayAssert;2import static org.assertj.core.api.Assertions.assertThat;3class LongArrayAssertExamples {4 void toPrimitiveLongArray() {5 LongArrayAssert assertions = assertThat(new Long[]{1L, 2L, 3L});6 long[] primitiveLongArray = assertions.toPrimitiveLongArray();7 assertThat(primitiveLongArray).containsExactly(1, 2, 3);8 }9}

Full Screen

Full Screen

toPrimitiveLongArray

Using AI Code Generation

copy

Full Screen

1long[] longArray = assertThat(Long[]).toPrimitiveLongArray();2long[] longArray = assertThat(Long[]).toPrimitiveLongArray();3long[] longArray = assertThat(Long[]).toPrimitiveLongArray();4long[] longArray = assertThat(Long[]).toPrimitiveLongArray();5long[] longArray = assertThat(Long[]).toPrimitiveLongArray();6long[] longArray = assertThat(Long[]).toPrimitiveLongArray();7long[] longArray = assertThat(Long[]).toPrimitiveLongArray();8long[] longArray = assertThat(Long[]).toPrimitiveLongArray();9long[] longArray = assertThat(Long[]).toPrimitiveLongArray();10long[] longArray = assertThat(Long[]).toPrimitiveLongArray();

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