Commit 0c4a46ca8174824fc029d3cf38715d170b27c3ff

Authored by mandjemb
1 parent e0bdcd83

test

src/kernel/test/BinaryOperationTest.java
@@ -4,6 +4,7 @@ import kernel.Cell; @@ -4,6 +4,7 @@ import kernel.Cell;
4 import kernel.Grid; 4 import kernel.Grid;
5 import kernel.LanguageEnum; 5 import kernel.LanguageEnum;
6 import kernel.exception.CreateCycleException; 6 import kernel.exception.CreateCycleException;
  7 +import kernel.exception.InvalidIntervalLineColumnEception;
7 import kernel.function.Sum; 8 import kernel.function.Sum;
8 import kernel.operation.Addition; 9 import kernel.operation.Addition;
9 import kernel.operation.Division; 10 import kernel.operation.Division;
@@ -22,7 +23,7 @@ public class BinaryOperationTest { @@ -22,7 +23,7 @@ public class BinaryOperationTest {
22 private List<Cell> cells; 23 private List<Cell> cells;
23 24
24 @Before 25 @Before
25 - public void initData() throws CreateCycleException { 26 + public void initData() throws CreateCycleException, InvalidIntervalLineColumnEception {
26 Grid.language = LanguageEnum.EN; 27 Grid.language = LanguageEnum.EN;
27 this.cells = new ArrayList<>(); 28 this.cells = new ArrayList<>();
28 29
src/kernel/test/FunctionTest.java
@@ -3,6 +3,7 @@ package kernel.test; @@ -3,6 +3,7 @@ package kernel.test;
3 import kernel.Cell; 3 import kernel.Cell;
4 import kernel.Grid; 4 import kernel.Grid;
5 import kernel.LanguageEnum; 5 import kernel.LanguageEnum;
  6 +import kernel.exception.InvalidIntervalLineColumnEception;
6 import kernel.function.Sum; 7 import kernel.function.Sum;
7 import org.junit.Before; 8 import org.junit.Before;
8 import org.junit.Test; 9 import org.junit.Test;
@@ -10,14 +11,13 @@ import org.junit.Test; @@ -10,14 +11,13 @@ import org.junit.Test;
10 import java.util.ArrayList; 11 import java.util.ArrayList;
11 import java.util.List; 12 import java.util.List;
12 13
13 -import static org.junit.Assert.*;  
14 14
15 public class FunctionTest { 15 public class FunctionTest {
16 16
17 private List<Cell> cells; 17 private List<Cell> cells;
18 18
19 @Before 19 @Before
20 - public void initData() { 20 + public void initData() throws InvalidIntervalLineColumnEception {
21 Grid.language = LanguageEnum.EN; 21 Grid.language = LanguageEnum.EN;
22 this.cells = new ArrayList<>(); 22 this.cells = new ArrayList<>();
23 23
src/kernel/test/GridTest.java
@@ -5,6 +5,7 @@ import kernel.Grid; @@ -5,6 +5,7 @@ import kernel.Grid;
5 import kernel.LanguageEnum; 5 import kernel.LanguageEnum;
6 import kernel.exception.CellNotFoundException; 6 import kernel.exception.CellNotFoundException;
7 import kernel.exception.CreateCycleException; 7 import kernel.exception.CreateCycleException;
  8 +import kernel.exception.InvalidIntervalLineColumnEception;
8 import kernel.function.Average; 9 import kernel.function.Average;
9 import kernel.function.Sum; 10 import kernel.function.Sum;
10 import kernel.operation.Addition; 11 import kernel.operation.Addition;
@@ -29,7 +30,7 @@ public class GridTest { @@ -29,7 +30,7 @@ public class GridTest {
29 } 30 }
30 31
31 @Test 32 @Test
32 - public void testCreateCellWithValue() { 33 + public void testCreateCellWithValue() throws InvalidIntervalLineColumnEception {
33 assertEquals(0, this.grid.getCells().size()); 34 assertEquals(0, this.grid.getCells().size());
34 35
35 this.grid.createCell("A", 1, 10.); 36 this.grid.createCell("A", 1, 10.);
@@ -38,7 +39,7 @@ public class GridTest { @@ -38,7 +39,7 @@ public class GridTest {
38 } 39 }
39 40
40 @Test 41 @Test
41 - public void testCreateCellWithFormula() throws CellNotFoundException, CreateCycleException { 42 + public void testCreateCellWithFormula() throws CellNotFoundException, CreateCycleException, InvalidIntervalLineColumnEception {
42 this.createCellsWithValue(); 43 this.createCellsWithValue();
43 assertEquals(3, this.grid.getCells().size()); 44 assertEquals(3, this.grid.getCells().size());
44 45
@@ -52,7 +53,7 @@ public class GridTest { @@ -52,7 +53,7 @@ public class GridTest {
52 } 53 }
53 54
54 @Test 55 @Test
55 - public void testGetValue() throws CellNotFoundException, CreateCycleException { 56 + public void testGetValue() throws CellNotFoundException, CreateCycleException, InvalidIntervalLineColumnEception {
56 this.createCellsWithFormula(); 57 this.createCellsWithFormula();
57 58
58 assertEquals(10, this.grid.getValue("A", 1), 0); 59 assertEquals(10, this.grid.getValue("A", 1), 0);
@@ -64,7 +65,7 @@ public class GridTest { @@ -64,7 +65,7 @@ public class GridTest {
64 } 65 }
65 66
66 @Test 67 @Test
67 - public void testGetFormulaAsString() throws CellNotFoundException, CreateCycleException { 68 + public void testGetFormulaAsString() throws CellNotFoundException, CreateCycleException, InvalidIntervalLineColumnEception {
68 Grid.language = LanguageEnum.EN; 69 Grid.language = LanguageEnum.EN;
69 this.createCellsWithFormula(); 70 this.createCellsWithFormula();
70 71
@@ -77,14 +78,14 @@ public class GridTest { @@ -77,14 +78,14 @@ public class GridTest {
77 } 78 }
78 79
79 @Test 80 @Test
80 - public void testGetDevelopedFormula() throws CellNotFoundException, CreateCycleException { 81 + public void testGetDevelopedFormula() throws CellNotFoundException, CreateCycleException, InvalidIntervalLineColumnEception {
81 this.createCellsWithFormula(); 82 this.createCellsWithFormula();
82 83
83 assertEquals("A3*SUM(A1,A2,A3)", this.grid.getDevelopedFormula("B", 3)); 84 assertEquals("A3*SUM(A1,A2,A3)", this.grid.getDevelopedFormula("B", 3));
84 } 85 }
85 86
86 @Test 87 @Test
87 - public void testSetValue() throws CellNotFoundException, CreateCycleException { 88 + public void testSetValue() throws CellNotFoundException, CreateCycleException, InvalidIntervalLineColumnEception {
88 this.createCellsWithFormula(); 89 this.createCellsWithFormula();
89 90
90 assertEquals(10, this.grid.getValue("A", 1), 0); 91 assertEquals(10, this.grid.getValue("A", 1), 0);
@@ -105,7 +106,7 @@ public class GridTest { @@ -105,7 +106,7 @@ public class GridTest {
105 } 106 }
106 107
107 @Test 108 @Test
108 - public void testSetFormula() throws CellNotFoundException, CreateCycleException { 109 + public void testSetFormula() throws CellNotFoundException, CreateCycleException, InvalidIntervalLineColumnEception {
109 this.createCellsWithFormula(); 110 this.createCellsWithFormula();
110 111
111 assertEquals(12, this.grid.getValue("B", 2), 0); 112 assertEquals(12, this.grid.getValue("B", 2), 0);
@@ -152,7 +153,7 @@ public class GridTest { @@ -152,7 +153,7 @@ public class GridTest {
152 } 153 }
153 154
154 @Test 155 @Test
155 - public void testGetCell() throws CellNotFoundException { 156 + public void testGetCell() throws CellNotFoundException, InvalidIntervalLineColumnEception {
156 this.createCellsWithValue(); 157 this.createCellsWithValue();
157 158
158 Cell cell = this.grid.getCell("A", 1); 159 Cell cell = this.grid.getCell("A", 1);
@@ -168,7 +169,7 @@ public class GridTest { @@ -168,7 +169,7 @@ public class GridTest {
168 } 169 }
169 170
170 @Test 171 @Test
171 - public void testGetCells() { 172 + public void testGetCells() throws InvalidIntervalLineColumnEception {
172 assertEquals(0, this.grid.getCells().size()); 173 assertEquals(0, this.grid.getCells().size());
173 174
174 this.createCellsWithValue(); 175 this.createCellsWithValue();
@@ -176,13 +177,13 @@ public class GridTest { @@ -176,13 +177,13 @@ public class GridTest {
176 assertEquals(3, this.grid.getCells().size()); 177 assertEquals(3, this.grid.getCells().size());
177 } 178 }
178 179
179 - private void createCellsWithValue() { 180 + private void createCellsWithValue() throws InvalidIntervalLineColumnEception {
180 this.grid.createCell("A", 1, 10.); 181 this.grid.createCell("A", 1, 10.);
181 this.grid.createCell("A", 2, 0.); 182 this.grid.createCell("A", 2, 0.);
182 this.grid.createCell("A", 3, 2.); 183 this.grid.createCell("A", 3, 2.);
183 } 184 }
184 185
185 - private void createCellsWithFormula() throws CellNotFoundException, CreateCycleException { 186 + private void createCellsWithFormula() throws CellNotFoundException, CreateCycleException, InvalidIntervalLineColumnEception {
186 this.createCellsWithValue(); 187 this.createCellsWithValue();
187 188
188 Cell a1 = this.grid.getCell("A", 1); 189 Cell a1 = this.grid.getCell("A", 1);