### Question:
StrToDoubleConverter { public double convertStringToDouble(String input) { if (input.matches("[0-9.-]+")) { double convertedDistance = Double.valueOf(input); return convertedDistance; } else { return NaN; } }  double convertStringToDouble(String input);  }### Answer:
@Test public void convertDistanceTest(){ StrToDoubleConverter strToDoubleConverter = new StrToDoubleConverter(); assertEquals(Double.NaN, strToDoubleConverter.convertStringToDouble("ASD"),0.01); assertEquals(-1, strToDoubleConverter.convertStringToDouble("-1"), 0.01); assertEquals(23.3, strToDoubleConverter.convertStringToDouble("23.3"),0.01); }