@Test
public void testSparseCopy() {

  SparseMatrix matrix = createSparseMatrixWithEmptyRow();
  Matrix copy = matrix.clone();
  assertSame("wrong class", copy.getClass(), matrix.getClass());
  SparseMatrix castedCopy = (SparseMatrix) copy;
      
  Iterator<MatrixSlice> originalSlices = matrix.iterator();
  Iterator<MatrixSlice> copySlices = castedCopy.iterator();
  
  while (originalSlices.hasNext() && copySlices.hasNext()) {
    MatrixSlice originalSlice = originalSlices.next();
    MatrixSlice copySlice = copySlices.next();
    assertEquals("Wrong row indices.", originalSlice.index(), copySlice.index());
    assertEquals("Slices are not equal.", originalSlice, copySlice);
  }
  
  assertSame("Number of rows of original and copy are not equal.", originalSlices.hasNext(), copySlices.hasNext());
}