Example for removing first element of array (BAEL-2029) (#4970)
* Example for removing first element of array (BAEL-2029) * Use AssertJ assertions * Move array test to collections module. * Remove redundant test
This commit is contained in:
committed by
KevinGilmore
parent
65cd3b3bd5
commit
ba7efbcc43
@@ -4,6 +4,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -48,4 +49,14 @@ public class RemoveFirstElementUnitTest {
|
||||
assertThat(linkedList, not(contains("cat")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenStringArray_whenRemovingFirstElement_thenArrayIsSmallerAndElementRemoved() {
|
||||
String[] stringArray = {"foo", "bar", "baz"};
|
||||
|
||||
String[] modifiedArray = Arrays.copyOfRange(stringArray, 1, stringArray.length);
|
||||
|
||||
assertThat(modifiedArray.length, is(2));
|
||||
assertThat(modifiedArray[0], is("bar"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user