### Question:
Matrix { int[] getColumn(int columnNumber) { throw new UnsupportedOperationException("Delete this statement and write your own implementation."); } Matrix(String matrixAsString);   }### Answer:
@Ignore("Remove to run test") @Test public void extractColumnFromNonSquareMatrixTest() { String matrixAsString = "1 2 3 4\n5 6 7 8\n9 8 7 6"; int columnIndex = 4; int[] expectedColumn = {4, 8, 6}; Matrix matrix = new Matrix(matrixAsString); assertArrayEquals(expectedColumn, matrix.getColumn(columnIndex)); }
@Ignore("Remove to run test") @Test public void extractColumnFromDiffWidthsMatrixTest() { String matrixAsString = "89 1903 3\n18 3 1\n9 4 800"; int columnIndex = 2; int[] expectedColumn = {1903, 3, 4}; Matrix matrix = new Matrix(matrixAsString); assertArrayEquals(expectedColumn, matrix.getColumn(columnIndex)); }
@Ignore("Remove to run test") @Test public void extractColumnFromOneNumberMatrixTest() { String matrixAsString = "1"; int columnIndex = 1; int[] expectedColumn = {1}; Matrix matrix = new Matrix(matrixAsString); assertArrayEquals(expectedColumn, matrix.getColumn(columnIndex)); }
@Ignore("Remove to run test") @Test public void extractColumnMatrixTest() { String matrixAsString = "1 2 3\n4 5 6\n7 8 9"; int columnIndex = 3; int[] expectedColumn = {3, 6, 9}; Matrix matrix = new Matrix(matrixAsString); assertArrayEquals(expectedColumn, matrix.getColumn(columnIndex)); }