NumberType implements Type<NumberHolder> { @Override public String encode(NumberHolder value) { return value.getString(); }  @Override String encode(NumberHolder value); @Override NumberHolder decode(String text); @Override NumberHolder convert(Object obj); @Override NumberHolder[] newArray(int size); static final String TYPE_NAME; }
@Test public void testEncode() { Object[][] testCases = { {num("-100"), "-100"}, {num("-100.00"), "-100.00"}, {num("0.0"), "0.0"}, {num(".0"), "0.0"}, {num(".000"), "0.000"}, {num("12.3456789"), "12.3456789"}, {num(null), null} }; for (Object[] testCase : testCases) { NumberHolder value = (NumberHolder) testCase[0]; String expectedResult = (String) testCase[1]; assertEquals(expectedResult, type.encode(value)); } }