NumberConverter implements Converter, Serializable { @Override public String getAsString(FacesContext context, UIComponent component, Object value) { if (value == null) { return ""; } return Double.toString((Double) value); }  @Override Object getAsObject(FacesContext context, UIComponent component, String value); @Override String getAsString(FacesContext context, UIComponent component, Object value);  }
@Test public void getAsString_positiveIntegerAddsComma() { String result = numberConverter.getAsString(null, null, 35d); assertEquals("35.0" , result); }
@Test public void getAsString_negativeIntegerAddsComma() { String result = numberConverter.getAsString(null, null, -35d); assertEquals("-35.0" , result); }
@Test public void getAsString_DoubleWith1DecimalConvertsOk() { String result = numberConverter.getAsString(null, null, -35.1d); assertEquals("-35.1" , result); }
@Test public void getAsString_DoubleWith8DecimalConvertsOk() { String result = numberConverter.getAsString(null, null, -35000.12345678d); assertEquals("-35000.12345678" , result); }