public void testGetMatCoordinate() {
    try {
      // what in case of the null string
      assertTrue(Double.isNaN(nullLine.getMatCoordinate(new Coordinate(1.0, 1.0), 1.0)));

      // get two neighbouring points along the arbitraryline
      arbitraryLine.measureOnLength(false);
      int elem1Indx = (int) (Math.random() * (arbitraryLine.getNumPoints() - 1));
      int elem2Indx = 0;
      if (elem1Indx == arbitraryLine.getNumPoints() - 1) {
        elem2Indx = elem1Indx - 1;
      } else {
        elem2Indx = elem1Indx + 1;
      }

      // if a coordinate of the geometry is passed, it should return
      // exactly that m-value
      MCoordinate mco1 = (MCoordinate) arbitraryLine.getCoordinateN(elem1Indx);
      double m = arbitraryLine.getMatCoordinate(mco1, 0.00001);
      assertEquals(mco1.m, m, DoubleComparator.defaultNumericalPrecision());

      // check for a coordinate between mco1 and mco2 (neighbouring
      // coordinates)
      MCoordinate mco2 = (MCoordinate) arbitraryLine.getCoordinateN(elem2Indx);
      double offset = Math.random();
      double expectedM = mco1.m + offset * (mco2.m - mco1.m);
      Coordinate mctest =
          new Coordinate(mco1.x + offset * (mco2.x - mco1.x), mco1.y + offset * (mco2.y - mco1.y));

      double testM = arbitraryLine.getMatCoordinate(mctest, offset);
      assertEquals(expectedM, testM, DoubleComparator.defaultNumericalPrecision());
    } catch (Exception e) {
      e.printStackTrace();
      assertTrue(false); // should never reach here
    }
  }