How to use toShortArray method of org.assertj.core.api.AbstractShortArrayAssert class

Best Assertj code snippet using org.assertj.core.api.AbstractShortArrayAssert.toShortArray

Source:AbstractShortArrayAssert.java Github

copy

Full Screen

...202 * @throws AssertionError if the actual array does not contain the given values.203 * @since 3.16.0204 */205 public SELF contains(int... values) {206 arrays.assertContains(info, actual, toShortArray(values));207 return myself;208 }209 /**210 * Verifies that the actual array contains only the given values and nothing else, in any order.211 * <p>212 * Example:213 * <pre><code class='java'> // assertions will pass214 * assertThat(new short[] { 1, 2, 3 }).containsOnly((short) 1, (short) 2, (short) 3);215 * assertThat(new short[] { 1, 2, 3 }).containsOnly((short) 2, (short) 3, (short) 1);216 * assertThat(new short[] { 1, 1, 2 }).containsOnly((short) 1, (short) 2);217 *218 * // assertions will fail219 * assertThat(new short[] { 1, 2, 3 }).containsOnly((short) 1, (short) 2, (short) 3, (short) 4);220 * assertThat(new short[] { 1, 2, 3 }).containsOnly((short) 4, (short) 7);</code></pre>221 *222 * @param values the given values.223 * @return {@code this} assertion object.224 * @throws NullPointerException if the given argument is {@code null}.225 * @throws IllegalArgumentException if the given argument is an empty array.226 * @throws AssertionError if the actual array is {@code null}.227 * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array contains some228 * or none of the given values, or the actual array contains more values than the given ones.229 */230 public SELF containsOnly(short... values) {231 arrays.assertContainsOnly(info, actual, values);232 return myself;233 }234 /**235 * Verifies that the actual array contains only the given values and nothing else, in any order.236 * <p>237 * Example:238 * <pre><code class='java'> // assertions will pass239 * assertThat(new short[] { 1, 2, 3 }).containsOnly(1, 2, 3);240 * assertThat(new short[] { 1, 2, 3 }).containsOnly(2, 3, 1);241 * assertThat(new short[] { 1, 1, 2 }).containsOnly(1, 2);242 *243 * // assertions will fail244 * assertThat(new short[] { 1, 2, 3 }).containsOnly(1, 2, 3, 4);245 * assertThat(new short[] { 1, 2, 3 }).containsOnly(4, 7);</code></pre>246 *247 * @param values the given values.248 * @return {@code this} assertion object.249 * @throws NullPointerException if the given argument is {@code null}.250 * @throws IllegalArgumentException if the given argument is an empty array.251 * @throws AssertionError if the actual array is {@code null}.252 * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array contains some253 * or none of the given values, or the actual array contains more values than the given ones.254 * @since 3.16.0255 */256 public SELF containsOnly(int... values) {257 arrays.assertContainsOnly(info, actual, toShortArray(values));258 return myself;259 }260 /**261 * Verifies that the actual array contains the given values only once.262 * <p>263 * Examples :264 * <pre><code class='java'> // assertion will pass265 * assertThat(new short[] { 1, 2, 3 }).containsOnlyOnce((short) 1,(short) 2);266 *267 * // assertions will fail268 * assertThat(new short[] { 1, 2, 1 }).containsOnlyOnce((short) 1);269 * assertThat(new short[] { 1, 2, 3 }).containsOnlyOnce((short) 4);270 * assertThat(new short[] { 1, 2, 3, 3 }).containsOnlyOnce((short) 0, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5);</code></pre>271 *272 * @param values the given values.273 * @return {@code this} assertion object.274 * @throws NullPointerException if the given argument is {@code null}.275 * @throws IllegalArgumentException if the given argument is an empty array.276 * @throws AssertionError if the actual array is {@code null}.277 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group contains some278 * or none of the given values, or the actual group contains more than once these values.279 */280 public SELF containsOnlyOnce(short... values) {281 arrays.assertContainsOnlyOnce(info, actual, values);282 return myself;283 }284 /**285 * Verifies that the actual array contains the given values only once.286 * <p>287 * Examples :288 * <pre><code class='java'> // assertion will pass289 * assertThat(new short[] { 1, 2, 3 }).containsOnlyOnce(1,2);290 *291 * // assertions will fail292 * assertThat(new short[] { 1, 2, 1 }).containsOnlyOnce(1);293 * assertThat(new short[] { 1, 2, 3 }).containsOnlyOnce(4);294 * assertThat(new short[] { 1, 2, 3, 3 }).containsOnlyOnce(0, 1, 2, 3, 4, 5);</code></pre>295 *296 * @param values the given values.297 * @return {@code this} assertion object.298 * @throws NullPointerException if the given argument is {@code null}.299 * @throws IllegalArgumentException if the given argument is an empty array.300 * @throws AssertionError if the actual array is {@code null}.301 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group contains some302 * or none of the given values, or the actual group contains more than once these values.303 * @since 3.16.0304 */305 public SELF containsOnlyOnce(int... values) {306 arrays.assertContainsOnlyOnce(info, actual, toShortArray(values));307 return myself;308 }309 /**310 * Verifies that the actual array contains the given sequence, without any other values between them.311 * <p>312 * Example:313 * <pre><code class='java'> // assertion will pass314 * assertThat(new short[] { 1, 2, 3 }).containsSequence((short) 1, (short) 2);315 *316 * // assertion will fail317 * assertThat(new short[] { 1, 2, 3 }).containsSequence((short) 1, (short) 3);318 * assertThat(new short[] { 1, 2, 3 }).containsSequence((short) 2, (short) 1);</code></pre>319 *320 * @param sequence the sequence of values to look for.321 * @return myself assertion object.322 * @throws AssertionError if the actual array is {@code null}.323 * @throws AssertionError if the given array is {@code null}.324 * @throws AssertionError if the actual array does not contain the given sequence.325 */326 public SELF containsSequence(short... sequence) {327 arrays.assertContainsSequence(info, actual, sequence);328 return myself;329 }330 /**331 * Verifies that the actual array contains the given sequence, without any other values between them.332 * <p>333 * Example:334 * <pre><code class='java'> // assertion will pass335 * assertThat(new short[] { 1, 2, 3 }).containsSequence(1, 2);336 *337 * // assertion will fail338 * assertThat(new short[] { 1, 2, 3 }).containsSequence(1, 3);339 * assertThat(new short[] { 1, 2, 3 }).containsSequence(2, 1);</code></pre>340 *341 * @param sequence the sequence of values to look for.342 * @return myself assertion object.343 * @throws AssertionError if the actual array is {@code null}.344 * @throws AssertionError if the given array is {@code null}.345 * @throws AssertionError if the actual array does not contain the given sequence.346 * @since 3.16.0347 */348 public SELF containsSequence(int... sequence) {349 arrays.assertContainsSequence(info, actual, toShortArray(sequence));350 return myself;351 }352 /**353 * Verifies that the actual array contains the given subsequence (possibly with other values between them).354 * <p>355 * Example:356 * <pre><code class='java'> // assertion will pass357 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence((short) 1, (short) 2);358 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence((short) 1, (short) 3);359 *360 * // assertion will fail361 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence((short) 2, (short) 1);</code></pre>362 *363 * @param subsequence the subsequence of values to look for.364 * @return myself assertion object.365 * @throws AssertionError if the actual array is {@code null}.366 * @throws AssertionError if the given array is {@code null}.367 * @throws AssertionError if the actual array does not contain the given subsequence.368 */369 public SELF containsSubsequence(short... subsequence) {370 arrays.assertContainsSubsequence(info, actual, subsequence);371 return myself;372 }373 /**374 * Verifies that the actual array contains the given subsequence (possibly with other values between them).375 * <p>376 * Example:377 * <pre><code class='java'> // assertion will pass378 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence(1, 2);379 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence(1, 3);380 *381 * // assertion will fail382 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence(2, 1);</code></pre>383 *384 * @param subsequence the subsequence of values to look for.385 * @return myself assertion object.386 * @throws AssertionError if the actual array is {@code null}.387 * @throws AssertionError if the given array is {@code null}.388 * @throws AssertionError if the actual array does not contain the given subsequence.389 * @since 3.16.0390 */391 public SELF containsSubsequence(int... subsequence) {392 arrays.assertContainsSubsequence(info, actual, toShortArray(subsequence));393 return myself;394 }395 /**396 * Verifies that the actual array contains the given value at the given index.397 * <p>398 * Example:399 * <pre><code class='java'> // assertions will pass400 * assertThat(new short[] { 1, 2, 3 }).contains((short) 1, atIndex(O));401 * assertThat(new short[] { 1, 2, 3 }).contains((short) 3, atIndex(2));402 *403 * // assertions will fail404 * assertThat(new short[] { 1, 2, 3 }).contains((short) 1, atIndex(1));405 * assertThat(new short[] { 1, 2, 3 }).contains((short) 4, atIndex(2));</code></pre>406 *407 * @param value the value to look for.408 * @param index the index where the value should be stored in the actual array.409 * @return myself assertion object.410 * @throws AssertionError if the actual array is {@code null} or empty.411 * @throws NullPointerException if the given {@code Index} is {@code null}.412 * @throws IndexOutOfBoundsException if the value of the given {@code Index} is equal to or greater than the size of413 * the actual array.414 * @throws AssertionError if the actual array does not contain the given value at the given index.415 */416 public SELF contains(short value, Index index) {417 arrays.assertContains(info, actual, value, index);418 return myself;419 }420 /**421 * Verifies that the actual array contains the given value at the given index.422 * <p>423 * Example:424 * <pre><code class='java'> // assertions will pass425 * assertThat(new short[] { 1, 2, 3 }).contains(1, atIndex(O));426 * assertThat(new short[] { 1, 2, 3 }).contains(3, atIndex(2));427 *428 * // assertions will fail429 * assertThat(new short[] { 1, 2, 3 }).contains(1, atIndex(1));430 * assertThat(new short[] { 1, 2, 3 }).contains(4, atIndex(2));</code></pre>431 *432 * @param value the value to look for.433 * @param index the index where the value should be stored in the actual array.434 * @return myself assertion object.435 * @throws AssertionError if the actual array is {@code null} or empty.436 * @throws NullPointerException if the given {@code Index} is {@code null}.437 * @throws IndexOutOfBoundsException if the value of the given {@code Index} is equal to or greater than the size of438 * the actual array.439 * @throws AssertionError if the actual array does not contain the given value at the given index.440 * @since 3.16.0441 */442 public SELF contains(int value, Index index) {443 arrays.assertContains(info, actual, toShort(value), index);444 return myself;445 }446 /**447 * Verifies that the actual array does not contain the given values.448 * <p>449 * Example:450 * <pre><code class='java'> // assertion will pass451 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 4);452 *453 * // assertion will fail454 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 2);</code></pre>455 *456 * @param values the given values.457 * @return {@code this} assertion object.458 * @throws NullPointerException if the given argument is {@code null}.459 * @throws IllegalArgumentException if the given argument is an empty array.460 * @throws AssertionError if the actual array is {@code null}.461 * @throws AssertionError if the actual array contains any of the given values.462 */463 public SELF doesNotContain(short... values) {464 arrays.assertDoesNotContain(info, actual, values);465 return myself;466 }467 /**468 * Verifies that the actual array does not contain the given values.469 * <p>470 * Example:471 * <pre><code class='java'> // assertion will pass472 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(4);473 *474 * // assertion will fail475 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(2);</code></pre>476 *477 * @param values the given values.478 * @return {@code this} assertion object.479 * @throws NullPointerException if the given argument is {@code null}.480 * @throws IllegalArgumentException if the given argument is an empty array.481 * @throws AssertionError if the actual array is {@code null}.482 * @throws AssertionError if the actual array contains any of the given values.483 * @since 3.16.0484 */485 public SELF doesNotContain(int... values) {486 arrays.assertDoesNotContain(info, actual, toShortArray(values));487 return myself;488 }489 /**490 * Verifies that the actual array does not contain the given value at the given index.491 * <p>492 * Example:493 * <pre><code class='java'> // assertions will pass494 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 1, atIndex(1));495 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 2, atIndex(0));496 *497 * // assertions will fail498 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 1, atIndex(0));499 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 2, atIndex(1));</code></pre>500 *501 * @param value the value to look for.502 * @param index the index where the value should be stored in the actual array.503 * @return myself assertion object.504 * @throws AssertionError if the actual array is {@code null}.505 * @throws NullPointerException if the given {@code Index} is {@code null}.506 * @throws AssertionError if the actual array contains the given value at the given index.507 */508 public SELF doesNotContain(short value, Index index) {509 arrays.assertDoesNotContain(info, actual, value, index);510 return myself;511 }512 /**513 * Verifies that the actual array does not contain the given value at the given index.514 * <p>515 * Example:516 * <pre><code class='java'> // assertions will pass517 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(1, atIndex(1));518 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(2, atIndex(0));519 *520 * // assertions will fail521 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(1, atIndex(0));522 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(2, atIndex(1));</code></pre>523 *524 * @param value the value to look for.525 * @param index the index where the value should be stored in the actual array.526 * @return myself assertion object.527 * @throws AssertionError if the actual array is {@code null}.528 * @throws NullPointerException if the given {@code Index} is {@code null}.529 * @throws AssertionError if the actual array contains the given value at the given index.530 * @since 3.16.0531 */532 public SELF doesNotContain(int value, Index index) {533 arrays.assertDoesNotContain(info, actual, toShort(value), index);534 return myself;535 }536 /**537 * Verifies that the actual array does not contain duplicates.538 * <p>539 * Example:540 * <pre><code class='java'> // assertion will pass541 * assertThat(new short[] { 1, 2, 3 }).doesNotHaveDuplicates();542 *543 * // assertion will fail544 * assertThat(new short[] { 1, 1, 2, 3 }).doesNotHaveDuplicates();</code></pre>545 *546 * @return {@code this} assertion object.547 * @throws AssertionError if the actual array is {@code null}.548 * @throws AssertionError if the actual array contains duplicates.549 */550 public SELF doesNotHaveDuplicates() {551 arrays.assertDoesNotHaveDuplicates(info, actual);552 return myself;553 }554 /**555 * Verifies that the actual array starts with the given sequence of values, without any other values between them.556 * Similar to <code>{@link #containsSequence(short...)}</code>, but it also verifies that the first element in the557 * sequence is also first element of the actual array.558 * <p>559 * Example:560 * <pre><code class='java'> // assertion will pass561 * assertThat(new short[] { 1, 2, 3 }).startsWith((short) 1, (short) 2);562 *563 * // assertion will fail564 * assertThat(new short[] { 1, 2, 3 }).startsWith((short) 2, (short) 3);</code></pre>565 *566 * @param sequence the sequence of values to look for.567 * @return myself assertion object.568 * @throws NullPointerException if the given argument is {@code null}.569 * @throws IllegalArgumentException if the given argument is an empty array.570 * @throws AssertionError if the actual array is {@code null}.571 * @throws AssertionError if the actual array does not start with the given sequence.572 */573 public SELF startsWith(short... sequence) {574 arrays.assertStartsWith(info, actual, sequence);575 return myself;576 }577 /**578 * Verifies that the actual array starts with the given sequence of values, without any other values between them.579 * Similar to <code>{@link #containsSequence(short...)}</code>, but it also verifies that the first element in the580 * sequence is also first element of the actual array.581 * <p>582 * Example:583 * <pre><code class='java'> // assertion will pass584 * assertThat(new short[] { 1, 2, 3 }).startsWith(1, 2);585 *586 * // assertion will fail587 * assertThat(new short[] { 1, 2, 3 }).startsWith(2, 3);</code></pre>588 *589 * @param sequence the sequence of values to look for.590 * @return myself assertion object.591 * @throws NullPointerException if the given argument is {@code null}.592 * @throws IllegalArgumentException if the given argument is an empty array.593 * @throws AssertionError if the actual array is {@code null}.594 * @throws AssertionError if the actual array does not start with the given sequence.595 * @since 3.16.0596 */597 public SELF startsWith(int... sequence) {598 arrays.assertStartsWith(info, actual, toShortArray(sequence));599 return myself;600 }601 /**602 * Verifies that the actual array ends with the given sequence of values, without any other values between them.603 * Similar to <code>{@link #containsSequence(short...)}</code>, but it also verifies that the last element in the604 * sequence is also last element of the actual array.605 * <p>606 * Example:607 * <pre><code class='java'> // assertion will pass608 * assertThat(new short[] { 1, 2, 3 }).endsWith((short) 2, (short) 3);609 *610 * // assertion will fail611 * assertThat(new short[] { 1, 2, 3 }).endsWith((short) 3, (short) 4);</code></pre>612 *613 * @param sequence the sequence of values to look for.614 * @return myself assertion object.615 * @throws NullPointerException if the given argument is {@code null}.616 * @throws IllegalArgumentException if the given argument is an empty array.617 * @throws AssertionError if the actual array is {@code null}.618 * @throws AssertionError if the actual array does not end with the given sequence.619 */620 public SELF endsWith(short... sequence) {621 arrays.assertEndsWith(info, actual, sequence);622 return myself;623 }624 /**625 * Verifies that the actual array ends with the given sequence of values, without any other values between them.626 * Similar to <code>{@link #containsSequence(short...)}</code>, but it also verifies that the last element in the627 * sequence is also last element of the actual array.628 * <p>629 * Example:630 * <pre><code class='java'> // assertion will pass631 * assertThat(new short[] { 1, 2, 3 }).endsWith(2, 3);632 *633 * // assertion will fail634 * assertThat(new short[] { 1, 2, 3 }).endsWith(3, 4);</code></pre>635 *636 * @param sequence the sequence of values to look for.637 * @return myself assertion object.638 * @throws NullPointerException if the given argument is {@code null}.639 * @throws IllegalArgumentException if the given argument is an empty array.640 * @throws AssertionError if the actual array is {@code null}.641 * @throws AssertionError if the actual array does not end with the given sequence.642 * @since 3.16.0643 */644 public SELF endsWith(int... sequence) {645 arrays.assertEndsWith(info, actual, toShortArray(sequence));646 return myself;647 }648 /** {@inheritDoc} */649 @Override650 public SELF isSorted() {651 arrays.assertIsSorted(info, actual);652 return myself;653 }654 /** {@inheritDoc} */655 @Override656 public SELF isSortedAccordingTo(Comparator<? super Short> comparator) {657 arrays.assertIsSortedAccordingToComparator(info, actual, comparator);658 return myself;659 }660 /** {@inheritDoc} */661 @Override662 @CheckReturnValue663 public SELF usingElementComparator(Comparator<? super Short> customComparator) {664 this.arrays = new ShortArrays(new ComparatorBasedComparisonStrategy(customComparator));665 return myself;666 }667 /** {@inheritDoc} */668 @Override669 @CheckReturnValue670 public SELF usingDefaultElementComparator() {671 this.arrays = ShortArrays.instance();672 return myself;673 }674 /**675 * Verifies that the actual group contains only the given values and nothing else, <b>in order</b>.676 * <p>677 * Example :678 * <pre><code class='java'> short[] shorts = { 1, 2, 3 };679 *680 * // assertion will pass681 * assertThat(shorts).containsExactly((short) 1, (short) 2, (short) 3);682 *683 * // assertion will fail as actual and expected order differ684 * assertThat(shorts).containsExactly((short) 2, (short) 1, (short) 3);</code></pre>685 *686 * @param values the given values.687 * @return {@code this} assertion object.688 * @throws NullPointerException if the given argument is {@code null}.689 * @throws AssertionError if the actual group is {@code null}.690 * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group691 * contains some or none of the given values, or the actual group contains more values than the given ones692 * or values are the same but the order is not.693 */694 public SELF containsExactly(short... values) {695 arrays.assertContainsExactly(info, actual, values);696 return myself;697 }698 /**699 * Verifies that the actual group contains only the given values and nothing else, <b>in order</b>.700 * <p>701 * Example :702 * <pre><code class='java'> short[] shorts = { 1, 2, 3 };703 *704 * // assertion will pass705 * assertThat(shorts).containsExactly(1, 2, 3);706 *707 * // assertion will fail as actual and expected order differ708 * assertThat(shorts).containsExactly(2, 1, 3);</code></pre>709 *710 * @param values the given values.711 * @return {@code this} assertion object.712 * @throws NullPointerException if the given argument is {@code null}.713 * @throws AssertionError if the actual group is {@code null}.714 * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group715 * contains some or none of the given values, or the actual group contains more values than the given ones716 * or values are the same but the order is not.717 * @since 3.16.0718 */719 public SELF containsExactly(int... values) {720 arrays.assertContainsExactly(info, actual, toShortArray(values));721 return myself;722 }723 /**724 * Verifies that the actual group contains exactly the given values and nothing else, <b>in any order</b>.<br>725 * <p>726 * Example :727 * <pre><code class='java'> // assertions will pass728 * assertThat(new short[] { 1, 2 }).containsExactlyInAnyOrder((short) 1, (short) 2);729 * assertThat(new short[] { 1, 2, 1 }).containsExactlyInAnyOrder((short) 1, (short) 1, (short) 2);730 *731 * // assertions will fail732 * assertThat(new short[] { 1, 2 }).containsExactlyInAnyOrder((short) 1);733 * assertThat(new short[] { 1 }).containsExactlyInAnyOrder((short) 1, (short) 2);734 * assertThat(new short[] { 1, 2, 1 }).containsExactlyInAnyOrder((short) 1, (short) 2);</code></pre>735 *736 * @param values the given values.737 * @return {@code this} assertion object.738 * @throws NullPointerException if the given argument is {@code null}.739 * @throws AssertionError if the actual group is {@code null}.740 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group741 * contains some or none of the given values, or the actual group contains more values than the given ones.742 * @since 2.6.0 / 3.6.0743 */744 public SELF containsExactlyInAnyOrder(short... values) {745 arrays.assertContainsExactlyInAnyOrder(info, actual, values);746 return myself;747 }748 /**749 * Verifies that the actual group contains exactly the given values and nothing else, <b>in any order</b>.<br>750 * <p>751 * Example :752 * <pre><code class='java'> // assertions will pass753 * assertThat(new short[] { 1, 2 }).containsExactlyInAnyOrder(1, 2);754 * assertThat(new short[] { 1, 2, 1 }).containsExactlyInAnyOrder(1, 1, 2);755 *756 * // assertions will fail757 * assertThat(new short[] { 1, 2 }).containsExactlyInAnyOrder(1);758 * assertThat(new short[] { 1 }).containsExactlyInAnyOrder(1, 2);759 * assertThat(new short[] { 1, 2, 1 }).containsExactlyInAnyOrder(1, 2);</code></pre>760 *761 * @param values the given values.762 * @return {@code this} assertion object.763 * @throws NullPointerException if the given argument is {@code null}.764 * @throws AssertionError if the actual group is {@code null}.765 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group766 * contains some or none of the given values, or the actual group contains more values than the given ones.767 * @since 3.16.0768 */769 public SELF containsExactlyInAnyOrder(int... values) {770 arrays.assertContainsExactlyInAnyOrder(info, actual, toShortArray(values));771 return myself;772 }773 /**774 * Verifies that the actual array contains at least one of the given values.775 * <p>776 * Example :777 * <pre><code class='java'> short[] oneTwoThree = { 1, 2, 3 };778 *779 * // assertions will pass780 * assertThat(abc).containsAnyOf((short) 2)781 * .containsAnyOf((short) 2, (short) 3)782 * .containsAnyOf((short) 1, (short) 2, (short) 3)783 * .containsAnyOf((short) 1, (short) 2, (short) 3, (short) 4)784 * .containsAnyOf((short) 5, (short) 6, (short) 7, (short) 2);785 *786 * // assertions will fail787 * assertThat(abc).containsAnyOf((short) 4);788 * assertThat(abc).containsAnyOf((short) 4, (short) 5, (short) 6, (short) 7);</code></pre>789 *790 * @param values the values whose at least one which is expected to be in the array under test.791 * @return {@code this} assertion object.792 * @throws NullPointerException if the array of values is {@code null}.793 * @throws IllegalArgumentException if the array of values is empty and the array under test is not empty.794 * @throws AssertionError if the array under test is {@code null}.795 * @throws AssertionError if the array under test does not contain any of the given {@code values}.796 * @since 2.9.0 / 3.9.0797 */798 public SELF containsAnyOf(short... values) {799 arrays.assertContainsAnyOf(info, actual, values);800 return myself;801 }802 /**803 * Verifies that the actual array contains at least one of the given values.804 * <p>805 * Example :806 * <pre><code class='java'> short[] oneTwoThree = { 1, 2, 3 };807 *808 * // assertions will pass809 * assertThat(abc).containsAnyOf(2)810 * .containsAnyOf(2, 3)811 * .containsAnyOf(1, 2, 3)812 * .containsAnyOf(1, 2, 3, 4)813 * .containsAnyOf(5, 6, 7, 2);814 *815 * // assertions will fail816 * assertThat(abc).containsAnyOf(4);817 * assertThat(abc).containsAnyOf(4, 5, 6, 7);</code></pre>818 *819 * @param values the values whose at least one which is expected to be in the array under test.820 * @return {@code this} assertion object.821 * @throws NullPointerException if the array of values is {@code null}.822 * @throws IllegalArgumentException if the array of values is empty and the array under test is not empty.823 * @throws AssertionError if the array under test is {@code null}.824 * @throws AssertionError if the array under test does not contain any of the given {@code values}.825 * @since 3.16.0826 */827 public SELF containsAnyOf(int... values) {828 arrays.assertContainsAnyOf(info, actual, toShortArray(values));829 return myself;830 }831 private static short[] toShortArray(int[] ints) {832 if (ints == null) return null;833 short[] shorts = new short[ints.length];834 for (int i = 0; i < shorts.length; i++) {835 shorts[i] = toShort(ints[i]);836 }837 return shorts;838 }839 private static short toShort(int value) {840 return (short) value;841 }842}...

Full Screen

Full Screen

toShortArray

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

toShortArray

Using AI Code Generation

copy

Full Screen

1org.assertj.core.api.AbstractShortArrayAssert<short[]> actual;2org.assertj.core.api.AbstractShortArrayAssert<short[]> toShortArray();3actual = toShortArray();4public class AbstractShortArrayAssert_toShortArray_Test {5 public void should_return_this() {6 short[] array = new short[] { 1, 2, 3 };7 AbstractShortArrayAssert<?> assertions = assertThat(array);8 assertThat(assertions.toShortArray()).isSameAs(assertions);9 }10}11public class AbstractShortArrayAssert_toShortArray_Test {12 public void should_return_this() {13 short[] array = new short[] { 1, 2, 3 };14 AbstractShortArrayAssert<?> assertions = assertThat(array);15 assertThat(assertions.toShortArray()).isSameAs(assertions);16 }17}18public class AbstractShortArrayAssert_toShortArray_Test {19 public void should_return_this() {20 short[] array = new short[] { 1, 2, 3 };21 AbstractShortArrayAssert<?> assertions = assertThat(array);22 assertThat(assertions.toShortArray()).isSameAs(assertions);23 }24}25public class AbstractShortArrayAssert_toShortArray_Test {26 public void should_return_this() {27 short[] array = new short[] { 1, 2, 3 };28 AbstractShortArrayAssert<?> assertions = assertThat(array);29 assertThat(assertions.toShortArray()).isSameAs(assertions);30 }31}32public class AbstractShortArrayAssert_toShortArray_Test {33 public void should_return_this() {34 short[] array = new short[] { 1, 2, 3 };

Full Screen

Full Screen

toShortArray

Using AI Code Generation

copy

Full Screen

1ShortArrayAssert assertions= Assertions.assertThat(new short[]{1,2,3});2assertions.contains((short)1, (short)2);3assertions.containsOnly((short)1, (short)2, (short)3);4assertions.containsExactly((short)1, (short)2, (short)3);5assertions.doesNotContain((short)4);6assertions.containsSequence((short)1, (short)2);7assertions.containsSubsequence((short)1, (short)2);8assertions.startsWith((short)1);9assertions.endsWith((short)3);10assertions.isSorted();11assertions.isEmpty();12assertions.isNotEmpty();13assertions.hasSize(3);14assertions.hasSameSizeAs(new int[]{1,2,3});15assertions.isSubsetOf(new short[]{1,2,3,4});16assertions.containsAnyOf((short)1, (short)2, (short)3);17assertions.containsOnlyOnce((short)1);18assertions.containsExactlyInAnyOrder((short)2, (short)3, (short)1);19assertions.containsExactlyInAnyOrderElementsOf(Arrays.asList((short)1, (short)2, (short)3));20assertions.containsExactlyInAnyOrder((short)1, (short)2, (short)3);21assertions.containsExactlyInAnyOrderElementsOf(Arrays.asList((short)1, (short)2, (short)3));22assertions.containsExactlyInAnyOrder((short)1, (short)2, (short)3);23assertions.containsExactlyInAnyOrderElementsOf(Arrays.asList((short)1, (short)2, (short)3));24assertions.containsExactlyInAnyOrder((short)1, (short)2, (short)3);25assertions.containsExactlyInAnyOrderElementsOf(Arrays.asList((short)1, (short)2, (short)3));26assertions.containsExactlyInAnyOrder((short)1, (short)2, (short)3);27assertions.containsExactlyInAnyOrderElementsOf(Arrays.asList((short)1, (short)2, (short)3));28assertions.containsExactlyInAnyOrder((short)1, (short)2, (short)3);29assertions.containsExactlyInAnyOrderElementsOf(Arrays.asList((short)1, (short)2, (short)3));

Full Screen

Full Screen

toShortArray

Using AI Code Generation

copy

Full Screen

1ShortArrayAssert shortArrayAssert = new ShortArrayAssert(new short[]{1, 2, 3});2shortArrayAssert = shortArrayAssert.toShortArray();3assertThat(shortArrayAssert).isInstanceOf(ShortArrayAssert.class);4assertThat(shortArrayAssert).isInstanceOf(AbstractShortArrayAssert.class);5assertThat(shortArrayAssert).isInstanceOf(AbstractAssert.class);6assertThat(shortArrayAssert).isInstanceOf(Object.class);7assertThat(shortArrayAssert).isInstanceOf(AssertionError.class);8assertThat(shortArrayAssert).isInstanceOf(ObjectAssert.class);9assertThat(shortArrayAssert).isInstanceOf(AbstractObjectAssert.class);10assertThat(shortArrayAssert).isInstanceOf(AbstractAssert.class);11assertThat(shortArrayAssert).isInstanceOf(Object.class);12assertThat(shortArrayAssert).isInstanceOf(AssertionError.class);

Full Screen

Full Screen

toShortArray

Using AI Code Generation

copy

Full Screen

1Short[] shortArray = new Short[]{1,2,3,4};2assertThat(shortArray).toShortArray();3Short[] shortArray = new Short[]{1,2,3,4};4assertThat(shortArray).usingComparatorForElementFieldsWithType(CUSTOM_COMPARATOR, Short.class).toShortArray();5short[] shortArray = new short[]{1,2,3,4};6assertThat(shortArray).toShortArray();7short[] shortArray = new short[]{1,2,3,4};8assertThat(shortArray).usingComparatorForElementFieldsWithType(CUSTOM_COMPARATOR, short.class).toShortArray();9Short[] shortArray = new Short[]{1,2,3,4};10assertThat(shortArray).toShortArray();11Short[] shortArray = new Short[]{1,2,3,4};12assertThat(shortArray).usingComparatorForElementFieldsWithType(CUSTOM_COMPARATOR, Short.class).toShortArray();13short[] shortArray = new short[]{1,2,3,4};14assertThat(shortArray).toShortArray();15short[] shortArray = new short[]{1,2,3,4};16assertThat(shortArray).usingComparatorForElementFieldsWithType(CUSTOM_COMPARATOR, short.class).toShortArray();17Short[] shortArray = new Short[]{1,2,3,4};18assertThat(shortArray).toShortArray();19Short[] shortArray = new Short[]{1,2,3,4};20assertThat(shortArray).using

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