Merge pull request #5408 from eugenp/BAEL-2212

fix unit test
This commit is contained in:
Loredana Crusoveanu 2018-10-09 13:37:40 +03:00 committed by GitHub
commit 7d03f03ebb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -1,4 +1,4 @@
package algorithms.insertionsort; package com.baeldung.algorithms.insertionsort;
import com.baeldung.algorithms.insertionsort.InsertionSort; import com.baeldung.algorithms.insertionsort.InsertionSort;
import org.junit.Test; import org.junit.Test;
@ -8,7 +8,7 @@ import static org.junit.Assert.assertArrayEquals;
public class InsertionSortUnitTest { public class InsertionSortUnitTest {
@Test @Test
public void givenUnsortedArray_whenInsertionSortImperatively_thenItIsSortedInAscendingOrder() { public void givenUnsortedArray_whenInsertionSortImperative_thenSortedAsc() {
int[] input = {6, 2, 3, 4, 5, 1}; int[] input = {6, 2, 3, 4, 5, 1};
InsertionSort.insertionSortImperative(input); InsertionSort.insertionSortImperative(input);
int[] expected = {1, 2, 3, 4, 5, 6}; int[] expected = {1, 2, 3, 4, 5, 6};
@ -16,9 +16,8 @@ public class InsertionSortUnitTest {
} }
@Test @Test
public void givenUnsortedArray_whenInsertionSortRecursively_thenItIsSortedInAscendingOrder() { public void givenUnsortedArray_whenInsertionSortRecursive_thenSortedAsc() {
// int[] input = {6, 4, 5, 2, 3, 1}; int[] input = {6, 4, 5, 2, 3, 1};
int[] input = {6, 4};
InsertionSort.insertionSortRecursive(input); InsertionSort.insertionSortRecursive(input);
int[] expected = {1, 2, 3, 4, 5, 6}; int[] expected = {1, 2, 3, 4, 5, 6};
assertArrayEquals("the two arrays are not equal", expected, input); assertArrayEquals("the two arrays are not equal", expected, input);