Wed, 26 Aug 2020 19:09:07 +0200
fixes wrong call of assertEquals()
22
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1 | package de.uapcore.sudoku; |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
2 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
3 | import org.junit.jupiter.api.Test; |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
4 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
5 | import static org.junit.jupiter.api.Assertions.*; |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
6 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
7 | class FieldTest { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
8 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
9 | private int[] createTestdata() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
10 | return new int[]{ |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
11 | 0,1,0,9,0,0,8,0,0, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
12 | 0,0,0,0,0,8,0,0,4, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
13 | 6,0,5,0,0,0,7,0,0, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
14 | 0,9,0,0,6,0,0,0,8, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
15 | 0,0,0,2,0,7,0,0,0, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
16 | 8,0,0,0,3,0,0,6,0, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
17 | 0,0,2,0,0,0,5,0,3, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
18 | 1,0,0,4,0,0,0,0,0, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
19 | 0,0,6,0,0,2,0,1,0}; |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
20 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
21 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
22 | private Field createTestField() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
23 | final var field = new Field(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
24 | final var testdata = createTestdata(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
25 | for (int x = 0 ; x < 9 ; x++) { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
26 | for (int y = 0 ; y < 9 ; y++) { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
27 | field.setCellValue(x, y, testdata[x+9*y]); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
28 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
29 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
30 | return field; |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
31 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
32 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
33 | @Test |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
34 | void getAndSetValues() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
35 | final var f = new Field(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
36 | assertEquals(0, f.getCellValue(3, 4)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
37 | assertTrue(f.isCellEmpty(3, 4)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
38 | f.setCellValue(3, 4, 6); |
25
569220009c54
fixes wrong call of assertEquals()
Mike Becker <universe@uap-core.de>
parents:
22
diff
changeset
|
39 | assertEquals(6, f.getCellValue(3, 4)); |
22
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
40 | assertFalse(f.isCellEmpty(3, 4)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
41 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
42 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
43 | @Test |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
44 | void setAllCellsModified() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
45 | final var f = new Field(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
46 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
47 | assertFalse(f.isAnyCellModified()); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
48 | f.setAllCellsModified(true); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
49 | for (int x = 0 ; x < 9 ; x++) { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
50 | for (int y = 0 ; y < 9 ; y++) { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
51 | assertTrue(f.isCellModified(x, y)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
52 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
53 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
54 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
55 | f.setAllCellsModified(false); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
56 | assertFalse(f.isAnyCellModified()); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
57 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
58 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
59 | @Test |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
60 | void isAnyCellModified() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
61 | final var f = new Field(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
62 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
63 | assertFalse(f.isAnyCellModified()); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
64 | f.setCellValue(3, 4, 6); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
65 | assertFalse(f.isAnyCellModified()); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
66 | f.setCellModified(3, 4, true); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
67 | assertTrue(f.isAnyCellModified()); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
68 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
69 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
70 | @Test |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
71 | void clear() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
72 | final var f = new Field(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
73 | f.setCellValue(3, 4, 6); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
74 | f.setCellValue(2, 5, 9); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
75 | f.clear(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
76 | for (int x = 0 ; x < 9 ; x++) { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
77 | for (int y = 0 ; y < 9 ; y++) { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
78 | assertTrue(f.isCellEmpty(x, y)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
79 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
80 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
81 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
82 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
83 | @Test |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
84 | void getSquare() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
85 | final var field = createTestField(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
86 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
87 | final var square01 = new int[][]{ |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
88 | new int[]{0,0,8}, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
89 | new int[]{9,0,0}, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
90 | new int[]{0,0,0}}; |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
91 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
92 | final var square01actual = field.getSquare(0, 1); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
93 | assertEquals(3, square01actual.length); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
94 | for (int i = 0 ; i < 3 ; i++) { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
95 | assertArrayEquals(square01[i], square01actual[i]); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
96 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
97 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
98 | final var square20 = new int[][]{ |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
99 | new int[]{8,0,7}, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
100 | new int[]{0,0,0}, |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
101 | new int[]{0,4,0}}; |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
102 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
103 | final var square20actual = field.getSquare(2, 0); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
104 | assertEquals(3, square20actual.length); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
105 | for (int i = 0 ; i < 3 ; i++) { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
106 | assertArrayEquals(square20[i], square20actual[i]); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
107 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
108 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
109 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
110 | @Test |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
111 | void getRow() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
112 | final var field = createTestField(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
113 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
114 | final var row3 = new int[]{0,9,0,0,6,0,0,0,8}; |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
115 | final var row4 = new int[]{0,0,0,2,0,7,0,0,0}; |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
116 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
117 | assertArrayEquals(row3, field.getRow(3)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
118 | assertArrayEquals(row4, field.getRow(4)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
119 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
120 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
121 | @Test |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
122 | void getColumn() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
123 | final var field = createTestField(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
124 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
125 | final var col2 = new int[]{0,0,5,0,0,0,2,0,6}; |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
126 | final var col6 = new int[]{8,0,7,0,0,0,5,0,0}; |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
127 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
128 | assertArrayEquals(col2, field.getColumn(2)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
129 | assertArrayEquals(col6, field.getColumn(6)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
130 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
131 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
132 | @Test |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
133 | void getSquareIAE() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
134 | final var field = createTestField(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
135 | assertThrows(IllegalArgumentException.class, () -> field.getSquare(3, 2)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
136 | assertThrows(IllegalArgumentException.class, () -> field.getSquare(2, 3)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
137 | assertThrows(IllegalArgumentException.class, () -> field.getSquare(2, -1)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
138 | assertThrows(IllegalArgumentException.class, () -> field.getSquare(-1, 2)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
139 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
140 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
141 | @Test |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
142 | void getRowIAE() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
143 | final var field = createTestField(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
144 | assertThrows(IllegalArgumentException.class, () -> field.getRow(9)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
145 | assertThrows(IllegalArgumentException.class, () -> field.getRow(-1)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
146 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
147 | |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
148 | @Test |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
149 | void getColumnIAE() { |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
150 | final var field = createTestField(); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
151 | assertThrows(IllegalArgumentException.class, () -> field.getColumn(9)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
152 | assertThrows(IllegalArgumentException.class, () -> field.getColumn(-1)); |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
153 | } |
06170a0be62a
bugfix: modified state is reset even when saving fails + more tests
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
154 | } |