### Question:
ToDoubleConverter implements Converter { @Override public Double convert(Class<?> targetClass, String strVal) throws ConvertException { if (strVal == null) { return null; } try { return Double.parseDouble(strVal); } catch (NumberFormatException ex) { throw new ConvertException(String.format("Failed to parse '%s' to Double", strVal)); } }  @Override Double convert(Class<?> targetClass, String strVal);  }### Answer:
@Test(dataProvider = "validValues") public void testConvertValidValues(String from, Double expectedDouble) { Assert.assertEquals(toDoubleConverter.convert(Double.class, from), expectedDouble, 0.00001); }
@Test public void testNullConvertedToNull() { Assert.assertEquals(toDoubleConverter.convert(Double.class, null), null); }
@Test(dataProvider = "invalidValues", expectedExceptions = {ConvertException.class}) public void testConvertInvalidValues(String invalidVal) { toDoubleConverter.convert(Double.class, invalidVal); }