Skip to content

Commit 087d624

Browse files
committed
add JUnit
1 parent 9d705a5 commit 087d624

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.hackerrank.algorithms.arraysandsorting;
2+
3+
import static org.junit.Assert.assertArrayEquals;
4+
5+
import org.junit.Test;
6+
import org.junit.runner.RunWith;
7+
import org.junit.runners.JUnit4;
8+
9+
10+
@RunWith(JUnit4.class)
11+
public class SampleTest {
12+
InsertionSort1 insertionSort1 = new InsertionSort1();
13+
@Test
14+
public void tesInsertIntoSorted() {
15+
int[] inputArr = new int[] {1,2,4};
16+
int[] inputResult = new int[] {1,2,4};
17+
insertionSort1.insertIntoSorted(inputArr);
18+
assertArrayEquals(inputResult, inputArr);
19+
}
20+
21+
@Test
22+
public void tesInsertIntoSorted2() {
23+
int[] inputArr = new int[] {1,6,4};
24+
int[] inputResult = new int[] {1, 4, 6};
25+
insertionSort1.insertIntoSorted(inputArr);
26+
assertArrayEquals(inputResult, inputArr);
27+
}
28+
29+
}

0 commit comments

Comments
 (0)