PercentageIntegerConverter extends GroupingStringToIntegerConverter { @Override public String convertToPresentation(Integer value, ValueContext context) { String result = super.convertToPresentation(value, context); return result == null ? null : result + "%"; } PercentageIntegerConverter(String message, boolean useGrouping); @Override String convertToPresentation(Integer value, ValueContext context); @Override Result<Integer> convertToModel(String value, ValueContext context);  }
@Test public void testConvertToPresentation() { PercentageIntegerConverter cv = new PercentageIntegerConverter("message", true); assertNull(cv.convertToPresentation(null, createContext())); String result = cv.convertToPresentation(1234, createContext()); assertEquals("1.234%", result); }