IntegerType implements Type<IntegerHolder> { @Override public String encode(IntegerHolder value) { Long v = value.getValue(); return v != null ? v.toString() : null; }  @Override String encode(IntegerHolder value); @Override IntegerHolder decode(String text); @Override IntegerHolder convert(Object obj); @Override IntegerHolder[] newArray(int size); static final String TYPE_NAME; }
@Test public void testEncode() { Object[][] testCases = { {-100L, "-100"}, {0L, "0"}, {999L, "999"}, {2147483648L, "2147483648"}, {null, null} }; for (Object[] testCase : testCases) { Long number = (Long) testCase[0]; String expectedResult = (String) testCase[1]; String result = type.encode(new IntegerHolder(number)); assertEquals(expectedResult, result); } }