|
13 | 13 | @RunWith(Enclosed.class) |
14 | 14 | public class MatrixTest { |
15 | 15 |
|
| 16 | + @RunWith(Parameterized.class) |
| 17 | + public static class CountRowsTest { |
| 18 | + private Matrix matrix; |
| 19 | + private int numberOfRows; |
| 20 | + |
| 21 | + @Parameterized.Parameters(name = "{index}: expected matrix constructed with string \n\"{0}\" to have {1} row(s).") |
| 22 | + public static Collection<Object[]> data() { |
| 23 | + return Arrays.asList(new Object[][]{ |
| 24 | + {"0", 1}, |
| 25 | + {"0 1", 1}, |
| 26 | + { "0\n" |
| 27 | + + "1", 2}, |
| 28 | + { "0 1\n" |
| 29 | + + "2 3", 2}, |
| 30 | + { "0 1 2\n" |
| 31 | + + "3 4 5\n" |
| 32 | + + "6 7 8", 3} |
| 33 | + }); |
| 34 | + } |
| 35 | + |
| 36 | + public CountRowsTest(String matrixAsString, int numberOfRows) { |
| 37 | + this.matrix = new Matrix(matrixAsString); |
| 38 | + this.numberOfRows = numberOfRows; |
| 39 | + } |
| 40 | + |
| 41 | + @Test |
| 42 | + public void countRowsTest() { |
| 43 | + assertEquals(numberOfRows, matrix.getRowsCount()); |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + @Ignore |
| 48 | + @RunWith(Parameterized.class) |
| 49 | + public static class CountColumnsTest { |
| 50 | + private Matrix matrix; |
| 51 | + private int numberOfColumns; |
| 52 | + |
| 53 | + @Parameterized.Parameters(name = "{index}: expected matrix constructed with string \n\"{0}\" to have {1} column(s).") |
| 54 | + public static Collection<Object[]> data() { |
| 55 | + return Arrays.asList(new Object[][]{ |
| 56 | + {"0", 1}, |
| 57 | + {"0 1", 2}, |
| 58 | + { "0\n" |
| 59 | + + "1", 1}, |
| 60 | + { "0 1\n" |
| 61 | + + "2 3", 2}, |
| 62 | + { "0 1 2\n" |
| 63 | + + "3 4 5\n" |
| 64 | + + "6 7 8", 3} |
| 65 | + }); |
| 66 | + } |
| 67 | + |
| 68 | + public CountColumnsTest(String matrixAsString, int numberOfColumns) { |
| 69 | + this.matrix = new Matrix(matrixAsString); |
| 70 | + this.numberOfColumns = numberOfColumns; |
| 71 | + } |
| 72 | + |
| 73 | + @Test |
| 74 | + public void countColumnsTest() { |
| 75 | + assertEquals(numberOfColumns, matrix.getColumnsCount()); |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + @Ignore |
16 | 80 | @RunWith(Parameterized.class) |
17 | 81 | public static class GetFirstRowTest { |
18 | 82 | private Matrix matrix; |
@@ -140,69 +204,4 @@ public void getLastColumnTest() { |
140 | 204 | assertArrayEquals(lastColumn, matrix.getColumn(matrix.getColumnsCount() - 1)); |
141 | 205 | } |
142 | 206 | } |
143 | | - |
144 | | - @Ignore |
145 | | - @RunWith(Parameterized.class) |
146 | | - public static class CountColumnsTest { |
147 | | - private Matrix matrix; |
148 | | - private int numberOfColumns; |
149 | | - |
150 | | - @Parameterized.Parameters(name = "{index}: expected matrix constructed with string \n\"{0}\" to have {1} column(s).") |
151 | | - public static Collection<Object[]> data() { |
152 | | - return Arrays.asList(new Object[][]{ |
153 | | - {"0", 1}, |
154 | | - {"0 1", 2}, |
155 | | - { "0\n" |
156 | | - + "1", 1}, |
157 | | - { "0 1\n" |
158 | | - + "2 3", 2}, |
159 | | - { "0 1 2\n" |
160 | | - + "3 4 5\n" |
161 | | - + "6 7 8", 3} |
162 | | - }); |
163 | | - } |
164 | | - |
165 | | - public CountColumnsTest(String matrixAsString, int numberOfColumns) { |
166 | | - this.matrix = new Matrix(matrixAsString); |
167 | | - this.numberOfColumns = numberOfColumns; |
168 | | - } |
169 | | - |
170 | | - @Test |
171 | | - public void countColumnsTest() { |
172 | | - assertEquals(numberOfColumns, matrix.getColumnsCount()); |
173 | | - } |
174 | | - } |
175 | | - |
176 | | - @Ignore |
177 | | - @RunWith(Parameterized.class) |
178 | | - public static class CountRowsTest { |
179 | | - private Matrix matrix; |
180 | | - private int numberOfRows; |
181 | | - |
182 | | - @Parameterized.Parameters(name = "{index}: expected matrix constructed with string \n\"{0}\" to have {1} row(s).") |
183 | | - public static Collection<Object[]> data() { |
184 | | - return Arrays.asList(new Object[][]{ |
185 | | - {"0", 1}, |
186 | | - {"0 1", 1}, |
187 | | - { "0\n" |
188 | | - + "1", 2}, |
189 | | - { "0 1\n" |
190 | | - + "2 3", 2}, |
191 | | - { "0 1 2\n" |
192 | | - + "3 4 5\n" |
193 | | - + "6 7 8", 3} |
194 | | - }); |
195 | | - } |
196 | | - |
197 | | - public CountRowsTest(String matrixAsString, int numberOfRows) { |
198 | | - this.matrix = new Matrix(matrixAsString); |
199 | | - this.numberOfRows = numberOfRows; |
200 | | - } |
201 | | - |
202 | | - @Test |
203 | | - public void countRowsTest() { |
204 | | - assertEquals(numberOfRows, matrix.getRowsCount()); |
205 | | - } |
206 | | - } |
207 | | - |
208 | 207 | } |
0 commit comments