@Test public void shouldReturnNotFoundValueIfArray1IsNull() { // Given int[] arr1 = null; int[] arr2 = {4, 5}; // When int searchIndexValue = arrayIndexSearch.findArrayIndex(arr1, arr2); // Then assertEquals(NOT_FOUND_VALUE, searchIndexValue); }
@Test public void shouldReturnNotFoundValueIfArray2HasNoValues() { // Given int[] arr1 = {1, 2, 3, 4, 5}; int[] arr2 = {}; // When int searchIndexValue = arrayIndexSearch.findArrayIndex(arr1, arr2); // Then assertEquals(NOT_FOUND_VALUE, searchIndexValue); }
@Test public void shouldReturnIndexValueIfArray2FoundInArray1() { // Given int[] arr1 = {2, 3, 4, 5}; int[] arr2 = {4, 5}; // When int searchIndexValue = arrayIndexSearch.findArrayIndex(arr1, arr2); // Then assertEquals(2, searchIndexValue); }