### Question:
PercentConverter extends DoubleConverter { @Override public Double fromString(String string, ConverterContext context) { Number number = numberFromString(string, context); if (number == null) { number = Double.parseDouble(string); } if (string != null && !string.trim().endsWith("%") && number != null) { number = number.doubleValue() / 100; } return number != null ? number.doubleValue() : null; } PercentConverter();  PercentConverter(Locale locale);  PercentConverter(NumberFormat format); @Override Double fromString(String string, ConverterContext context); static final ConverterContext CONTEXT; }### Answer:
@Test public void testFromString() throws Exception { Assert.assertEquals(0.5, _converter.fromString("50%"), 0.001); Assert.assertEquals(0.5, _converter.fromString("50"), 0.001); Assert.assertEquals(0.005, _converter.fromString("0.5"), 0.001); }