@Test public void shouldBeAbleToConvertNumbers() { assertThat((Float) converter.convert("2.2", float.class, bundle), is(equalTo(2.2f))); }
public Float convert(String value, Class<? extends Float> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0f; } try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }
PrimitiveFloatConverter implements Converter<Float> { public Float convert(String value, Class<? extends Float> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0f; } try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } } }
PrimitiveFloatConverter implements Converter<Float> { public Float convert(String value, Class<? extends Float> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0f; } try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }  }
PrimitiveFloatConverter implements Converter<Float> { public Float convert(String value, Class<? extends Float> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0f; } try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }  Float convert(String value, Class<? extends Float> type, ResourceBundle bundle); }
PrimitiveFloatConverter implements Converter<Float> { public Float convert(String value, Class<? extends Float> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0f; } try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }  Float convert(String value, Class<? extends Float> type, ResourceBundle bundle);  }