### Question:
Matrix { int[] getRow(int rowNumber) { throw new UnsupportedOperationException("Delete this statement and write your own implementation."); } Matrix(String matrixAsString);   }### Answer:
@Test public void extractRowFromOneNumberMatrixTest() { String matrixAsString = "1"; int rowIndex = 1; int[] expectedRow = {1}; Matrix matrix = new Matrix(matrixAsString); assertArrayEquals(expectedRow, matrix.getRow(rowIndex)); }
@Ignore("Remove to run test") @Test public void extractRowFromMatrixTest() { String matrixAsString = "1 2\n3 4"; int rowIndex = 2; int[] expectedRow = {3, 4}; Matrix matrix = new Matrix(matrixAsString); assertArrayEquals(expectedRow, matrix.getRow(rowIndex)); }
@Ignore("Remove to run test") @Test public void extractRowFromDiffWidthsMatrixTest() { String matrixAsString = "1 2\n10 20"; int rowIndex = 2; int[] expectedRow = {10, 20}; Matrix matrix = new Matrix(matrixAsString); assertArrayEquals(expectedRow, matrix.getRow(rowIndex)); }
@Ignore("Remove to run test") @Test public void extractRowFromNonSquareMatrixTest() { String matrixAsString = "1 2 3\n4 5 6\n7 8 9\n8 7 6"; int rowIndex = 4; int[] expectedRow = {8, 7, 6}; Matrix matrix = new Matrix(matrixAsString); assertArrayEquals(expectedRow, matrix.getRow(rowIndex)); }