How to use toPrimitiveCharacterArray method of org.assertj.core.api.AbstractCharArrayAssert class

Best Assertj code snippet using org.assertj.core.api.AbstractCharArrayAssert.toPrimitiveCharacterArray

Source:AbstractCharArrayAssert.java Github

copy

Full Screen

...223 * @since 3.19.0224 */225 public SELF contains(Character[] values) {226 requireNonNullParameter(values, "values");227 arrays.assertContains(info, actual, toPrimitiveCharacterArray(values));228 return myself;229 }230 /**231 * Verifies that the actual array contains only the given values and nothing else, in any order.232 * <p>233 * Example:234 * <pre><code class='java'> // assertion will pass235 * assertThat(new char[] { 'a', 'b', 'c' }).containsOnly('a', 'b', 'c');236 * assertThat(new char[] { 'a', 'b', 'c' }).containsOnly('b', 'c', 'a');237 * assertThat(new char[] { 'a', 'a', 'b' }).containsOnly('a', 'b');238 *239 * // assertion will fail240 * * assertThat(new char[] { 'a', 'b', 'c' }).containsOnly('a', 'b', 'c', 'd');241 * * assertThat(new char[] { 'a', 'b', 'c' }).containsOnly('d', 'f');</code></pre>242 *243 * @param values the given values.244 * @return {@code this} assertion object.245 * @throws NullPointerException if the given argument is {@code null}.246 * @throws IllegalArgumentException if the given argument is an empty array.247 * @throws AssertionError if the actual array is {@code null}.248 * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array contains some249 * or none of the given values, or the actual array contains more values than the given ones.250 */251 public SELF containsOnly(char... values) {252 arrays.assertContainsOnly(info, actual, values);253 return myself;254 }255 /**256 * Verifies that the actual array contains only the values of the given array and nothing else, in any order.257 * <p>258 * Example:259 * <pre><code class='java'> // assertion will pass260 * assertThat(new char[] { 'a', 'b', 'c' }).containsOnly(new Character[] { 'a', 'b', 'c' });261 * assertThat(new char[] { 'a', 'b', 'c' }).containsOnly(new Character[] { 'b', 'c', 'a' });262 * assertThat(new char[] { 'a', 'a', 'b' }).containsOnly(new Character[] { 'a', 'b' });263 *264 * // assertion will fail265 * * assertThat(new char[] { 'a', 'b', 'c' }).containsOnly(new Character[] { 'a', 'b', 'c', 'd' });266 * * assertThat(new char[] { 'a', 'b', 'c' }).containsOnly(new Character[] { 'd', 'f' });</code></pre>267 *268 * @param values the given values.269 * @return {@code this} assertion object.270 * @throws NullPointerException if the given argument is {@code null}.271 * @throws IllegalArgumentException if the given argument is an empty array.272 * @throws AssertionError if the actual array is {@code null}.273 * @throws AssertionError if the actual array does not contain the given values, i.e. the actual array contains some274 * or none of the given values, or the actual array contains more values than the given ones.275 * @since 3.19.0276 */277 public SELF containsOnly(Character[] values) {278 requireNonNullParameter(values, "values");279 arrays.assertContainsOnly(info, actual, toPrimitiveCharacterArray(values));280 return myself;281 }282 /**283 * Verifies that the actual array contains the given values only once.284 * <p>285 * Examples :286 * <pre><code class='java'> // assertion will pass287 * assertThat(new char[] { 'a', 'b', 'c' }).containsOnlyOnce('a', 'b');288 *289 * // assertions will fail290 * assertThat(new char[] { 'a', 'b', 'a' }).containsOnlyOnce('a');291 * assertThat(new char[] { 'a', 'b', 'c' }).containsOnlyOnce('d');292 * assertThat(new char[] { 'a', 'b', 'c', 'c' }).containsOnlyOnce('0', 'a', 'b', 'c', 'd', 'e');</code></pre>293 *294 * @param values the given values.295 * @return {@code this} assertion object.296 * @throws NullPointerException if the given argument is {@code null}.297 * @throws IllegalArgumentException if the given argument is an empty array.298 * @throws AssertionError if the actual array is {@code null}.299 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group contains some300 * or none of the given values, or the actual group contains more than once these values.301 */302 public SELF containsOnlyOnce(char... values) {303 arrays.assertContainsOnlyOnce(info, actual, values);304 return myself;305 }306 /**307 * Verifies that the actual array contains the values of the given array only once.308 * <p>309 * Examples :310 * <pre><code class='java'> // assertion will pass311 * assertThat(new char[] { 'a', 'b', 'c' }).containsOnlyOnce(new Character[] { 'a', 'b' });312 *313 * // assertions will fail314 * assertThat(new char[] { 'a', 'b', 'a' }).containsOnlyOnce(new Character[] { 'a' });315 * assertThat(new char[] { 'a', 'b', 'c' }).containsOnlyOnce(new Character[] { 'd' });316 * assertThat(new char[] { 'a', 'b', 'c', 'c' }).containsOnlyOnce(new Character[] { '0', 'a', 'b', 'c', 'd', 'e' });</code></pre>317 *318 * @param values the given values.319 * @return {@code this} assertion object.320 * @throws NullPointerException if the given argument is {@code null}.321 * @throws IllegalArgumentException if the given argument is an empty array.322 * @throws AssertionError if the actual array is {@code null}.323 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group contains some324 * or none of the given values, or the actual group contains more than once these values.325 * @since 3.19.0326 */327 public SELF containsOnlyOnce(Character[] values) {328 requireNonNullParameter(values, "values");329 arrays.assertContainsOnlyOnce(info, actual, toPrimitiveCharacterArray(values));330 return myself;331 }332 /**333 * Verifies that the actual array contains the given sequence, without any other values between them.334 * <p>335 * Example:336 * <pre><code class='java'> // assertion will pass337 * assertThat(new char[] { 'a', 'b', 'c' }).containsSequence('a', 'b');338 * assertThat(new char[] { 'a', 'b', 'c' }).containsSequence('a', 'b', 'c');339 * assertThat(new char[] { 'a', 'b', 'c' }).containsSequence('b', 'c');340 *341 * // assertion will fail342 * assertThat(new char[] { 'a', 'b', 'c' }).containsSequence('c', 'a');343 * assertThat(new char[] { 'a', 'b', 'c' }).containsSequence('d', 'f');</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 */351 public SELF containsSequence(char... sequence) {352 arrays.assertContainsSequence(info, actual, sequence);353 return myself;354 }355 /**356 * Verifies that the actual array contains the given sequence, without any other values between them.357 * <p>358 * Example:359 * <pre><code class='java'> // assertion will pass360 * assertThat(new char[] { 'a', 'b', 'c' }).containsSequence(new Character[] { 'a', 'b' });361 * assertThat(new char[] { 'a', 'b', 'c' }).containsSequence(new Character[] { 'a', 'b', 'c' });362 * assertThat(new char[] { 'a', 'b', 'c' }).containsSequence(new Character[] { 'b', 'c' });363 *364 * // assertion will fail365 * assertThat(new char[] { 'a', 'b', 'c' }).containsSequence(new Character[] { 'c', 'a' });366 * assertThat(new char[] { 'a', 'b', 'c' }).containsSequence(new Character[] { 'd', 'f' });</code></pre>367 *368 * @param sequence the sequence 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 sequence.373 * @since 3.19.0374 */375 public SELF containsSequence(Character[] sequence) {376 requireNonNullParameter(sequence, "sequence");377 arrays.assertContainsSequence(info, actual, toPrimitiveCharacterArray(sequence));378 return myself;379 }380 /**381 * Verifies that the actual array contains the given subsequence (possibly with other values between them).382 * <p>383 * Example:384 * <pre><code class='java'> // assertion will pass385 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence('a', 'b');386 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence('a', 'c');387 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence('b', 'c');388 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence('a', 'b', 'c');389 *390 * // assertion will fail391 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence('c', 'a');392 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence('d', 'f');</code></pre>393 *394 * @param subsequence the subsequence of values to look for.395 * @return myself assertion object.396 * @throws AssertionError if the actual array is {@code null}.397 * @throws AssertionError if the given array is {@code null}.398 * @throws AssertionError if the actual array does not contain the given subsequence.399 */400 public SELF containsSubsequence(char... subsequence) {401 arrays.assertContainsSubsequence(info, actual, subsequence);402 return myself;403 }404 /**405 * Verifies that the actual array contains the given subsequence (possibly with other values between them).406 * <p>407 * Example:408 * <pre><code class='java'> // assertion will pass409 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence(new Character[] { 'a', 'b' });410 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence(new Character[] { 'a', 'c' });411 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence(new Character[] { 'b', 'c' });412 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence(new Character[] { 'a', 'b', 'c' });413 *414 * // assertion will fail415 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence(new Character[] { 'c', 'a' });416 * assertThat(new char[] { 'a', 'b', 'c' }).containsSubsequence(new Character[] { 'd', 'f' });</code></pre>417 *418 * @param subsequence the subsequence of values to look for.419 * @return myself assertion object.420 * @throws AssertionError if the actual array is {@code null}.421 * @throws AssertionError if the given array is {@code null}.422 * @throws AssertionError if the actual array does not contain the given subsequence.423 * @since 3.19.0424 */425 public SELF containsSubsequence(Character[] subsequence) {426 requireNonNullParameter(subsequence, "subsequence");427 arrays.assertContainsSubsequence(info, actual, toPrimitiveCharacterArray(subsequence));428 return myself;429 }430 /**431 * Verifies that the actual array contains the given value at the given index.432 * <p>433 * Example:434 * <pre><code class='java'> // assertion will pass435 * assertThat(new char[] { 'a', 'b', 'c' }).contains('a', atIndex(O));436 * assertThat(new char[] { 'a', 'b', 'c' }).contains('c', atIndex(2));437 *438 * // assertion will fail439 * assertThat(new char[] { 'a', 'b', 'c' }).contains('a', atIndex(1));440 * assertThat(new char[] { 'a', 'b', 'c' }).contains('d', atIndex(2));</code></pre>441 *442 * @param value the value to look for.443 * @param index the index where the value should be stored in the actual array.444 * @return myself assertion object.445 * @throws AssertionError if the actual array is {@code null} or empty.446 * @throws NullPointerException if the given {@code Index} is {@code null}.447 * @throws IndexOutOfBoundsException if the value of the given {@code Index} is equal to or greater than the size of448 * the actual array.449 * @throws AssertionError if the actual array does not contain the given value at the given index.450 */451 public SELF contains(char value, Index index) {452 arrays.assertContains(info, actual, value, index);453 return myself;454 }455 /**456 * Verifies that the actual array does not contain the given values.457 * <p>458 * Example:459 * <pre><code class='java'> // assertion will pass460 * assertThat(new char[] { 'a', 'b', 'c' }).doesNotContain('d');461 *462 * // assertion will fail463 * assertThat(new char[] { 'a', 'b', 'c' }).doesNotContain('b');</code></pre>464 *465 * @param values the given values.466 * @return {@code this} assertion object.467 * @throws NullPointerException if the given argument is {@code null}.468 * @throws IllegalArgumentException if the given argument is an empty array.469 * @throws AssertionError if the actual array is {@code null}.470 * @throws AssertionError if the actual array contains any of the given values.471 */472 public SELF doesNotContain(char... values) {473 arrays.assertDoesNotContain(info, actual, values);474 return myself;475 }476 /**477 * Verifies that the actual array does not contain the given values.478 * <p>479 * Example:480 * <pre><code class='java'> // assertion will pass481 * assertThat(new char[] { 'a', 'b', 'c' }).doesNotContain(new Character[] { 'd' });482 *483 * // assertion will fail484 * assertThat(new char[] { 'a', 'b', 'c' }).doesNotContain(new Character[] { 'b' });</code></pre>485 *486 * @param values the given values.487 * @return {@code this} assertion object.488 * @throws NullPointerException if the given argument is {@code null}.489 * @throws IllegalArgumentException if the given argument is an empty array.490 * @throws AssertionError if the actual array is {@code null}.491 * @throws AssertionError if the actual array contains any of the given values.492 * @since 3.19.0493 */494 public SELF doesNotContain(Character[] values) {495 requireNonNullParameter(values, "values");496 arrays.assertDoesNotContain(info, actual, toPrimitiveCharacterArray(values));497 return myself;498 }499 /**500 * Verifies that the actual array does not contain the given value at the given index.501 * <p>502 * Example:503 * <pre><code class='java'> // assertion will pass504 * assertThat(new char[] { 'a', 'b', 'c' }).doesNotContain('a', atIndex(1));505 * assertThat(new char[] { 'a', 'b', 'c' }).doesNotContain('b', atIndex(0));506 *507 * // assertion will fail508 * assertThat(new char[] { 'a', 'b', 'c' }).doesNotContain('a', atIndex(0));509 * assertThat(new char[] { 'a', 'b', 'c' }).doesNotContain('b', atIndex(1));</code></pre>510 *511 * @param value the value to look for.512 * @param index the index where the value should be stored in the actual array.513 * @return myself assertion object.514 * @throws AssertionError if the actual array is {@code null}.515 * @throws NullPointerException if the given {@code Index} is {@code null}.516 * @throws AssertionError if the actual array contains the given value at the given index.517 */518 public SELF doesNotContain(char value, Index index) {519 arrays.assertDoesNotContain(info, actual, value, index);520 return myself;521 }522 /**523 * Verifies that the actual array does not contain duplicates.524 * <p>525 * Example:526 * <pre><code class='java'> // assertion will pass527 * assertThat(new char[] { 'a', 'b', 'c' }).doesNotHaveDuplicates();528 *529 * // assertion will fail530 * assertThat(new char[] { 'a', 'a', 'b', 'c' }).doesNotHaveDuplicates();</code></pre>531 *532 * @return {@code this} assertion object.533 * @throws AssertionError if the actual array is {@code null}.534 * @throws AssertionError if the actual array contains duplicates.535 */536 public SELF doesNotHaveDuplicates() {537 arrays.assertDoesNotHaveDuplicates(info, actual);538 return myself;539 }540 /**541 * Verifies that the actual array starts with the given sequence of values, without any other values between them.542 * Similar to <code>{@link #containsSequence(char...)}</code>, but it also verifies that the first element in the543 * sequence is also first element of the actual array.544 * <p>545 * Example:546 * <pre><code class='java'> // assertion will pass547 * assertThat(new char[] { 'a', 'b', 'c' }).startsWith('a', 'b');548 *549 * // assertion will fail550 * assertThat(new char[] { 'a', 'b', 'c' }).startsWith('b', 'c');</code></pre>551 *552 * @param sequence the sequence of values to look for.553 * @return myself assertion object.554 * @throws NullPointerException if the given argument is {@code null}.555 * @throws IllegalArgumentException if the given argument is an empty array.556 * @throws AssertionError if the actual array is {@code null}.557 * @throws AssertionError if the actual array does not start with the given sequence.558 */559 public SELF startsWith(char... sequence) {560 arrays.assertStartsWith(info, actual, sequence);561 return myself;562 }563 /**564 * Verifies that the actual array starts with the given sequence of values, without any other values between them.565 * Similar to <code>{@link #containsSequence(char...)}</code>, but it also verifies that the first element in the566 * sequence is also first element of the actual array.567 * <p>568 * Example:569 * <pre><code class='java'> // assertion will pass570 * assertThat(new char[] { 'a', 'b', 'c' }).startsWith(new Character[] { 'a', 'b' });571 *572 * // assertion will fail573 * assertThat(new char[] { 'a', 'b', 'c' }).startsWith(new Character[] { 'b', 'c' });</code></pre>574 *575 * @param sequence the sequence of values to look for.576 * @return myself assertion object.577 * @throws NullPointerException if the given argument is {@code null}.578 * @throws IllegalArgumentException if the given argument is an empty array.579 * @throws AssertionError if the actual array is {@code null}.580 * @throws AssertionError if the actual array does not start with the given sequence.581 * @since 3.19.0582 */583 public SELF startsWith(Character[] sequence) {584 requireNonNullParameter(sequence, "sequence");585 arrays.assertStartsWith(info, actual, toPrimitiveCharacterArray(sequence));586 return myself;587 }588 /**589 * Verifies that the actual array ends with the given sequence of values, without any other values between them.590 * Similar to <code>{@link #containsSequence(char...)}</code>, but it also verifies that the last element in the591 * sequence is also last element of the actual array.592 * <p>593 * Example:594 * <pre><code class='java'> // assertion will pass595 * assertThat(new char[] { 'a', 'b', 'c' }).endsWith('b', 'c');596 *597 * // assertion will fail598 * assertThat(new char[] { 'a', 'b', 'c' }).endsWith('c', 'd');</code></pre>599 *600 * @param sequence the sequence of values to look for.601 * @return myself assertion object.602 * @throws NullPointerException if the given argument is {@code null}.603 * @throws IllegalArgumentException if the given argument is an empty array.604 * @throws AssertionError if the actual array is {@code null}.605 * @throws AssertionError if the actual array does not end with the given sequence.606 */607 public SELF endsWith(char... sequence) {608 arrays.assertEndsWith(info, actual, sequence);609 return myself;610 }611 /**612 * Verifies that the actual array ends with the given sequence of values, without any other values between them.613 * Similar to <code>{@link #containsSequence(char...)}</code>, but it also verifies that the last element in the614 * sequence is also last element of the actual array.615 * <p>616 * Example:617 * <pre><code class='java'> // assertion will pass618 * assertThat(new char[] { 'a', 'b', 'c' }).endsWith(new Character[] { 'b', 'c' });619 *620 * // assertion will fail621 * assertThat(new char[] { 'a', 'b', 'c' }).endsWith(new Character[] { 'c', 'd' });</code></pre>622 *623 * @param sequence the sequence of values to look for.624 * @return myself assertion object.625 * @throws NullPointerException if the given argument is {@code null}.626 * @throws IllegalArgumentException if the given argument is an empty array.627 * @throws AssertionError if the actual array is {@code null}.628 * @throws AssertionError if the actual array does not end with the given sequence.629 * @since 3.19.0630 */631 public SELF endsWith(Character[] sequence) {632 requireNonNullParameter(sequence, "sequence");633 arrays.assertEndsWith(info, actual, toPrimitiveCharacterArray(sequence));634 return myself;635 }636 /** {@inheritDoc} */637 @Override638 public SELF isSorted() {639 arrays.assertIsSorted(info, actual);640 return myself;641 }642 /** {@inheritDoc} */643 @Override644 public SELF isSortedAccordingTo(Comparator<? super Character> comparator) {645 arrays.assertIsSortedAccordingToComparator(info, actual, comparator);646 return myself;647 }648 /** {@inheritDoc} */649 @Override650 @CheckReturnValue651 public SELF usingElementComparator(Comparator<? super Character> customComparator) {652 this.arrays = new CharArrays(new ComparatorBasedComparisonStrategy(customComparator));653 return myself;654 }655 /** {@inheritDoc} */656 @Override657 @CheckReturnValue658 public SELF usingDefaultElementComparator() {659 this.arrays = CharArrays.instance();660 return myself;661 }662 /**663 * Verifies that the actual group contains only the given values and nothing else, <b>in order</b>.664 * <p>665 * Example :666 * <pre><code class='java'> // assertion will pass667 * assertThat(new char[] { 'a', 'b', 'c' }).containsExactly('a', 'b', 'c');668 *669 * // assertion will fail as actual and expected order differ670 * assertThat(new char[] { 'a', 'b', 'c' }).containsExactly('b', 'a', 'c');</code></pre>671 *672 * @param values the given values.673 * @return {@code this} assertion object.674 * @throws NullPointerException if the given argument is {@code null}.675 * @throws AssertionError if the actual group is {@code null}.676 * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group677 * contains some or none of the given values, or the actual group contains more values than the given ones678 * or values are the same but the order is not.679 */680 public SELF containsExactly(char... values) {681 arrays.assertContainsExactly(info, actual, values);682 return myself;683 }684 /**685 * Verifies that the actual group contains only the values of the given array and nothing else, <b>in order</b>.686 * <p>687 * Example :688 * <pre><code class='java'> // assertion will pass689 * assertThat(new char[] { 'a', 'b', 'c' }).containsExactly(new Character[] { 'a', 'b', 'c' });690 *691 * // assertion will fail as actual and expected order differ692 * assertThat(new char[] { 'a', 'b', 'c' }).containsExactly(new Character[] { 'b', 'a', 'c' });</code></pre>693 *694 * @param values the given values.695 * @return {@code this} assertion object.696 * @throws NullPointerException if the given argument is {@code null}.697 * @throws AssertionError if the actual group is {@code null}.698 * @throws AssertionError if the actual group does not contain the given values with same order, i.e. the actual group699 * contains some or none of the given values, or the actual group contains more values than the given ones700 * or values are the same but the order is not.701 * @since 3.19.0702 */703 public SELF containsExactly(Character[] values) {704 requireNonNullParameter(values, "values");705 arrays.assertContainsExactly(info, actual, toPrimitiveCharacterArray(values));706 return myself;707 }708 /**709 * Verifies that the actual group contains exactly the given values and nothing else, <b>in any order</b>.<br>710 * <p>711 * Example :712 * <pre><code class='java'> // assertions will pass713 * assertThat(new char[] { 'a', 'b' }).containsExactlyInAnyOrder('b', 'a');714 * assertThat(new char[] { 'a', 'b', 'a' }).containsExactlyInAnyOrder('a', 'a', 'b');715 *716 * // assertions will fail717 * assertThat(new char[] { 'a', 'b' }).containsExactlyInAnyOrder('a');718 * assertThat(new char[] { 'a' }).containsExactlyInAnyOrder('a', 'b');719 * assertThat(new char[] { 'a', 'b', 'a' }).containsExactlyInAnyOrder('a', 'b');</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 2.6.0 / 3.6.0728 */729 public SELF containsExactlyInAnyOrder(char... values) {730 arrays.assertContainsExactlyInAnyOrder(info, actual, values);731 return myself;732 }733 /**734 * Verifies that the actual group contains exactly the values of the given array and nothing else, <b>in any order</b>.<br>735 * <p>736 * Example :737 * <pre><code class='java'> // assertions will pass738 * assertThat(new char[] { 'a', 'b' }).containsExactlyInAnyOrder(new Character[] { 'b', 'a' });739 * assertThat(new char[] { 'a', 'b', 'a' }).containsExactlyInAnyOrder(new Character[] { 'a', 'a', 'b' });740 *741 * // assertions will fail742 * assertThat(new char[] { 'a', 'b' }).containsExactlyInAnyOrder(new Character[] { 'a' });743 * assertThat(new char[] { 'a' }).containsExactlyInAnyOrder(new Character[] { 'a', 'b' });744 * assertThat(new char[] { 'a', 'b', 'a' }).containsExactlyInAnyOrder(new Character[] { 'a', 'b' });</code></pre>745 *746 * @param values the given values.747 * @return {@code this} assertion object.748 * @throws NullPointerException if the given argument is {@code null}.749 * @throws AssertionError if the actual group is {@code null}.750 * @throws AssertionError if the actual group does not contain the given values, i.e. the actual group751 * contains some or none of the given values, or the actual group contains more values than the given ones.752 * @since 3.19.0753 */754 public SELF containsExactlyInAnyOrder(Character[] values) {755 requireNonNullParameter(values, "values");756 arrays.assertContainsExactlyInAnyOrder(info, actual, toPrimitiveCharacterArray(values));757 return myself;758 }759 /**760 * Use unicode character representation instead of standard representation in error messages.761 * <p>762 * With standard error message:763 * <pre><code class='java'> assertThat("a6c".toCharArray()).isEqualTo("abó".toCharArray());764 *765 * org.junit.ComparisonFailure:766 * Expected :['a', 'b', 'ó']767 * Actual :[a, 6, c]</code></pre>768 *769 * With unicode based error message:770 * <pre><code class='java'> assertThat("a6c".toCharArray()).inUnicode().isEqualTo("abó".toCharArray());771 *772 * org.junit.ComparisonFailure:773 * Expected :[a, b, \u00f3]774 * Actual :[a, 6, c]</code></pre>775 *776 * @return {@code this} assertion object.777 */778 @CheckReturnValue779 public SELF inUnicode() {780 info.useUnicodeRepresentation();781 return myself;782 }783 /**784 * Verifies that the actual array contains at least one of the given values.785 * <p>786 * Example :787 * <pre><code class='java'> char[] abc = { 'a', 'b', 'c' };788 *789 * // assertions will pass790 * assertThat(abc).containsAnyOf('b')791 * .containsAnyOf('b', 'c')792 * .containsAnyOf('a', 'b', 'c')793 * .containsAnyOf('a', 'b', 'c', 'd')794 * .containsAnyOf('e', 'f', 'g', 'b');795 *796 * // assertions will fail797 * assertThat(abc).containsAnyOf('d');798 * assertThat(abc).containsAnyOf('d', 'e', 'f', 'g');</code></pre>799 *800 * @param values the values whose at least one which is expected to be in the array under test.801 * @return {@code this} assertion object.802 * @throws NullPointerException if the array of values is {@code null}.803 * @throws IllegalArgumentException if the array of values is empty and the array under test is not empty.804 * @throws AssertionError if the array under test is {@code null}.805 * @throws AssertionError if the array under test does not contain any of the given {@code values}.806 * @since 2.9.0 / 3.9.0807 */808 public SELF containsAnyOf(char... values) {809 arrays.assertContainsAnyOf(info, actual, values);810 return myself;811 }812 /**813 * Verifies that the actual array contains at least one of the given values.814 * <p>815 * Example :816 * <pre><code class='java'> char[] abc = { 'a', 'b', 'c' };817 *818 * // assertions will pass819 * assertThat(abc).containsAnyOf(new Character[] { 'b' })820 * .containsAnyOf(new Character[] { 'b', 'c' })821 * .containsAnyOf(new Character[] { 'a', 'b', 'c' })822 * .containsAnyOf(new Character[] { 'a', 'b', 'c', 'd' })823 * .containsAnyOf(new Character[] { 'e', 'f', 'g', 'b' });824 *825 * // assertions will fail826 * assertThat(abc).containsAnyOf(new Character[] { 'd' });827 * assertThat(abc).containsAnyOf(new Character[] { 'd', 'e', 'f', 'g' });</code></pre>828 *829 * @param values the array of values whose at least one which is expected to be in the array under test.830 * @return {@code this} assertion object.831 * @throws NullPointerException if the array of values is {@code null}.832 * @throws IllegalArgumentException if the array of values is empty and the array under test is not empty.833 * @throws AssertionError if the array under test is {@code null}.834 * @throws AssertionError if the array under test does not contain any of the given {@code values}.835 * @since 3.19.0836 */837 public SELF containsAnyOf(Character[] values) {838 requireNonNullParameter(values, "values");839 arrays.assertContainsAnyOf(info, actual, toPrimitiveCharacterArray(values));840 return myself;841 }842 private static char[] toPrimitiveCharacterArray(Character[] values) {843 char[] characters = new char[values.length];844 range(0, values.length).forEach(i -> characters[i] = values[i]);845 return characters;846 }847}...

Full Screen

Full Screen

toPrimitiveCharacterArray

Using AI Code Generation

copy

Full Screen

1assertThat( new char[]{'a', 'b', 'c'}).toPrimitiveCharacterArray();2assertThat( new ArrayList<>()).toPrimitiveCharacterArray();3assertThat( new Character[]{'a', 'b', 'c'}).toPrimitiveCharacterArray();4assertThat( "abc").toPrimitiveCharacterArray();5assertThat( "abc").toPrimitiveCharacterArray();6assertThat( new HashMap<>()).toPrimitiveCharacterArray();7assertThat( new Object()).toPrimitiveCharacterArray();8assertThat( new Object()).toPrimitiveCharacterArray();9assertThat( "abc").toPrimitiveCharacterArray();10assertThat( new boolean[]{true, false, true}).toPrimitiveCharacterArray();11assertThat( new byte[]{1, 2, 3}).toPrimitiveCharacterArray();12assertThat( new short[]{

Full Screen

Full Screen

toPrimitiveCharacterArray

Using AI Code Generation

copy

Full Screen

1public void testPrimitiveCharacterArray() {2 char[] actual = new char[]{'a', 'b', 'c', 'd', 'e'};3 char[] expected = new char[]{'a', 'b', 'c'};4 Assertions.assertThat(actual).containsOnly(expected);5}6public void testPrimitiveCharacterArray() {7 char[] actual = new char[]{'a', 'b', 'c', 'd', 'e'};8 char[] expected = new char[]{'a', 'b', 'c'};9 Assertions.assertThat(actual).containsOnly(expected);10}11public void testPrimitiveCharacterArray() {12 char[] actual = new char[]{'a', 'b', 'c', 'd', 'e'};13 char[] expected = new char[]{'a', 'b', 'c'};14 Assertions.assertThat(actual).containsOnly(expected);15}16public void testPrimitiveCharacterArray() {17 char[] actual = new char[]{'a', 'b', 'c', 'd', 'e'};18 char[] expected = new char[]{'a', 'b', 'c'};19 Assertions.assertThat(actual).containsOnly(expected);20}21public void testPrimitiveCharacterArray() {22 char[] actual = new char[]{'a', 'b', 'c', 'd', 'e'};23 char[] expected = new char[]{'a', 'b', 'c'};24 Assertions.assertThat(actual).containsOnly(expected);25}26public void testPrimitiveCharacterArray() {

Full Screen

Full Screen

toPrimitiveCharacterArray

Using AI Code Generation

copy

Full Screen

1public void shouldPassIfGivenIsPrimitiveCharArray() {2 char[] primitiveCharArray = new char[] {'a', 'b', 'c'};3 assertThat(primitiveCharArray).isPrimitiveCharArray();4}5public void shouldPassIfGivenIsNotPrimitiveCharArray() {6 Character[] notPrimitiveCharArray = new Character[] {'a', 'b', 'c'};7 assertThat(notPrimitiveCharArray).isNotPrimitiveCharArray();8}9public void shouldPassIfGivenIsPrimitiveCharArray() {10 char[] primitiveCharArray = new char[] {'a', 'b', 'c'};11 assertThat(primitiveCharArray).isPrimitiveCharArray();12}13public void shouldPassIfGivenIsNotPrimitiveCharArray() {14 Character[] notPrimitiveCharArray = new Character[] {'a', 'b', 'c'};15 assertThat(notPrimitiveCharArray).isNotPrimitiveCharArray();16}17public void shouldPassIfGivenIsPrimitiveCharArray() {18 char[] primitiveCharArray = new char[] {'a', 'b', 'c'};19 assertThat(primitiveCharArray).isPrimitiveCharArray();20}21public void shouldPassIfGivenIsNotPrimitiveCharArray() {22 Character[] notPrimitiveCharArray = new Character[] {'a', 'b', 'c'};23 assertThat(notPrimitiveCharArray).isNotPrimitiveCharArray();24}25public void shouldPassIfGivenIsPrimitiveCharArray() {26 char[] primitiveCharArray = new char[] {'a', 'b', '

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