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

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

Source:AbstractShortArrayAssert.java Github

copy

Full Screen

...204 * @since 3.19.0205 */206 public SELF contains(Short[] values) {207 requireNonNullParameter(values, "values");208 arrays.assertContains(info, actual, toPrimitiveShortArray(values));209 return myself;210 }211 /**212 * Verifies that the actual array contains the given values, in any order.213 * <p>214 * Example:215 * <pre><code class='java'> // assertions will pass216 * assertThat(new short[] { 1, 2, 3 }).contains(1, 2);217 * assertThat(new short[] { 1, 2, 3 }).contains(3, 1);218 * assertThat(new short[] { 1, 2, 3 }).contains(1, 3, 2);219 *220 * // assertions will fail221 * assertThat(new short[] { 1, 2, 3 }).contains(1, 4);222 * assertThat(new short[] { 1, 2, 3 }).contains(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.230 * @since 3.16.0231 */232 public SELF contains(int... values) {233 arrays.assertContains(info, actual, toShortArray(values));234 return myself;235 }236 /**237 * Verifies that the actual array contains only the given values and nothing else, in any order.238 * <p>239 * Example:240 * <pre><code class='java'> // assertions will pass241 * assertThat(new short[] { 1, 2, 3 }).containsOnly((short) 1, (short) 2, (short) 3);242 * assertThat(new short[] { 1, 2, 3 }).containsOnly((short) 2, (short) 3, (short) 1);243 * assertThat(new short[] { 1, 1, 2 }).containsOnly((short) 1, (short) 2);244 *245 * // assertions will fail246 * assertThat(new short[] { 1, 2, 3 }).containsOnly((short) 1, (short) 2, (short) 3, (short) 4);247 * assertThat(new short[] { 1, 2, 3 }).containsOnly((short) 4, (short) 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 */257 public SELF containsOnly(short... values) {258 arrays.assertContainsOnly(info, actual, values);259 return myself;260 }261 /**262 * Verifies that the actual array contains only the values of the given array and nothing else, in any order.263 * <p>264 * Example:265 * <pre><code class='java'> // assertions will pass266 * assertThat(new short[] { 1, 2, 3 }).containsOnly(new Short[] { 1, 2, 3 });267 * assertThat(new short[] { 1, 2, 3 }).containsOnly(new Short[] { 2, 3, 1 });268 * assertThat(new short[] { 1, 1, 2 }).containsOnly(new Short[] { 1, 2 });269 *270 * // assertions will fail271 * assertThat(new short[] { 1, 2, 3 }).containsOnly(new Short[] { 1, 2, 3, 4 });272 * assertThat(new short[] { 1, 2, 3 }).containsOnly(new Short[] { 4, 7 });</code></pre>273 *274 * @param values the given values.275 * @return {@code this} assertion object.276 * @throws NullPointerException if the given argument is {@code null}.277 * @throws IllegalArgumentException if the given argument is an empty array.278 * @throws AssertionError if the actual array is {@code null}.279 * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array contains some280 * or none of the given values, or the actual array contains more values than the given ones.281 * @since 3.19.0282 */283 public SELF containsOnly(Short[] values) {284 requireNonNullParameter(values, "values");285 arrays.assertContainsOnly(info, actual, toPrimitiveShortArray(values));286 return myself;287 }288 /**289 * Verifies that the actual array contains only the given values and nothing else, in any order.290 * <p>291 * Example:292 * <pre><code class='java'> // assertions will pass293 * assertThat(new short[] { 1, 2, 3 }).containsOnly(1, 2, 3);294 * assertThat(new short[] { 1, 2, 3 }).containsOnly(2, 3, 1);295 * assertThat(new short[] { 1, 1, 2 }).containsOnly(1, 2);296 *297 * // assertions will fail298 * assertThat(new short[] { 1, 2, 3 }).containsOnly(1, 2, 3, 4);299 * assertThat(new short[] { 1, 2, 3 }).containsOnly(4, 7);</code></pre>300 *301 * @param values the given values.302 * @return {@code this} assertion object.303 * @throws NullPointerException if the given argument is {@code null}.304 * @throws IllegalArgumentException if the given argument is an empty array.305 * @throws AssertionError if the actual array is {@code null}.306 * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array contains some307 * or none of the given values, or the actual array contains more values than the given ones.308 * @since 3.16.0309 */310 public SELF containsOnly(int... values) {311 arrays.assertContainsOnly(info, actual, toShortArray(values));312 return myself;313 }314 /**315 * Verifies that the actual array contains the given values only once.316 * <p>317 * Examples :318 * <pre><code class='java'> // assertion will pass319 * assertThat(new short[] { 1, 2, 3 }).containsOnlyOnce((short) 1,(short) 2);320 *321 * // assertions will fail322 * assertThat(new short[] { 1, 2, 1 }).containsOnlyOnce((short) 1);323 * assertThat(new short[] { 1, 2, 3 }).containsOnlyOnce((short) 4);324 * assertThat(new short[] { 1, 2, 3, 3 }).containsOnlyOnce((short) 0, (short) 1, (short) 2, (short) 3, (short) 4, (short) 5);</code></pre>325 *326 * @param values the given values.327 * @return {@code this} assertion object.328 * @throws NullPointerException if the given argument is {@code null}.329 * @throws IllegalArgumentException if the given argument is an empty array.330 * @throws AssertionError if the actual array is {@code null}.331 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group contains some332 * or none of the given values, or the actual group contains more than once these values.333 */334 public SELF containsOnlyOnce(short... values) {335 arrays.assertContainsOnlyOnce(info, actual, values);336 return myself;337 }338 /**339 * Verifies that the actual array contains the values of the given array only once.340 * <p>341 * Examples :342 * <pre><code class='java'> // assertion will pass343 * assertThat(new short[] { 1, 2, 3 }).containsOnlyOnce(new Short[] { 1, 2 });344 *345 * // assertions will fail346 * assertThat(new short[] { 1, 2, 1 }).containsOnlyOnce(new Short[] { 1 });347 * assertThat(new short[] { 1, 2, 3 }).containsOnlyOnce(new Short[] { 4 });348 * assertThat(new short[] { 1, 2, 3, 3 }).containsOnlyOnce(new Short[] { 0, 1, 2, 3, 4, 5 });</code></pre>349 *350 * @param values the given values.351 * @return {@code this} assertion object.352 * @throws NullPointerException if the given argument is {@code null}.353 * @throws IllegalArgumentException if the given argument is an empty array.354 * @throws AssertionError if the actual array is {@code null}.355 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group contains some356 * or none of the given values, or the actual group contains more than once these values.357 * @since 3.19.0358 */359 public SELF containsOnlyOnce(Short[] values) {360 requireNonNullParameter(values, "values");361 arrays.assertContainsOnlyOnce(info, actual, toPrimitiveShortArray(values));362 return myself;363 }364 /**365 * Verifies that the actual array contains the given values only once.366 * <p>367 * Examples :368 * <pre><code class='java'> // assertion will pass369 * assertThat(new short[] { 1, 2, 3 }).containsOnlyOnce(1,2);370 *371 * // assertions will fail372 * assertThat(new short[] { 1, 2, 1 }).containsOnlyOnce(1);373 * assertThat(new short[] { 1, 2, 3 }).containsOnlyOnce(4);374 * assertThat(new short[] { 1, 2, 3, 3 }).containsOnlyOnce(0, 1, 2, 3, 4, 5);</code></pre>375 *376 * @param values the given values.377 * @return {@code this} assertion object.378 * @throws NullPointerException if the given argument is {@code null}.379 * @throws IllegalArgumentException if the given argument is an empty array.380 * @throws AssertionError if the actual array is {@code null}.381 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group contains some382 * or none of the given values, or the actual group contains more than once these values.383 * @since 3.16.0384 */385 public SELF containsOnlyOnce(int... values) {386 arrays.assertContainsOnlyOnce(info, actual, toShortArray(values));387 return myself;388 }389 /**390 * Verifies that the actual array contains the given sequence, without any other values between them.391 * <p>392 * Example:393 * <pre><code class='java'> // assertion will pass394 * assertThat(new short[] { 1, 2, 3 }).containsSequence((short) 1, (short) 2);395 *396 * // assertion will fail397 * assertThat(new short[] { 1, 2, 3 }).containsSequence((short) 1, (short) 3);398 * assertThat(new short[] { 1, 2, 3 }).containsSequence((short) 2, (short) 1);</code></pre>399 *400 * @param sequence the sequence of values to look for.401 * @return myself assertion object.402 * @throws AssertionError if the actual array is {@code null}.403 * @throws AssertionError if the given array is {@code null}.404 * @throws AssertionError if the actual array does not contain the given sequence.405 */406 public SELF containsSequence(short... sequence) {407 arrays.assertContainsSequence(info, actual, sequence);408 return myself;409 }410 /**411 * Verifies that the actual array contains the given sequence, without any other values between them.412 * <p>413 * Example:414 * <pre><code class='java'> // assertion will pass415 * assertThat(new short[] { 1, 2, 3 }).containsSequence(new Short[] { 1, 2 });416 *417 * // assertion will fail418 * assertThat(new short[] { 1, 2, 3 }).containsSequence(new Short[] { 1, 3 });419 * assertThat(new short[] { 1, 2, 3 }).containsSequence(new Short[] { 2, 1 });</code></pre>420 *421 * @param sequence the sequence of values to look for.422 * @return myself assertion object.423 * @throws AssertionError if the actual array is {@code null}.424 * @throws AssertionError if the given array is {@code null}.425 * @throws AssertionError if the actual array does not contain the given sequence.426 * @since 3.19.0427 */428 public SELF containsSequence(Short[] sequence) {429 requireNonNullParameter(sequence, "sequence");430 arrays.assertContainsSequence(info, actual, toPrimitiveShortArray(sequence));431 return myself;432 }433 /**434 * Verifies that the actual array contains the given sequence, without any other values between them.435 * <p>436 * Example:437 * <pre><code class='java'> // assertion will pass438 * assertThat(new short[] { 1, 2, 3 }).containsSequence(1, 2);439 *440 * // assertion will fail441 * assertThat(new short[] { 1, 2, 3 }).containsSequence(1, 3);442 * assertThat(new short[] { 1, 2, 3 }).containsSequence(2, 1);</code></pre>443 *444 * @param sequence the sequence of values to look for.445 * @return myself assertion object.446 * @throws AssertionError if the actual array is {@code null}.447 * @throws AssertionError if the given array is {@code null}.448 * @throws AssertionError if the actual array does not contain the given sequence.449 * @since 3.16.0450 */451 public SELF containsSequence(int... sequence) {452 arrays.assertContainsSequence(info, actual, toShortArray(sequence));453 return myself;454 }455 /**456 * Verifies that the actual array contains the given subsequence (possibly with other values between them).457 * <p>458 * Example:459 * <pre><code class='java'> // assertion will pass460 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence((short) 1, (short) 2);461 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence((short) 1, (short) 3);462 *463 * // assertion will fail464 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence((short) 2, (short) 1);</code></pre>465 *466 * @param subsequence the subsequence of values to look for.467 * @return myself assertion object.468 * @throws AssertionError if the actual array is {@code null}.469 * @throws AssertionError if the given array is {@code null}.470 * @throws AssertionError if the actual array does not contain the given subsequence.471 */472 public SELF containsSubsequence(short... subsequence) {473 arrays.assertContainsSubsequence(info, actual, subsequence);474 return myself;475 }476 /**477 * Verifies that the actual array contains the given subsequence (possibly with other values between them).478 * <p>479 * Example:480 * <pre><code class='java'> // assertion will pass481 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence(new Short[] { 1, 2 });482 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence(new Short[] { 1, 3 });483 *484 * // assertion will fail485 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence(new Short[] { 2, 1 });</code></pre>486 *487 * @param subsequence the subsequence of values to look for.488 * @return myself assertion object.489 * @throws AssertionError if the actual array is {@code null}.490 * @throws AssertionError if the given array is {@code null}.491 * @throws AssertionError if the actual array does not contain the given subsequence.492 * @since 3.19.0493 */494 public SELF containsSubsequence(Short[] subsequence) {495 requireNonNullParameter(subsequence, "subsequence");496 arrays.assertContainsSubsequence(info, actual, toPrimitiveShortArray(subsequence));497 return myself;498 }499 /**500 * Verifies that the actual array contains the given subsequence (possibly with other values between them).501 * <p>502 * Example:503 * <pre><code class='java'> // assertion will pass504 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence(1, 2);505 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence(1, 3);506 *507 * // assertion will fail508 * assertThat(new short[] { 1, 2, 3 }).containsSubsequence(2, 1);</code></pre>509 *510 * @param subsequence the subsequence of values to look for.511 * @return myself assertion object.512 * @throws AssertionError if the actual array is {@code null}.513 * @throws AssertionError if the given array is {@code null}.514 * @throws AssertionError if the actual array does not contain the given subsequence.515 * @since 3.16.0516 */517 public SELF containsSubsequence(int... subsequence) {518 arrays.assertContainsSubsequence(info, actual, toShortArray(subsequence));519 return myself;520 }521 /**522 * Verifies that the actual array contains the given value at the given index.523 * <p>524 * Example:525 * <pre><code class='java'> // assertions will pass526 * assertThat(new short[] { 1, 2, 3 }).contains((short) 1, atIndex(O));527 * assertThat(new short[] { 1, 2, 3 }).contains((short) 3, atIndex(2));528 *529 * // assertions will fail530 * assertThat(new short[] { 1, 2, 3 }).contains((short) 1, atIndex(1));531 * assertThat(new short[] { 1, 2, 3 }).contains((short) 4, atIndex(2));</code></pre>532 *533 * @param value the value to look for.534 * @param index the index where the value should be stored in the actual array.535 * @return myself assertion object.536 * @throws AssertionError if the actual array is {@code null} or empty.537 * @throws NullPointerException if the given {@code Index} is {@code null}.538 * @throws IndexOutOfBoundsException if the value of the given {@code Index} is equal to or greater than the size of539 * the actual array.540 * @throws AssertionError if the actual array does not contain the given value at the given index.541 */542 public SELF contains(short value, Index index) {543 arrays.assertContains(info, actual, value, index);544 return myself;545 }546 /**547 * Verifies that the actual array contains the given value at the given index.548 * <p>549 * Example:550 * <pre><code class='java'> // assertions will pass551 * assertThat(new short[] { 1, 2, 3 }).contains(1, atIndex(O));552 * assertThat(new short[] { 1, 2, 3 }).contains(3, atIndex(2));553 *554 * // assertions will fail555 * assertThat(new short[] { 1, 2, 3 }).contains(1, atIndex(1));556 * assertThat(new short[] { 1, 2, 3 }).contains(4, atIndex(2));</code></pre>557 *558 * @param value the value to look for.559 * @param index the index where the value should be stored in the actual array.560 * @return myself assertion object.561 * @throws AssertionError if the actual array is {@code null} or empty.562 * @throws NullPointerException if the given {@code Index} is {@code null}.563 * @throws IndexOutOfBoundsException if the value of the given {@code Index} is equal to or greater than the size of564 * the actual array.565 * @throws AssertionError if the actual array does not contain the given value at the given index.566 * @since 3.16.0567 */568 public SELF contains(int value, Index index) {569 arrays.assertContains(info, actual, toShort(value), index);570 return myself;571 }572 /**573 * Verifies that the actual array does not contain the given values.574 * <p>575 * Example:576 * <pre><code class='java'> // assertion will pass577 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 4);578 *579 * // assertion will fail580 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 2);</code></pre>581 *582 * @param values the given values.583 * @return {@code this} assertion object.584 * @throws NullPointerException if the given argument is {@code null}.585 * @throws IllegalArgumentException if the given argument is an empty array.586 * @throws AssertionError if the actual array is {@code null}.587 * @throws AssertionError if the actual array contains any of the given values.588 */589 public SELF doesNotContain(short... values) {590 arrays.assertDoesNotContain(info, actual, values);591 return myself;592 }593 /**594 * Verifies that the actual array does not contain the values of the given array.595 * <p>596 * Example:597 * <pre><code class='java'> // assertion will pass598 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(new Short[] { 4 });599 *600 * // assertion will fail601 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(new Short[] { 2 });</code></pre>602 *603 * @param values the given values.604 * @return {@code this} assertion object.605 * @throws NullPointerException if the given argument is {@code null}.606 * @throws IllegalArgumentException if the given argument is an empty array.607 * @throws AssertionError if the actual array is {@code null}.608 * @throws AssertionError if the actual array contains any of the given values.609 * @since 3.19.0610 */611 public SELF doesNotContain(Short[] values) {612 requireNonNullParameter(values, "values");613 arrays.assertDoesNotContain(info, actual, toPrimitiveShortArray(values));614 return myself;615 }616 /**617 * Verifies that the actual array does not contain the given values.618 * <p>619 * Example:620 * <pre><code class='java'> // assertion will pass621 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(4);622 *623 * // assertion will fail624 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(2);</code></pre>625 *626 * @param values the given values.627 * @return {@code this} assertion object.628 * @throws NullPointerException if the given argument is {@code null}.629 * @throws IllegalArgumentException if the given argument is an empty array.630 * @throws AssertionError if the actual array is {@code null}.631 * @throws AssertionError if the actual array contains any of the given values.632 * @since 3.16.0633 */634 public SELF doesNotContain(int... values) {635 arrays.assertDoesNotContain(info, actual, toShortArray(values));636 return myself;637 }638 /**639 * Verifies that the actual array does not contain the given value at the given index.640 * <p>641 * Example:642 * <pre><code class='java'> // assertions will pass643 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 1, atIndex(1));644 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 2, atIndex(0));645 *646 * // assertions will fail647 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 1, atIndex(0));648 * assertThat(new short[] { 1, 2, 3 }).doesNotContain((short) 2, atIndex(1));</code></pre>649 *650 * @param value the value to look for.651 * @param index the index where the value should be stored in the actual array.652 * @return myself assertion object.653 * @throws AssertionError if the actual array is {@code null}.654 * @throws NullPointerException if the given {@code Index} is {@code null}.655 * @throws AssertionError if the actual array contains the given value at the given index.656 */657 public SELF doesNotContain(short value, Index index) {658 arrays.assertDoesNotContain(info, actual, value, index);659 return myself;660 }661 /**662 * Verifies that the actual array does not contain the given value at the given index.663 * <p>664 * Example:665 * <pre><code class='java'> // assertions will pass666 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(1, atIndex(1));667 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(2, atIndex(0));668 *669 * // assertions will fail670 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(1, atIndex(0));671 * assertThat(new short[] { 1, 2, 3 }).doesNotContain(2, atIndex(1));</code></pre>672 *673 * @param value the value to look for.674 * @param index the index where the value should be stored in the actual array.675 * @return myself assertion object.676 * @throws AssertionError if the actual array is {@code null}.677 * @throws NullPointerException if the given {@code Index} is {@code null}.678 * @throws AssertionError if the actual array contains the given value at the given index.679 * @since 3.16.0680 */681 public SELF doesNotContain(int value, Index index) {682 arrays.assertDoesNotContain(info, actual, toShort(value), index);683 return myself;684 }685 /**686 * Verifies that the actual array does not contain duplicates.687 * <p>688 * Example:689 * <pre><code class='java'> // assertion will pass690 * assertThat(new short[] { 1, 2, 3 }).doesNotHaveDuplicates();691 *692 * // assertion will fail693 * assertThat(new short[] { 1, 1, 2, 3 }).doesNotHaveDuplicates();</code></pre>694 *695 * @return {@code this} assertion object.696 * @throws AssertionError if the actual array is {@code null}.697 * @throws AssertionError if the actual array contains duplicates.698 */699 public SELF doesNotHaveDuplicates() {700 arrays.assertDoesNotHaveDuplicates(info, actual);701 return myself;702 }703 /**704 * Verifies that the actual array starts with the given sequence of values, without any other values between them.705 * Similar to <code>{@link #containsSequence(short...)}</code>, but it also verifies that the first element in the706 * sequence is also first element of the actual array.707 * <p>708 * Example:709 * <pre><code class='java'> // assertion will pass710 * assertThat(new short[] { 1, 2, 3 }).startsWith((short) 1, (short) 2);711 *712 * // assertion will fail713 * assertThat(new short[] { 1, 2, 3 }).startsWith((short) 2, (short) 3);</code></pre>714 *715 * @param sequence the sequence of values to look for.716 * @return myself assertion object.717 * @throws NullPointerException if the given argument is {@code null}.718 * @throws IllegalArgumentException if the given argument is an empty array.719 * @throws AssertionError if the actual array is {@code null}.720 * @throws AssertionError if the actual array does not start with the given sequence.721 */722 public SELF startsWith(short... sequence) {723 arrays.assertStartsWith(info, actual, sequence);724 return myself;725 }726 /**727 * Verifies that the actual array starts with the given sequence of values, without any other values between them.728 * Similar to <code>{@link #containsSequence(Short[])}</code>, but it also verifies that the first element in the729 * sequence is also first element of the actual array.730 * <p>731 * Example:732 * <pre><code class='java'> // assertion will pass733 * assertThat(new short[] { 1, 2, 3 }).startsWith(new Short[] { 1, 2 });734 *735 * // assertion will fail736 * assertThat(new short[] { 1, 2, 3 }).startsWith(new Short[] { 2, 3 });</code></pre>737 *738 * @param sequence the sequence of values to look for.739 * @return myself assertion object.740 * @throws NullPointerException if the given argument is {@code null}.741 * @throws IllegalArgumentException if the given argument is an empty array.742 * @throws AssertionError if the actual array is {@code null}.743 * @throws AssertionError if the actual array does not start with the given sequence.744 * @since 3.19.0745 */746 public SELF startsWith(Short[] sequence) {747 requireNonNullParameter(sequence, "sequence");748 arrays.assertStartsWith(info, actual, toPrimitiveShortArray(sequence));749 return myself;750 }751 /**752 * Verifies that the actual array starts with the given sequence of values, without any other values between them.753 * Similar to <code>{@link #containsSequence(short...)}</code>, but it also verifies that the first element in the754 * sequence is also first element of the actual array.755 * <p>756 * Example:757 * <pre><code class='java'> // assertion will pass758 * assertThat(new short[] { 1, 2, 3 }).startsWith(1, 2);759 *760 * // assertion will fail761 * assertThat(new short[] { 1, 2, 3 }).startsWith(2, 3);</code></pre>762 *763 * @param sequence the sequence of values to look for.764 * @return myself assertion object.765 * @throws NullPointerException if the given argument is {@code null}.766 * @throws IllegalArgumentException if the given argument is an empty array.767 * @throws AssertionError if the actual array is {@code null}.768 * @throws AssertionError if the actual array does not start with the given sequence.769 * @since 3.16.0770 */771 public SELF startsWith(int... sequence) {772 arrays.assertStartsWith(info, actual, toShortArray(sequence));773 return myself;774 }775 /**776 * Verifies that the actual array ends with the given sequence of values, without any other values between them.777 * Similar to <code>{@link #containsSequence(short...)}</code>, but it also verifies that the last element in the778 * sequence is also last element of the actual array.779 * <p>780 * Example:781 * <pre><code class='java'> // assertion will pass782 * assertThat(new short[] { 1, 2, 3 }).endsWith((short) 2, (short) 3);783 *784 * // assertion will fail785 * assertThat(new short[] { 1, 2, 3 }).endsWith((short) 3, (short) 4);</code></pre>786 *787 * @param sequence the sequence of values to look for.788 * @return myself assertion object.789 * @throws NullPointerException if the given argument is {@code null}.790 * @throws IllegalArgumentException if the given argument is an empty array.791 * @throws AssertionError if the actual array is {@code null}.792 * @throws AssertionError if the actual array does not end with the given sequence.793 */794 public SELF endsWith(short... sequence) {795 arrays.assertEndsWith(info, actual, sequence);796 return myself;797 }798 /**799 * Verifies that the actual array ends with the given sequence of values, without any other values between them.800 * Similar to <code>{@link #containsSequence(short...)}</code>, but it also verifies that the last element in the801 * sequence is also last element of the actual array.802 * <p>803 * Example:804 * <pre><code class='java'> // assertion will pass805 * assertThat(new short[] { 1, 2, 3 }).endsWith(new Short[] { 2, 3 });806 *807 * // assertion will fail808 * assertThat(new short[] { 1, 2, 3 }).endsWith(new Short[] { 3, 4 });</code></pre>809 *810 * @param sequence the sequence of values to look for.811 * @return myself assertion object.812 * @throws NullPointerException if the given argument is {@code null}.813 * @throws IllegalArgumentException if the given argument is an empty array.814 * @throws AssertionError if the actual array is {@code null}.815 * @throws AssertionError if the actual array does not end with the given sequence.816 * @since 3.19.0817 */818 public SELF endsWith(Short[] sequence) {819 requireNonNullParameter(sequence, "sequence");820 arrays.assertEndsWith(info, actual, toPrimitiveShortArray(sequence));821 return myself;822 }823 /**824 * Verifies that the actual array ends with the given sequence of values, without any other values between them.825 * Similar to <code>{@link #containsSequence(short...)}</code>, but it also verifies that the last element in the826 * sequence is also last element of the actual array.827 * <p>828 * Example:829 * <pre><code class='java'> // assertion will pass830 * assertThat(new short[] { 1, 2, 3 }).endsWith(2, 3);831 *832 * // assertion will fail833 * assertThat(new short[] { 1, 2, 3 }).endsWith(3, 4);</code></pre>834 *835 * @param sequence the sequence of values to look for.836 * @return myself assertion object.837 * @throws NullPointerException if the given argument is {@code null}.838 * @throws IllegalArgumentException if the given argument is an empty array.839 * @throws AssertionError if the actual array is {@code null}.840 * @throws AssertionError if the actual array does not end with the given sequence.841 * @since 3.16.0842 */843 public SELF endsWith(int... sequence) {844 arrays.assertEndsWith(info, actual, toShortArray(sequence));845 return myself;846 }847 /** {@inheritDoc} */848 @Override849 public SELF isSorted() {850 arrays.assertIsSorted(info, actual);851 return myself;852 }853 /** {@inheritDoc} */854 @Override855 public SELF isSortedAccordingTo(Comparator<? super Short> comparator) {856 arrays.assertIsSortedAccordingToComparator(info, actual, comparator);857 return myself;858 }859 /** {@inheritDoc} */860 @Override861 @CheckReturnValue862 public SELF usingElementComparator(Comparator<? super Short> customComparator) {863 this.arrays = new ShortArrays(new ComparatorBasedComparisonStrategy(customComparator));864 return myself;865 }866 /** {@inheritDoc} */867 @Override868 @CheckReturnValue869 public SELF usingDefaultElementComparator() {870 this.arrays = ShortArrays.instance();871 return myself;872 }873 /**874 * Verifies that the actual group contains only the given values and nothing else, <b>in order</b>.875 * <p>876 * Example :877 * <pre><code class='java'> short[] shorts = { 1, 2, 3 };878 *879 * // assertion will pass880 * assertThat(shorts).containsExactly((short) 1, (short) 2, (short) 3);881 *882 * // assertion will fail as actual and expected order differ883 * assertThat(shorts).containsExactly((short) 2, (short) 1, (short) 3);</code></pre>884 *885 * @param values the given values.886 * @return {@code this} assertion object.887 * @throws NullPointerException if the given argument is {@code null}.888 * @throws AssertionError if the actual group is {@code null}.889 * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group890 * contains some or none of the given values, or the actual group contains more values than the given ones891 * or values are the same but the order is not.892 */893 public SELF containsExactly(short... values) {894 arrays.assertContainsExactly(info, actual, values);895 return myself;896 }897 /**898 * Verifies that the actual group contains only the values of the given array and nothing else, <b>in order</b>.899 * <p>900 * Example :901 * <pre><code class='java'> short[] shorts = { 1, 2, 3 };902 *903 * // assertion will pass904 * assertThat(shorts).containsExactly(new Short[] { 1, 2, 3 });905 *906 * // assertion will fail as actual and expected order differ907 * assertThat(shorts).containsExactly(new Short[] { 2, 1, 3 });</code></pre>908 *909 * @param values the given values.910 * @return {@code this} assertion object.911 * @throws NullPointerException if the given argument is {@code null}.912 * @throws AssertionError if the actual group is {@code null}.913 * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group914 * contains some or none of the given values, or the actual group contains more values than the given ones915 * or values are the same but the order is not.916 * @since 3.19.0917 */918 public SELF containsExactly(Short[] values) {919 requireNonNullParameter(values, "values");920 arrays.assertContainsExactly(info, actual, toPrimitiveShortArray(values));921 return myself;922 }923 /**924 * Verifies that the actual group contains only the given values and nothing else, <b>in order</b>.925 * <p>926 * Example :927 * <pre><code class='java'> short[] shorts = { 1, 2, 3 };928 *929 * // assertion will pass930 * assertThat(shorts).containsExactly(1, 2, 3);931 *932 * // assertion will fail as actual and expected order differ933 * assertThat(shorts).containsExactly(2, 1, 3);</code></pre>934 *935 * @param values the given values.936 * @return {@code this} assertion object.937 * @throws NullPointerException if the given argument is {@code null}.938 * @throws AssertionError if the actual group is {@code null}.939 * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group940 * contains some or none of the given values, or the actual group contains more values than the given ones941 * or values are the same but the order is not.942 * @since 3.16.0943 */944 public SELF containsExactly(int... values) {945 arrays.assertContainsExactly(info, actual, toShortArray(values));946 return myself;947 }948 /**949 * Verifies that the actual group contains exactly the given values and nothing else, <b>in any order</b>.<br>950 * <p>951 * Example :952 * <pre><code class='java'> // assertions will pass953 * assertThat(new short[] { 1, 2 }).containsExactlyInAnyOrder((short) 1, (short) 2);954 * assertThat(new short[] { 1, 2, 1 }).containsExactlyInAnyOrder((short) 1, (short) 1, (short) 2);955 *956 * // assertions will fail957 * assertThat(new short[] { 1, 2 }).containsExactlyInAnyOrder((short) 1);958 * assertThat(new short[] { 1 }).containsExactlyInAnyOrder((short) 1, (short) 2);959 * assertThat(new short[] { 1, 2, 1 }).containsExactlyInAnyOrder((short) 1, (short) 2);</code></pre>960 *961 * @param values the given values.962 * @return {@code this} assertion object.963 * @throws NullPointerException if the given argument is {@code null}.964 * @throws AssertionError if the actual group is {@code null}.965 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group966 * contains some or none of the given values, or the actual group contains more values than the given ones.967 * @since 2.6.0 / 3.6.0968 */969 public SELF containsExactlyInAnyOrder(short... values) {970 arrays.assertContainsExactlyInAnyOrder(info, actual, values);971 return myself;972 }973 /**974 * Verifies that the actual group contains exactly the values of the given array and nothing else, <b>in any order</b>.<br>975 * <p>976 * Example :977 * <pre><code class='java'> // assertions will pass978 * assertThat(new short[] { 1, 2 }).containsExactlyInAnyOrder(new Short[] { 1, 2 });979 * assertThat(new short[] { 1, 2, 1 }).containsExactlyInAnyOrder(new Short[] { 1, 1, 2 });980 *981 * // assertions will fail982 * assertThat(new short[] { 1, 2 }).containsExactlyInAnyOrder(new Short[] { 1 });983 * assertThat(new short[] { 1 }).containsExactlyInAnyOrder(new Short[] { 1, 2 });984 * assertThat(new short[] { 1, 2, 1 }).containsExactlyInAnyOrder(new Short[] { 1, 2 });</code></pre>985 *986 * @param values the given values.987 * @return {@code this} assertion object.988 * @throws NullPointerException if the given argument is {@code null}.989 * @throws AssertionError if the actual group is {@code null}.990 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group991 * contains some or none of the given values, or the actual group contains more values than the given ones.992 * @since 3.19.0993 */994 public SELF containsExactlyInAnyOrder(Short[] values) {995 requireNonNullParameter(values, "values");996 arrays.assertContainsExactlyInAnyOrder(info, actual, toPrimitiveShortArray(values));997 return myself;998 }999 /**1000 * Verifies that the actual group contains exactly the given values and nothing else, <b>in any order</b>.<br>1001 * <p>1002 * Example :1003 * <pre><code class='java'> // assertions will pass1004 * assertThat(new short[] { 1, 2 }).containsExactlyInAnyOrder(1, 2);1005 * assertThat(new short[] { 1, 2, 1 }).containsExactlyInAnyOrder(1, 1, 2);1006 *1007 * // assertions will fail1008 * assertThat(new short[] { 1, 2 }).containsExactlyInAnyOrder(1);1009 * assertThat(new short[] { 1 }).containsExactlyInAnyOrder(1, 2);1010 * assertThat(new short[] { 1, 2, 1 }).containsExactlyInAnyOrder(1, 2);</code></pre>1011 *1012 * @param values the given values.1013 * @return {@code this} assertion object.1014 * @throws NullPointerException if the given argument is {@code null}.1015 * @throws AssertionError if the actual group is {@code null}.1016 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group1017 * contains some or none of the given values, or the actual group contains more values than the given ones.1018 * @since 3.16.01019 */1020 public SELF containsExactlyInAnyOrder(int... values) {1021 arrays.assertContainsExactlyInAnyOrder(info, actual, toShortArray(values));1022 return myself;1023 }1024 /**1025 * Verifies that the actual array contains at least one of the given values.1026 * <p>1027 * Example :1028 * <pre><code class='java'> short[] oneTwoThree = { 1, 2, 3 };1029 *1030 * // assertions will pass1031 * assertThat(abc).containsAnyOf((short) 2)1032 * .containsAnyOf((short) 2, (short) 3)1033 * .containsAnyOf((short) 1, (short) 2, (short) 3)1034 * .containsAnyOf((short) 1, (short) 2, (short) 3, (short) 4)1035 * .containsAnyOf((short) 5, (short) 6, (short) 7, (short) 2);1036 *1037 * // assertions will fail1038 * assertThat(abc).containsAnyOf((short) 4);1039 * assertThat(abc).containsAnyOf((short) 4, (short) 5, (short) 6, (short) 7);</code></pre>1040 *1041 * @param values the values whose at least one which is expected to be in the array under test.1042 * @return {@code this} assertion object.1043 * @throws NullPointerException if the array of values is {@code null}.1044 * @throws IllegalArgumentException if the array of values is empty and the array under test is not empty.1045 * @throws AssertionError if the array under test is {@code null}.1046 * @throws AssertionError if the array under test does not contain any of the given {@code values}.1047 * @since 2.9.0 / 3.9.01048 */1049 public SELF containsAnyOf(short... values) {1050 arrays.assertContainsAnyOf(info, actual, values);1051 return myself;1052 }1053 /**1054 * Verifies that the actual array contains at least one of the values of the given array.1055 * <p>1056 * Example :1057 * <pre><code class='java'> short[] oneTwoThree = { 1, 2, 3 };1058 *1059 * // assertions will pass1060 * assertThat(abc).containsAnyOf(new Short[] { 2 })1061 * .containsAnyOf(new Short[] { 2, 3 })1062 * .containsAnyOf(new Short[] { 1, 2, 3 })1063 * .containsAnyOf(new Short[] { 1, 2, 3, 4 })1064 * .containsAnyOf(new Short[] { 5, 6, 7, 2 });1065 *1066 * // assertions will fail1067 * assertThat(abc).containsAnyOf(new Short[] { 4 });1068 * assertThat(abc).containsAnyOf(new Short[] { 4, 5, 6, 7 });</code></pre>1069 *1070 * @param values the values whose at least one which is expected to be in the array under test.1071 * @return {@code this} assertion object.1072 * @throws NullPointerException if the array of values is {@code null}.1073 * @throws IllegalArgumentException if the array of values is empty and the array under test is not empty.1074 * @throws AssertionError if the array under test is {@code null}.1075 * @throws AssertionError if the array under test does not contain any of the given {@code values}.1076 * @since 3.19.01077 */1078 public SELF containsAnyOf(Short[] values) {1079 requireNonNullParameter(values, "values");1080 arrays.assertContainsAnyOf(info, actual, toPrimitiveShortArray(values));1081 return myself;1082 }1083 /**1084 * Verifies that the actual array contains at least one of the given values.1085 * <p>1086 * Example :1087 * <pre><code class='java'> short[] oneTwoThree = { 1, 2, 3 };1088 *1089 * // assertions will pass1090 * assertThat(abc).containsAnyOf(2)1091 * .containsAnyOf(2, 3)1092 * .containsAnyOf(1, 2, 3)1093 * .containsAnyOf(1, 2, 3, 4)1094 * .containsAnyOf(5, 6, 7, 2);1095 *1096 * // assertions will fail1097 * assertThat(abc).containsAnyOf(4);1098 * assertThat(abc).containsAnyOf(4, 5, 6, 7);</code></pre>1099 *1100 * @param values the values whose at least one which is expected to be in the array under test.1101 * @return {@code this} assertion object.1102 * @throws NullPointerException if the array of values is {@code null}.1103 * @throws IllegalArgumentException if the array of values is empty and the array under test is not empty.1104 * @throws AssertionError if the array under test is {@code null}.1105 * @throws AssertionError if the array under test does not contain any of the given {@code values}.1106 * @since 3.16.01107 */1108 public SELF containsAnyOf(int... values) {1109 arrays.assertContainsAnyOf(info, actual, toShortArray(values));1110 return myself;1111 }1112 private static short[] toShortArray(int[] ints) {1113 if (ints == null) return null;1114 short[] shorts = new short[ints.length];1115 for (int i = 0; i < shorts.length; i++) {1116 shorts[i] = toShort(ints[i]);1117 }1118 return shorts;1119 }1120 private static short toShort(int value) {1121 return (short) value;1122 }1123 private static short[] toPrimitiveShortArray(Short[] values) {1124 short[] shorts = new short[values.length];1125 range(0, values.length).forEach(i -> shorts[i] = values[i]);1126 return shorts;1127 }1128}...

Full Screen

Full Screen

toPrimitiveShortArray

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

toPrimitiveShortArray

Using AI Code Generation

copy

Full Screen

1[Short[]]::new(1,2,3).toPrimitiveShortArray() | Should -Be 1,2,32[Short[]]::new(1,2,3).toPrimitiveShortArray() | Should -Be 1,2,33[Short[]]::new(1,2,3).toPrimitiveShortArray() | Should -Be 1,2,34[Short[]]::new(1,2,3).toPrimitiveShortArray() | Should -Be 1,2,35[Short[]]::new(1,2,3).toPrimitiveShortArray() | Should -Be 1,2,36[Short[]]::new(1,2,3).toPrimitiveShortArray() | Should -Be 1,2,37[Short[]]::new(1,2,3).toPrimitiveShortArray() | Should -Be 1,2,38[Short[]]::new(1,2,3).toPrimitiveShortArray() | Should -Be 1,2,39[Short[]]::new(1,2,3).toPrimitiveShortArray() | Should -Be 1,2,310[Short[]]::new(1,2,3).toPrimitiveShortArray() | Should -Be 1,2,3

Full Screen

Full Screen

toPrimitiveShortArray

Using AI Code Generation

copy

Full Screen

1Short[] shortArray = new Short[]{1, 2, 3, 4, 5};2short[] primitiveShortArray = assertThat(shortArray).toPrimitiveShortArray();3Short[] shortArray = new Short[]{1, 2, 3, 4, 5};4short[] primitiveShortArray = assertThat(shortArray).toPrimitiveShortArray(shortValue -> shortValue > 3);5Short[] shortArray = new Short[]{1, 2, 3, 4, 5};6short[] primitiveShortArray = assertThat(shortArray).toPrimitiveShortArray(shortValue -> shortValue > 3, "filtering short values greater than 3");7Short[] shortArray = new Short[]{1, 2, 3, 4, 5};8short[] primitiveShortArray = assertThat(shortArray).toPrimitiveShortArray(shortValue -> shortValue > 3, "filtering short values greater than 3", shortValue -> "short value: " + shortValue);9Short[] shortArray = new Short[]{1, 2, 3, 4, 5};10short[] primitiveShortArray = assertThat(shortArray).toPrimitiveShortArray("filtering short values greater than 3", shortValue -> "short value: " + shortValue);11Short[] shortArray = new Short[]{1, 2, 3, 4, 5};12short[] primitiveShortArray = assertThat(shortArray).toPrimitiveShortArray("filtering short values greater than 3");

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