-
-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathProblemFactoryTest.java
More file actions
69 lines (53 loc) · 1.58 KB
/
Copy pathProblemFactoryTest.java
File metadata and controls
69 lines (53 loc) · 1.58 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package processing.mode.java;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import processing.app.Problem;
import processing.app.ui.Editor;
import processing.mode.java.preproc.PdePreprocessIssue;
import java.util.ArrayList;
import java.util.List;
public class ProblemFactoryTest {
private PdePreprocessIssue pdePreprocessIssue;
private List<Integer> tabStarts;
private List<Integer> starts;
@Before
public void setUp() {
pdePreprocessIssue = new PdePreprocessIssue(8, 2, "test");
tabStarts = new ArrayList<>();
tabStarts.add(5);
starts = new ArrayList<>();
starts.add(0);
starts.add(5);
starts.add(10);
}
@Test
public void buildWithoutEditor() {
Problem problem = ProblemFactory.build(pdePreprocessIssue, tabStarts);
Assert.assertEquals(3, problem.getLineNumber());
Assert.assertEquals("test", problem.getMessage());
}
@Test
public void getTabStart() {
Assert.assertEquals(0, ProblemFactory.getTab(starts, 0).getTab());
}
@Test
public void getTabMiddleFrontEdge() {
Assert.assertEquals(1, ProblemFactory.getTab(starts, 5).getTab());
}
@Test
public void getTabMiddle() {
TabLine tabLine = ProblemFactory.getTab(starts, 7);
Assert.assertEquals(1, tabLine.getTab());
Assert.assertEquals(2, tabLine.getLineInTab());
}
@Test
public void getTabMiddleBackEdge() {
Assert.assertEquals(2, ProblemFactory.getTab(starts, 10).getTab());
}
@Test
public void getTabEnd() {
Assert.assertEquals(2, ProblemFactory.getTab(starts, 15).getTab());
}
}