BAEL-2770 Fixed code formatting and improved test cases

This commit is contained in:
Sadanand S. Koli 2019-04-22 20:48:49 +05:30
parent 923019269c
commit 16553936c7
2 changed files with 17 additions and 14 deletions

View File

@ -3,7 +3,7 @@ package com.baeldung.array;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertArrayEquals;
public class AddElementToEndOfArrayUnitTest {
@ -21,7 +21,8 @@ public class AddElementToEndOfArrayUnitTest {
Integer[] destArray = addElementToEndOfArray.addElementUsingArraysCopyOf(sourceArray, elementToAdd);
assertEquals(elementToAdd, destArray[destArray.length-1].intValue());
Integer[] expectedArray = {1, 2, 3, 4, 5};
assertArrayEquals(expectedArray, destArray);
}
@Test
@ -31,7 +32,8 @@ public class AddElementToEndOfArrayUnitTest {
Integer[] destArray = addElementToEndOfArray.addElementUsingArrayList(sourceArray, elementToAdd);
assertEquals(elementToAdd, destArray[destArray.length-1].intValue());
Integer[] expectedArray = {1, 2, 3, 4, 5};
assertArrayEquals(expectedArray, destArray);
}
@Test
@ -41,6 +43,7 @@ public class AddElementToEndOfArrayUnitTest {
Integer[] destArray = addElementToEndOfArray.addElementUsingSystemArrayCopy(sourceArray, elementToAdd);
assertEquals(elementToAdd, destArray[destArray.length-1].intValue());
Integer[] expectedArray = {1, 2, 3, 4, 5};
assertArrayEquals(expectedArray, destArray);
}
}