-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinkedCellsTest.java
More file actions
55 lines (43 loc) · 1.3 KB
/
LinkedCellsTest.java
File metadata and controls
55 lines (43 loc) · 1.3 KB
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
54
55
import com.hillel.java.dataStructures.linkedList.LinkedCells;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by EKarpenko on 17.04.2015.
*/
public class LinkedCellsTest {
@Test
public void toStringTest() {
LinkedCells linkedCells = getLinkedList();
System.out.println(linkedCells.toString());
}
@Test
public void addTest() {
LinkedCells linkedCells = new LinkedCells();
linkedCells.add("A");
linkedCells.add("B");
linkedCells.add("C");
Assert.assertEquals(3, linkedCells.size());
}
@Test
public void getByIndex() {
LinkedCells linkedCells = getLinkedList();
Assert.assertEquals("B", linkedCells.get(1));
}
@Test
public void addByIndex() {
LinkedCells linkedCells = getLinkedList();
linkedCells.addByIndex(3, "E");
Assert.assertEquals("E", linkedCells.get(3));
Assert.assertEquals(4, linkedCells.size());
}
@Test
public void removeByIndex() {
LinkedCells linkedCells = getLinkedList();
linkedCells.removeByIndex(1);
Assert.assertEquals("C", linkedCells.get(1));
Assert.assertEquals(2, linkedCells.size());
}
private LinkedCells getLinkedList() {
return new LinkedCells("A", "B", "C");
}
}