-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArrayOddPositionTest.java
53 lines (29 loc) · 1.17 KB
/
ArrayOddPositionTest.java
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
public class ArrayOddPositionTest{
@Test
public void testCanReturnValueAtOddPosition(){
ArrayAtOddPosition newMyArray = new ArrayAtOddPosition();
String[] myNewArray = {"Chichi","Ayo","Kadoon","Abe","Isco","Fred","Boss"};
String[] methodHolder = newMyArray.methodOddPositions(myNewArray);
String[] result = {"Chichi","Kadoon","Isco","Boss"};
assertArrayEquals(result, methodHolder );
}
@Test
public void canPrintIntegersAtOddPositions(){
ArrayAtOddPosition printInt = new ArrayAtOddPosition();
int[] myArray = {3,5,2,1,6,7,8,67};
int[] myMethodHolder = printInt.atOddPositions(myArray);
int[] newResult = {3,2,6,8};
assertArrayEquals(newResult,myMethodHolder);
}
@Test
public void canReturnDoubleAtOddPositions(){
ArrayAtOddPosition objectArray = new ArrayAtOddPosition();
double[] newMyArray = {4.2,45,6.7,55.0,23.00,};
double[] methodHolder = objectArray.canGetOddPositions(newMyArray);
double[] result = {4.2,6.7,23.00};
assertArrayEquals(result, methodHolder);
}
}