|
23 | 23 |
|
24 | 24 | import org.assertj.core.api.Object2DArrayAssert; |
25 | 25 | import org.assertj.core.error.ErrorMessageFactory; |
| 26 | +import org.assertj.core.test.Person; |
26 | 27 | import org.junit.jupiter.api.DisplayName; |
27 | 28 | import org.junit.jupiter.api.Test; |
28 | 29 |
|
@@ -53,14 +54,58 @@ void should_pass_if_both_actual_and_expected_are_same_arrays() { |
53 | 54 | } |
54 | 55 |
|
55 | 56 | @Test |
56 | | - void should_pass_if_both_actual_and_expected_are_equal() { |
| 57 | + void should_pass_if_both_actual_and_expected_have_same_references() { |
57 | 58 | // GIVEN |
58 | 59 | String[][] actual = new String[][] { { "1", "2" }, { "3" }, { "4", "5", "6" } }; |
59 | 60 | String[][] expected = new String[][] { { "1", "2" }, { "3" }, { "4", "5", "6" } }; |
60 | 61 | // WHEN/THEN |
61 | 62 | then(actual).isDeepEqualTo(expected); |
62 | 63 | } |
63 | 64 |
|
| 65 | + @Test |
| 66 | + void should_pass_if_both_actual_and_expected_are_equal() { |
| 67 | + // GIVEN |
| 68 | + Person[][] actual = new Person[][] { |
| 69 | + { new Person("Homer"), new Person("Marge") }, |
| 70 | + { new Person("Liza"), new Person("Bart"), new Person("Maggie") }, |
| 71 | + { null, null } |
| 72 | + }; |
| 73 | + Person[][] expected = new Person[][] { |
| 74 | + { new Person("Homer"), new Person("Marge") }, |
| 75 | + { new Person("Liza"), new Person("Bart"), new Person("Maggie") }, |
| 76 | + { null, null } |
| 77 | + }; |
| 78 | + // WHEN/THEN |
| 79 | + then(actual).isDeepEqualTo(expected); |
| 80 | + } |
| 81 | + |
| 82 | + @Test |
| 83 | + void should_pass_with_three_dimensional_equal_arrays() { |
| 84 | + // GIVEN |
| 85 | + Person[][][] actual = new Person[][][] { |
| 86 | + { |
| 87 | + { new Person("Homer"), new Person("Marge") }, |
| 88 | + { new Person("Liza"), new Person("Bart"), new Person("Maggie") }, |
| 89 | + { null, null } |
| 90 | + }, |
| 91 | + { |
| 92 | + { new Person("Apu"), new Person("Ned"), new Person("Milhouse") } |
| 93 | + }, |
| 94 | + }; |
| 95 | + Person[][][] expected = new Person[][][] { |
| 96 | + { |
| 97 | + { new Person("Homer"), new Person("Marge") }, |
| 98 | + { new Person("Liza"), new Person("Bart"), new Person("Maggie") }, |
| 99 | + { null, null } |
| 100 | + }, |
| 101 | + { |
| 102 | + { new Person("Apu"), new Person("Ned"), new Person("Milhouse") } |
| 103 | + }, |
| 104 | + }; |
| 105 | + // WHEN/THEN |
| 106 | + then(actual).isDeepEqualTo(expected); |
| 107 | + } |
| 108 | + |
64 | 109 | @Test |
65 | 110 | void should_fail_if_actual_is_null() { |
66 | 111 | // GIVEN |
|
0 commit comments