@Test
  public void testPosition() {
    final Iterator<RealPoint> realPointIterator = realPointList.iterator();
    final RealCursor<DoubleType> realPointSampleCursor = realPointSampleList.cursor();

    while (realPointSampleCursor.hasNext()) {
      realPointSampleCursor.fwd();
      assertTrue(
          "Positions differ ", positionEquals(realPointIterator.next(), realPointSampleCursor));
    }
  }
  @Before
  public void init() {
    for (int i = 0; i < m; ++i) {
      final double[] position = new double[n];
      for (int d = 0; d < n; ++d) position[d] = rnd.nextDouble();

      final RealPoint realPoint = new RealPoint(position);
      final DoubleType sample = new DoubleType(rnd.nextDouble());

      realPointList.add(realPoint);
      sampleList.add(sample);
      realPointSampleList.add(realPoint, sample);
    }
  }
  @Test
  public void testCopy() {
    final ArrayList<RealCursor<DoubleType>> copies = new ArrayList<RealCursor<DoubleType>>();
    final RealCursor<DoubleType> cursor = realPointSampleList.cursor();
    while (cursor.hasNext()) {
      cursor.fwd();
      copies.add(cursor.copyCursor());
    }

    cursor.reset();
    final Iterator<RealCursor<DoubleType>> copyIterator = copies.iterator();
    while (cursor.hasNext()) {
      cursor.fwd();
      final RealCursor<DoubleType> copy = copyIterator.next();
      assertTrue("Copy failed at sample ", copy.get() == cursor.get());
      assertTrue("Copy failed at position ", positionEquals(copy, cursor));
    }
  }