Best Assertj code snippet using org.assertj.core.internal.IntArrays.assertContainsExactlyInAnyOrder
Source:IntArrays_assertContainsExactlyInAnyOrder_Test.java
...24import org.assertj.core.util.Lists;25import org.junit.jupiter.api.Test;26import org.mockito.Mockito;27/**28 * Tests for <code>{@link IntArrays#assertContainsExactlyInAnyOrder(AssertionInfo, int[], int[])}</code>.29 */30public class IntArrays_assertContainsExactlyInAnyOrder_Test extends IntArraysBaseTest {31 @Test32 public void should_pass_if_actual_contains_given_values_exactly_in_any_order() {33 arrays.assertContainsExactlyInAnyOrder(TestData.someInfo(), actual, IntArrays.arrayOf(6, 8, 10));34 }35 @Test36 public void should_pass_if_actual_contains_given_values_exactly_in_any_order_with_duplicates() {37 actual = IntArrays.arrayOf(6, 8, 8, 10);38 arrays.assertContainsExactlyInAnyOrder(TestData.someInfo(), actual, IntArrays.arrayOf(6, 8, 8, 10));39 }40 @Test41 public void should_pass_if_actual_and_given_values_are_empty() {42 arrays.assertContainsExactlyInAnyOrder(TestData.someInfo(), IntArrays.emptyArray(), IntArrays.emptyArray());43 }44 @Test45 public void should_pass_if_actual_contains_given_values_exactly_but_in_different_order() {46 AssertionInfo info = TestData.someInfo();47 arrays.assertContainsExactlyInAnyOrder(info, actual, IntArrays.arrayOf(6, 10, 8));48 }49 @Test50 public void should_fail_if_arrays_have_different_sizes() {51 Assertions.assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8)));52 }53 @Test54 public void should_fail_if_expected_is_empty_and_actual_is_not() {55 Assertions.assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, emptyArray()));56 }57 @Test58 public void should_throw_error_if_expected_is_null() {59 Assertions.assertThatNullPointerException().isThrownBy(() -> arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, null)).withMessage(ErrorMessages.valuesToLookForIsNull());60 }61 @Test62 public void should_fail_if_actual_is_null() {63 Assertions.assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> arrays.assertContainsExactlyInAnyOrder(someInfo(), null, arrayOf(8))).withMessage(FailureMessages.actualIsNull());64 }65 @Test66 public void should_fail_if_actual_does_not_contain_given_values_exactly() {67 AssertionInfo info = TestData.someInfo();68 int[] expected = new int[]{ 6, 8, 20 };69 try {70 arrays.assertContainsExactlyInAnyOrder(info, actual, expected);71 } catch (AssertionError e) {72 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, expected, Lists.newArrayList(20), Lists.newArrayList(10), StandardComparisonStrategy.instance()));73 return;74 }75 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();76 }77 @Test78 public void should_fail_if_actual_contains_all_given_values_but_size_differ() {79 AssertionInfo info = TestData.someInfo();80 int[] expected = new int[]{ 6, 8 };81 try {82 arrays.assertContainsExactlyInAnyOrder(info, actual, expected);83 } catch (AssertionError e) {84 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, expected, Lists.emptyList(), Lists.newArrayList(10), StandardComparisonStrategy.instance()));85 return;86 }87 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();88 }89 @Test90 public void should_fail_if_actual_contains_duplicates_and_expected_does_not() {91 AssertionInfo info = TestData.someInfo();92 actual = IntArrays.arrayOf(1, 2, 3);93 int[] expected = new int[]{ 1, 2 };94 try {95 arrays.assertContainsExactlyInAnyOrder(info, actual, expected);96 } catch (AssertionError e) {97 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, expected, Lists.emptyList(), Lists.newArrayList(3), StandardComparisonStrategy.instance()));98 return;99 }100 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();101 }102 @Test103 public void should_fail_if_expected_contains_duplicates_and_actual_does_not() {104 AssertionInfo info = TestData.someInfo();105 actual = IntArrays.arrayOf(1, 2);106 int[] expected = new int[]{ 1, 2, 3 };107 try {108 arrays.assertContainsExactlyInAnyOrder(info, actual, expected);109 } catch (AssertionError e) {110 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, expected, Lists.newArrayList(3), Lists.emptyList(), StandardComparisonStrategy.instance()));111 return;112 }113 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();114 }115 // ------------------------------------------------------------------------------------------------------------------116 // tests using a custom comparison strategy117 // ------------------------------------------------------------------------------------------------------------------118 @Test119 public void should_pass_if_actual_contains_given_values_exactly_according_to_custom_comparison_strategy() {120 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(TestData.someInfo(), actual, IntArrays.arrayOf(6, (-8), 10));121 }122 @Test123 public void should_pass_if_actual_contains_given_values_exactly_in_different_order_according_to_custom_comparison_strategy() {124 int[] expected = new int[]{ -6, 10, 8 };125 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(TestData.someInfo(), actual, expected);126 }127 @Test128 public void should_fail_if_expected_is_empty_and_actual_is_not_whatever_custom_comparison_strategy_is() {129 Assertions.assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(someInfo(), actual, emptyArray()));130 }131 @Test132 public void should_throw_error_if_expected_is_null_whatever_custom_comparison_strategy_is() {133 Assertions.assertThatNullPointerException().isThrownBy(() -> arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(someInfo(), actual, null)).withMessage(ErrorMessages.valuesToLookForIsNull());134 }135 @Test136 public void should_fail_if_actual_is_null_whatever_custom_comparison_strategy_is() {137 Assertions.assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(someInfo(), null, arrayOf((-8)))).withMessage(FailureMessages.actualIsNull());138 }139 @Test140 public void should_fail_if_actual_does_not_contain_given_values_exactly_according_to_custom_comparison_strategy() {141 AssertionInfo info = TestData.someInfo();142 int[] expected = new int[]{ 6, -8, 20 };143 try {144 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(info, actual, expected);145 } catch (AssertionError e) {146 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, expected, Lists.newArrayList(20), Lists.newArrayList(10), absValueComparisonStrategy));147 return;148 }149 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();150 }151 @Test152 public void should_fail_if_actual_contains_all_given_values_but_size_differ_according_to_custom_comparison_strategy() {153 AssertionInfo info = TestData.someInfo();154 int[] expected = new int[]{ 6, 8 };155 try {156 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(info, actual, expected);157 } catch (AssertionError e) {158 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, expected, Lists.emptyList(), Lists.newArrayList(10), absValueComparisonStrategy));159 return;160 }161 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();162 }163 @Test164 public void should_fail_if_actual_contains_duplicates_and_expected_does_not_according_to_custom_comparison_strategy() {165 AssertionInfo info = TestData.someInfo();166 actual = IntArrays.arrayOf(1, 2, 3);167 int[] expected = new int[]{ 1, 2 };168 try {169 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(info, actual, expected);170 } catch (AssertionError e) {171 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, expected, Lists.emptyList(), Lists.newArrayList(3), absValueComparisonStrategy));172 return;173 }174 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();175 }176 @Test177 public void should_fail_if_expected_contains_duplicates_and_actual_does_not_according_to_custom_comparison_strategy() {178 AssertionInfo info = TestData.someInfo();179 actual = IntArrays.arrayOf(1, 2);180 int[] expected = new int[]{ 1, 2, 3 };181 try {182 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(info, actual, expected);183 } catch (AssertionError e) {184 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, expected, Lists.newArrayList(3), Lists.emptyList(), absValueComparisonStrategy));185 return;186 }187 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();188 }189}...
Source:ByteArrays_assertContainsExactlyInAnyOrder_with_Integer_Arguments_Test.java
...25import org.assertj.core.util.Lists;26import org.junit.jupiter.api.Test;27import org.mockito.Mockito;28/**29 * Tests for <code>{@link ByteArrays#assertContainsExactlyInAnyOrder(AssertionInfo, byte[], int[])}</code>.30 */31public class ByteArrays_assertContainsExactlyInAnyOrder_with_Integer_Arguments_Test extends ByteArraysBaseTest {32 @Test33 public void should_pass_if_actual_contains_given_values_exactly_in_any_order() {34 arrays.assertContainsExactlyInAnyOrder(TestData.someInfo(), actual, IntArrays.arrayOf(6, 8, 10));35 }36 @Test37 public void should_pass_if_actual_and_given_values_are_empty() {38 arrays.assertContainsExactlyInAnyOrder(TestData.someInfo(), ByteArrays.emptyArray(), IntArrays.emptyArray());39 }40 @Test41 public void should_pass_if_actual_contains_given_values_exactly_but_in_different_order() {42 AssertionInfo info = TestData.someInfo();43 arrays.assertContainsExactlyInAnyOrder(info, actual, IntArrays.arrayOf(6, 10, 8));44 }45 @Test46 public void should_fail_if_arrays_have_different_sizes() {47 Assertions.assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, IntArrays.arrayOf(6, 8)));48 }49 @Test50 public void should_fail_if_expected_is_empty_and_actual_is_not() {51 Assertions.assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, IntArrays.emptyArray()));52 }53 @Test54 public void should_throw_error_expected_is_null() {55 Assertions.assertThatNullPointerException().isThrownBy(() -> arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, ((int[]) (null)))).withMessage(ErrorMessages.valuesToLookForIsNull());56 }57 @Test58 public void should_fail_if_actual_is_null() {59 Assertions.assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> arrays.assertContainsExactlyInAnyOrder(someInfo(), null, IntArrays.arrayOf(8))).withMessage(FailureMessages.actualIsNull());60 }61 @Test62 public void should_fail_if_actual_does_not_contain_given_values_exactly() {63 AssertionInfo info = TestData.someInfo();64 try {65 arrays.assertContainsExactlyInAnyOrder(info, actual, IntArrays.arrayOf(6, 8, 20));66 } catch (AssertionError e) {67 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, ByteArrays.arrayOf(6, 8, 20), Lists.newArrayList(((byte) (20))), Lists.newArrayList(((byte) (10))), StandardComparisonStrategy.instance()));68 return;69 }70 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();71 }72 @Test73 public void should_fail_if_actual_contains_all_given_values_but_size_differ() {74 AssertionInfo info = TestData.someInfo();75 try {76 arrays.assertContainsExactlyInAnyOrder(info, actual, IntArrays.arrayOf(6, 8));77 } catch (AssertionError e) {78 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, ByteArrays.arrayOf(6, 8), Lists.emptyList(), Lists.newArrayList(((byte) (10))), StandardComparisonStrategy.instance()));79 return;80 }81 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();82 }83 @Test84 public void should_fail_if_actual_contains_duplicates_and_expected_does_not() {85 AssertionInfo info = TestData.someInfo();86 actual = ByteArrays.arrayOf(6, 8, 8);87 try {88 arrays.assertContainsExactlyInAnyOrder(info, actual, IntArrays.arrayOf(6, 8));89 } catch (AssertionError e) {90 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, ByteArrays.arrayOf(6, 8), Lists.emptyList(), Lists.newArrayList(((byte) (8))), StandardComparisonStrategy.instance()));91 return;92 }93 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();94 }95 @Test96 public void should_fail_if_expected_contains_duplicates_and_actual_does_not() {97 AssertionInfo info = TestData.someInfo();98 actual = ByteArrays.arrayOf(6, 8);99 try {100 arrays.assertContainsExactlyInAnyOrder(info, actual, IntArrays.arrayOf(6, 8, 8));101 } catch (AssertionError e) {102 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, ByteArrays.arrayOf(6, 8, 8), Lists.newArrayList(((byte) (8))), Lists.emptyList(), StandardComparisonStrategy.instance()));103 return;104 }105 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();106 }107 // ------------------------------------------------------------------------------------------------------------------108 // tests using a custom comparison strategy109 // ------------------------------------------------------------------------------------------------------------------110 @Test111 public void should_pass_if_actual_contains_given_values_exactly_in_any_order_according_to_custom_comparison_strategy() {112 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(TestData.someInfo(), actual, IntArrays.arrayOf(6, (-8), 10));113 }114 @Test115 public void should_pass_if_actual_contains_given_values_exactly_in_different_order_according_to_custom_comparison_strategy() {116 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(TestData.someInfo(), actual, IntArrays.arrayOf((-6), 10, 8));117 }118 @Test119 public void should_fail_if_expected_is_empty_and_actual_is_not_whatever_custom_comparison_strategy_is() {120 Assertions.assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(someInfo(), actual, IntArrays.emptyArray()));121 }122 @Test123 public void should_throw_error_if_expected_is_null_whatever_custom_comparison_strategy_is() {124 Assertions.assertThatNullPointerException().isThrownBy(() -> arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(someInfo(), actual, ((int[]) (null)))).withMessage(ErrorMessages.valuesToLookForIsNull());125 }126 @Test127 public void should_fail_if_actual_is_null_whatever_custom_comparison_strategy_is() {128 Assertions.assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(someInfo(), null, IntArrays.arrayOf((-8)))).withMessage(FailureMessages.actualIsNull());129 }130 @Test131 public void should_fail_if_actual_does_not_contain_given_values_exactly_in_any_order_according_to_custom_comparison_strategy() {132 AssertionInfo info = TestData.someInfo();133 byte[] expected = new byte[]{ 6, -8, 20 };134 try {135 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(info, actual, IntArrays.arrayOf(6, (-8), 20));136 } catch (AssertionError e) {137 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, expected, Lists.newArrayList(((byte) (20))), Lists.newArrayList(((byte) (10))), absValueComparisonStrategy));138 return;139 }140 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();141 }142 @Test143 public void should_fail_if_actual_contains_all_given_values_but_size_differ_according_to_custom_comparison_strategy() {144 AssertionInfo info = TestData.someInfo();145 try {146 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(info, actual, IntArrays.arrayOf(6, 8));147 } catch (AssertionError e) {148 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, ByteArrays.arrayOf(6, 8), Lists.emptyList(), Lists.newArrayList(((byte) (10))), absValueComparisonStrategy));149 return;150 }151 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();152 }153 @Test154 public void should_fail_if_actual_contains_duplicates_and_expected_does_not_according_to_custom_comparison_strategy() {155 AssertionInfo info = TestData.someInfo();156 actual = ByteArrays.arrayOf(6, 8, 8);157 try {158 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(info, actual, IntArrays.arrayOf(6, 8));159 } catch (AssertionError e) {160 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, ByteArrays.arrayOf(6, 8), Lists.emptyList(), Lists.newArrayList(((byte) (8))), absValueComparisonStrategy));161 return;162 }163 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();164 }165 @Test166 public void should_fail_if_expected_contains_duplicates_and_actual_does_not_according_to_custom_comparison_strategy() {167 AssertionInfo info = TestData.someInfo();168 actual = ByteArrays.arrayOf(6, 8);169 try {170 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(info, actual, IntArrays.arrayOf(6, 8, 8));171 } catch (AssertionError e) {172 Mockito.verify(failures).failure(info, ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder(actual, ByteArrays.arrayOf(6, 8, 8), Lists.newArrayList(((byte) (8))), Lists.emptyList(), absValueComparisonStrategy));173 return;174 }175 TestFailures.failBecauseExpectedAssertionErrorWasNotThrown();176 }177}...
assertContainsExactlyInAnyOrder
Using AI Code Generation
1package org.assertj.core.internal.intarrays;2import org.assertj.core.api.AssertionInfo;3import org.assertj.core.api.Assertions;4import org.assertj.core.internal.IntArrays;5import org.assertj.core.internal.IntArraysBaseTest;6import org.junit.jupiter.api.Test;7class IntArrays_assertContainsExactlyInAnyOrder_Test extends IntArraysBaseTest {8 void should_pass_if_actual_contains_exactly_given_values_in_any_order() {9 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8, 10));10 }11 void should_pass_if_actual_contains_given_values_exactly_in_different_order() {12 AssertionInfo info = someInfo();13 actual = arrayOf(6, 8, 10);14 arrays.assertContainsExactlyInAnyOrder(info, actual, arrayOf(10, 8, 6));15 }16 void should_fail_if_actual_contains_exactly_some_of_the_given_values_in_any_order() {17 AssertionInfo info = someInfo();18 actual = arrayOf(6, 8, 10);19 int[] expected = { 6, 8, 20 };20 Throwable error = Assertions.catchThrowable(() -> arrays.assertContainsExactlyInAnyOrder(info, actual, expected));21 assertThat(error).isInstanceOf(AssertionError.class);22 verify(failures).failure(info, shouldContainExactlyInAnyOrder(actual, expected, newLinkedHashSet(20), newLinkedHashSet(10)));23 }24 void should_fail_if_actual_contains_exactly_some_of_the_given_values_in_any_order_according_to_custom_comparison_strategy() {25 AssertionInfo info = someInfo();26 actual = arrayOf(6, -8, 10);27 int[] expected = { 6, -8, 20 };28 Throwable error = Assertions.catchThrowable(() -> arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(info, actual, expected));29 assertThat(error).isInstanceOf(AssertionError.class);30 verify(failures).failure(info, shouldContainExactlyInAnyOrder(actual, expected, newLinkedHashSet(20), newLinkedHashSet(10), absValueComparisonStrategy));31 }32 void should_fail_if_actual_contains_exactly_one_of_the_given_values_in_any_order() {33 AssertionInfo info = someInfo();34 actual = arrayOf(6, 8, 10);35 int[] expected = { 6,
assertContainsExactlyInAnyOrder
Using AI Code Generation
1import static org.assertj.core.api.Assertions.assertThat;2import static org.assertj.core.api.Assertions.assertThatExceptionOfType;3import static org.assertj.core.error.ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder;4import static org.assertj.core.internal.ErrorMessages.*;5import static org.assertj.core.test.IntArrays.*;6import static org.assertj.core.test.TestData.someInfo;7import static org.assertj.core.util.FailureMessages.actualIsNull;8import static org.assertj.core.util.Lists.list;9import static org.mockito.Mockito.verify;10import org.assertj.core.api.AssertionInfo;11import org.assertj.core.internal.IntArrays;12import org.assertj.core.internal.IntArraysBaseTest;13import org.junit.jupiter.api.Test;14class IntArrays_assertContainsExactlyInAnyOrder_Test extends IntArraysBaseTest {15 void should_pass_if_actual_contains_given_values_exactly_in_any_order() {16 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8, 10));17 }18 void should_pass_if_actual_contains_given_values_exactly_in_any_order_with_duplicates() {19 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8, 10, 10, 8, 6));20 }21 void should_pass_if_actual_contains_given_values_exactly_in_any_order_with_null() {22 actual = arrayOf(6, 8, 10, null);23 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8, 10, null));24 }25 void should_pass_if_actual_contains_given_values_exactly_in_any_order_with_null_and_duplicates() {26 actual = arrayOf(6, 8, 10, null, 8, 6);27 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8, 10, null, 8, 6));28 }29 void should_fail_if_actual_contains_given_values_exactly_but_not_in_same_order() {30 AssertionInfo info = someInfo();31 int[] expected = { 6, 8, 20 };32 Throwable error = catchThrowable(() -> arrays.assertContainsExactlyInAnyOrder(info, actual, expected));33 assertThat(error).isInstanceOf(AssertionError.class);34 verify(failures).failure(info, shouldContainExactlyInAnyOrder(actual, expected, list(20), list(10
assertContainsExactlyInAnyOrder
Using AI Code Generation
1package org.assertj.core.internal;2import static org.assertj.core.api.Assertions.assertThat;3import static org.assertj.core.api.Assertions.assertThatExceptionOfType;4import static org.assertj.core.api.Assertions.catchThrowable;5import static org.assertj.core.error.ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder;6import static org.assertj.core.test.IntArrays.arrayOf;7import static org.assertj.core.test.TestData.someInfo;8import static org.assertj.core.util.Arrays.array;9import static org.assertj.core.util.AssertionsUtil.expectAssertionError;10import static org.assertj.core.util.FailureMessages.actualIsNull;11import org.assertj.core.api.AssertionInfo;12import org.assertj.core.data.Index;13import org.assertj.core.test.IntArraysBaseTest;14import org.junit.jupiter.api.Test;15class IntArrays_assertContainsExactlyInAnyOrder_Test extends IntArraysBaseTest {16 void should_pass_if_actual_contains_given_values_exactly_in_any_order() {17 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8, 10));18 }19 void should_pass_if_actual_contains_given_values_exactly_in_any_order_with_duplicates() {20 actual = arrayOf(6, 8, 10, 8, 8, 8);21 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8, 10, 8));22 }23 void should_pass_if_actual_contains_given_values_exactly_in_different_order() {24 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(8, 10, 6));25 }26 void should_pass_if_actual_contains_given_values_exactly_in_different_order_with_duplicates() {27 actual = arrayOf(6, 8, 10, 8, 8, 8);28 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(8, 8, 10, 6));29 }30 void should_pass_if_actual_and_given_values_are_empty() {31 actual = arrayOf();32 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf());33 }34 void should_fail_if_arrays_have_different_sizes() {35 AssertionInfo info = someInfo();36 int[] expected = { 6, 8, 10, 8, 8 };37 Throwable error = catchThrowable(() -> arrays.assertContainsExactlyInAnyOrder(info, actual
assertContainsExactlyInAnyOrder
Using AI Code Generation
1import static org.assertj.core.api.Assertions.assertThat;2import static org.assertj.core.internal.ErrorMessages.*;3import static org.assertj.core.internal.IntArrays.*;4import static org.assertj.core.test.IntArrays.*;5import static org.assertj.core.test.TestData.someInfo;6import org.assertj.core.api.AssertionInfo;7import org.assertj.core.internal.IntArrays;8import org.assertj.core.internal.IntArraysBaseTest;9import org.junit.Test;10public class IntArrays_assertContainsExactlyInAnyOrder_Test extends IntArraysBaseTest {11 public void should_pass_if_actual_contains_given_values_exactly_in_any_order() {12 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8, 10));13 }14 public void should_pass_if_actual_contains_given_values_exactly_in_any_order_according_to_custom_comparison_strategy() {15 actual = arrayOf(6, -8, 10);16 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, -8, 10));17 }18 public void should_pass_if_actual_contains_given_values_exactly_in_different_order() {19 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(10, 8, 6));20 }21 public void should_pass_if_actual_contains_given_values_exactly_in_different_order_according_to_custom_comparison_strategy() {22 actual = arrayOf(6, -8, 10);23 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(-8, 10, 6));24 }25 public void should_pass_if_actual_and_given_values_are_empty() {26 actual = emptyArray();27 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, emptyArray());28 }29 public void should_pass_if_actual_and_given_values_are_empty_according_to_custom_comparison_strategy() {30 actual = emptyArray();31 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(someInfo(), actual, emptyArray());32 }33 public void should_throw_error_if_array_of_values_to_look_for_is_empty_and_actual_is_not() {34 thrown.expectIllegalArgumentException(valuesToLookForIsEmpty());35 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, emptyArray());36 }
assertContainsExactlyInAnyOrder
Using AI Code Generation
1import org.junit.Test;2import static org.assertj.core.api.Assertions.assertThat;3import static org.assertj.core.api.Assertions.assertThatExceptionOfType;4import static org.assertj.core.api.Assertions.assertThatNullPointerException;5import static org.assertj.core.api.Assertions.catchThrowable;6import static org.assertj.core.error.ShouldContainExactlyInAnyOrder.shouldContainExactlyInAnyOrder;7import static org.assertj.core.test.IntArrays.arrayOf;8import static org.assertj.core.test.TestData.someInfo;9import org.assertj.core.internal.IntArrays;10import org.assertj.core.internal.IntArraysBaseTest;11public class IntArrays_assertContainsExactlyInAnyOrder_Test extends IntArraysBaseTest {12 public void should_pass_if_actual_contains_exactly_given_values_in_any_order() {13 arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8, 10));14 }15 public void should_pass_if_actual_contains_exactly_given_values_in_any_order_according_to_custom_comparison_strategy() {16 arraysWithCustomComparisonStrategy.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(-6, -8, -10));17 }18 public void should_fail_if_actual_contains_given_values_but_in_different_order() {19 Throwable error = catchThrowable(() -> arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 10, 8)));20 assertThat(error).isInstanceOf(AssertionError.class);21 IntArrays arrays = getArrays(assertions);22 verify(failures).failure(info, shouldContainExactlyInAnyOrder(actual, arrayOf(6, 10, 8), arrayOf(8), arrayOf(10), comparisonStrategy));23 }24 public void should_fail_if_actual_contains_duplicates_and_expected_does_not() {25 Throwable error = catchThrowable(() -> arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8, 8, 10)));26 assertThat(error).isInstanceOf(AssertionError.class);27 IntArrays arrays = getArrays(assertions);28 verify(failures).failure(info, shouldContainExactlyInAnyOrder(actual, arrayOf(6, 8, 8, 10), arrayOf(8), arrayOf(), comparisonStrategy));29 }30 public void should_fail_if_expected_contains_duplicates_and_actual_does_not() {31 Throwable error = catchThrowable(() -> arrays.assertContainsExactlyInAnyOrder(someInfo(), actual, arrayOf(6, 8,
assertContainsExactlyInAnyOrder
Using AI Code Generation
1public class AssertContainsExactlyInAnyOrder {2 public static void main(String[] args) {3 IntArrays intArrays = IntArrays.instance();4 int[] actual = {1, 2, 3, 4, 5, 6};5 int[] expected = {6, 5, 4, 3, 2, 1};6 intArrays.assertContainsExactlyInAnyOrder(info(), actual, expected);7 }8 private static AssertInfo info() {9 return new AssertInfo();10 }11}12to contain exactly (and in same order):13at org.assertj.core.internal.IntArrays.assertContainsExactlyInAnyOrder(IntArrays.java:97)14at AssertContainsExactlyInAnyOrder.main(AssertContainsExactlyInAnyOrder.java:12)
assertContainsExactlyInAnyOrder
Using AI Code Generation
1import org.assertj.core.internal.IntArrays;2import org.junit.Test;3public class IntArraysTest {4 public void testAssertContainsExactlyInAnyOrder() {5 IntArrays intArrays = new IntArrays();6 int[] actual = {1, 2, 3, 4, 5, 6};7 int[] expected = {1, 2, 3, 4, 5, 6};8 intArrays.assertContainsExactlyInAnyOrder(info(), actual, expected);9 }10}11import org.assertj.core.internal.LongArrays;12import org.junit.Test;13public class LongArraysTest {14 public void testAssertContainsExactlyInAnyOrder() {15 LongArrays longArrays = new LongArrays();16 long[] actual = {1L, 2L, 3L, 4L, 5L, 6L};17 long[] expected = {1L, 2L, 3L, 4L, 5L, 6L};18 longArrays.assertContainsExactlyInAnyOrder(info(), actual, expected);19 }20}21import org.assertj.core.internal.ShortArrays;22import org.junit.Test;23public class ShortArraysTest {24 public void testAssertContainsExactlyInAnyOrder() {25 ShortArrays shortArrays = new ShortArrays();26 short[] actual = {1, 2, 3, 4, 5, 6};27 short[] expected = {1, 2, 3, 4, 5, 6};28 shortArrays.assertContainsExactlyInAnyOrder(info(), actual, expected);29 }30}31import org.assertj.core.internal.BooleanArrays;32import org.junit.Test;33public class BooleanArraysTest {34 public void testAssertContainsExactlyInAnyOrder() {35 BooleanArrays booleanArrays = new BooleanArrays();36 boolean[] actual = {true, false, true, false, true, false};37 boolean[] expected = {true, false, true, false, true
assertContainsExactlyInAnyOrder
Using AI Code Generation
1import static org.assertj.core.api.Assertions.assertThat;2import static org.assertj.core.api.Assertions.assertThatThrownBy;3import static org.assertj.core.api.Assertions.catchThrowable;4import static org.assertj.core.api.Assertions.within;5import static org.assertj.core.util.Arrays.array;6import static org.assertj.core.util.FailureMessages.actualIsNull;7import static org.assertj.core.util.FailureMessages.actualIsEmpty;8import static org.assertj.core.util.FailureMessages.actualIsNotEqualTo;9import static org.assertj.core.util.FailureMessages.actualIsNotInArray;10import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithComparisonStrategy;11import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithTolerance;12import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithToleranceAndComparisonStrategy;13import static org.assertj.core.util.FailureMessages.actualIsNullWithComparisonStrategy;14import static org.assertj.core.util.FailureMessages.actualIsNullWithTolerance;15import static org.assertj.core.util.FailureMessages.actualIsNullWithToleranceAndComparisonStrategy;16import static org.assertj.core.util.FailureMessages.actualIsEmptyWithComparisonStrategy;17import static org.assertj.core.util.FailureMessages.actualIsEmptyWithTolerance;18import static org.assertj.core.util.FailureMessages.actualIsEmptyWithToleranceAndComparisonStrategy;19import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithComparisonStrategy;20import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithTolerance;21import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithToleranceAndComparisonStrategy;22import static org.assertj.core.util.FailureMessages.actualIsNull;23import static org.assertj.core.util.FailureMessages.actualIsEmpty;24import static org.assertj.core.util.FailureMessages.actualIsNotEqualTo;25import static org.assertj.core.util.FailureMessages.actualIsNotInArray;26import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithComparisonStrategy;27import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithTolerance;28import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithToleranceAndComparisonStrategy;29import static org.assertj.core.util.FailureMessages.actualIsNullWithComparisonStrategy;30import static org.assertj.core.util.FailureMessages.actualIsNullWithTolerance;31import static org.assertj.core.util.FailureMessages.actualIsNullWithToleranceAndComparisonStrategy;32import static org.assertj.core.util.FailureMessages.actualIsEmptyWithComparisonStrategy;33import static org.assertj.core.util.FailureMessages.actualIsEmptyWithTolerance;34import static org.assertj.core.util.FailureMessages.actualIsEmptyWithToleranceAndComparisonStrategy;35import static org.assertj.core.util.FailureMessages.actual
assertContainsExactlyInAnyOrder
Using AI Code Generation
1import static org.assertj.core.api.Assertions.*;2import org.assertj.core.internal.IntArrays;3import org.junit.Test;4public class AssertContainsExactlyInAnyOrder_Test {5 public void test() {6 IntArrays arrays = new IntArrays();7 int[] actual = {1, 2, 3};8 arrays.assertContainsExactlyInAnyOrder(info(), actual, 2, 1, 3);9 }10}11to contain exactly (and in same order):12at org.assertj.core.internal.IntArrays.assertContainsExactlyInAnyOrder(IntArrays.java:125)13at AssertContainsExactlyInAnyOrder_Test.test(AssertContainsExactlyInAnyOrder_Test.java:12)
assertContainsExactlyInAnyOrder
Using AI Code Generation
1public class AssertionExample {2 public void testAssertContainsExactlyInAnyOrder() {3 int[] actual = {5, 8, 9, 2};4 int[] expected = {5, 8, 2, 9};5 IntArrays arrays = IntArrays.instance();6 arrays.assertContainsExactlyInAnyOrder(info(), actual, expected);7 }8}9import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithToleranceAndComparisonStrategy;10import static org.assertj.core.util.FailureMessages.actualIsNull;11import static org.assertj.core.util.FailureMessages.actualIsEmpty;12import static org.assertj.core.util.FailureMessages.actualIsNotEqualTo;13import static org.assertj.core.util.FailureMessages.actualIsNotInArray;14import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithComparisonStrategy;15import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithTolerance;16import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithToleranceAndComparisonStrategy;17import static org.assertj.core.util.FailureMessages.actualIsNullWithComparisonStrategy;18import static org.assertj.core.util.FailureMessages.actualIsNullWithTolerance;19import static org.assertj.core.util.FailureMessages.actualIsNullWithToleranceAndComparisonStrategy;20import static org.assertj.core.util.FailureMessages.actualIsEmptyWithComparisonStrategy;21import static org.assertj.core.util.FailureMessages.actualIsEmptyWithTolerance;22import static org.assertj.core.util.FailureMessages.actualIsEmptyWithToleranceAndComparisonStrategy;23import static org.assertj.core.util.FailureMessages.actual
assertContainsExactlyInAnyOrder
Using AI Code Generation
1import static org.assertj.core.api.Assertions.*;2import org.assertj.core.internal.IntArrays;3import org.junit.Test;4public class AssertContainsExactlyInAnyOrder_Test {5 public void test() {6 IntArrays arrays = new IntArrays();7 int[] actual = {1, 2, 3};8 arrays.assertContainsExactlyInAnyOrder(info(), actual, 2, 1, 3);9 }10}11to contain exactly (and in same order):12at org.assertj.core.internal.IntArrays.assertContainsExactlyInAnyOrder(IntArrays.java:125)13at AssertContainsExactlyInAnyOrder_Test.test(AssertContainsExactlyInAnyOrder_Test.java:12)
assertContainsExactlyInAnyOrder
Using AI Code Generation
1public class AssertionExample {2 public void testAssertContainsExactlyInAnyOrder() {3 int[] actual = {5, 8, 9, 2};4 int[] expected = {5, 8, 2, 9};5 IntArrays arrays = IntArrays.instance();6 arrays.assertContainsExactlyInAnyOrder(info(), actual, expected);7 }8}
assertContainsExactlyInAnyOrder
Using AI Code Generation
1import static org.assertj.core.api.Assertions.assertThat;2import static org.assertj.core.api.Assertions.assertThatThrownBy;3import static org.assertj.core.api.Assertions.catchThrowable;4import static org.assertj.core.api.Assertions.within;5import static org.assertj.core.util.Arrays.array;6import static org.assertj.core.util.FailureMessages.actualIsNull;7import static org.assertj.core.util.FailureMessages.actualIsEmpty;8import static org.assertj.core.util.FailureMessages.actualIsNotEqualTo;9import static org.assertj.core.util.FailureMessages.actualIsNotInArray;10import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithComparisonStrategy;11import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithTolerance;12import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithToleranceAndComparisonStrategy;13import static org.assertj.core.util.FailureMessages.actualIsNullWithComparisonStrategy;14import static org.assertj.core.util.FailureMessages.actualIsNullWithTolerance;15import static org.assertj.core.util.FailureMessages.actualIsNullWithToleranceAndComparisonStrategy;16import static org.assertj.core.util.FailureMessages.actualIsEmptyWithComparisonStrategy;17import static org.assertj.core.util.FailureMessages.actualIsEmptyWithTolerance;18import static org.assertj.core.util.FailureMessages.actualIsEmptyWithToleranceAndComparisonStrategy;19import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithComparisonStrategy;20import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithTolerance;21import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithToleranceAndComparisonStrategy;22import static org.assertj.core.util.FailureMessages.actualIsNull;23import static org.assertj.core.util.FailureMessages.actualIsEmpty;24import static org.assertj.core.util.FailureMessages.actualIsNotEqualTo;25import static org.assertj.core.util.FailureMessages.actualIsNotInArray;26import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithComparisonStrategy;27import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithTolerance;28import static org.assertj.core.util.FailureMessages.actualIsNotInArrayWithToleranceAndComparisonStrategy;29import static org.assertj.core.util.FailureMessages.actualIsNullWithComparisonStrategy;30import static org.assertj.core.util.FailureMessages.actualIsNullWithTolerance;31import static org.assertj.core.util.FailureMessages.actualIsNullWithToleranceAndComparisonStrategy;32import static org.assertj.core.util.FailureMessages.actualIsEmptyWithComparisonStrategy;33import static org.assertj.core.util.FailureMessages.actualIsEmptyWithTolerance;34import static org.assertj.core.util.FailureMessages.actualIsEmptyWithToleranceAndComparisonStrategy;35import static org.assertj.core.util.FailureMessages.actual
assertContainsExactlyInAnyOrder
Using AI Code Generation
1import static org.assertj.core.api.Assertions.*;2import org.assertj.core.internal.IntArrays;3import org.junit.Test;4public class AssertContainsExactlyInAnyOrder_Test {5 public void test() {6 IntArrays arrays = new IntArrays();7 int[] actual = {1, 2, 3};8 arrays.assertContainsExactlyInAnyOrder(info(), actual, 2, 1, 3);9 }10}11to contain exactly (and in same order):12at org.assertj.core.internal.IntArrays.assertContainsExactlyInAnyOrder(IntArrays.java:125)13at AssertContainsExactlyInAnyOrder_Test.test(AssertContainsExactlyInAnyOrder_Test.java:12)
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!