Merge branch 'master' of https://github.com/AlexFlorinHriscu/tutorials
This commit is contained in:
commit
956445cf37
|
@ -78,10 +78,8 @@ public class ArraysDeepEqualsUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenTwoMultidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() {
|
void givenTwoMultidimensionalObjectTypeArrays_whenUsingEqualsAndDeepEquals_thenBothShouldReturnDifferently() {
|
||||||
Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) },
|
Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } };
|
||||||
{ new Person(3, "Steve", 27), new Person(4, "Gary", 28) } };
|
Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } };
|
||||||
Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) },
|
|
||||||
{ new Person(3, "Steve", 27), new Person(4, "Gary", 28) } };
|
|
||||||
|
|
||||||
assertFalse(Arrays.equals(personArray1, personArray2));
|
assertFalse(Arrays.equals(personArray1, personArray2));
|
||||||
assertTrue(Arrays.deepEquals(personArray1, personArray2));
|
assertTrue(Arrays.deepEquals(personArray1, personArray2));
|
||||||
|
@ -89,10 +87,8 @@ public class ArraysDeepEqualsUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenTwoMultidimensionalObjectTypeArrays_whenUsingDeepEqualsFromObjectsAndArraysClasses_thenBothShouldReturnTrue() {
|
void givenTwoMultidimensionalObjectTypeArrays_whenUsingDeepEqualsFromObjectsAndArraysClasses_thenBothShouldReturnTrue() {
|
||||||
Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) },
|
Person personArray1[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } };
|
||||||
{ new Person(3, "Steve", 27), new Person(4, "Gary", 28) } };
|
Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) }, { new Person(3, "Steve", 27), new Person(4, "Gary", 28) } };
|
||||||
Person personArray2[][] = { { new Person(1, "John", 22), new Person(2, "Mike", 23) },
|
|
||||||
{ new Person(3, "Steve", 27), new Person(4, "Gary", 28) } };
|
|
||||||
|
|
||||||
assertTrue(Objects.deepEquals(personArray1, personArray2));
|
assertTrue(Objects.deepEquals(personArray1, personArray2));
|
||||||
assertTrue(Arrays.deepEquals(personArray1, personArray2));
|
assertTrue(Arrays.deepEquals(personArray1, personArray2));
|
||||||
|
|
Loading…
Reference in New Issue