-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathBubbleSortTest.java
More file actions
38 lines (28 loc) · 992 Bytes
/
BubbleSortTest.java
File metadata and controls
38 lines (28 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package sorting;
import com.zhokhov.interview.sorting.BubbleSort;
import com.zhokhov.interview.util.Console;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class BubbleSortTest extends TestCase {
private static int[] array;
@Test
public void bubbleSortIntegerArray(){
array = new int[]{12, 2, 8, 5, 1, 6, 4, 15};
BubbleSort bubbleSort = new BubbleSort();
bubbleSort.sort(array);
Console.__red("Index 1 is value in this array => " + array[1]);
assertEquals(2, array[1]);
}
@Test
public void checkLengthAfterUsingBubbleSort(){
array = new int[]{12, 2, 8, 5, 1, 6, 4, 15};
int lengthBeforeSort = array.length;
BubbleSort bubbleSort = new BubbleSort();
bubbleSort.sort(array);
int lengthAfterSort = array.length;
assertEquals(lengthBeforeSort, lengthAfterSort);
}
}