IntegerToLong extends IntegerToInteger { @Override public void validate(Class<?> type, int size, int decimals) { if(size > 21) { throw new TypeConverterException("Long is not large enough to hold possible value"); } if(!(Long.class.equals(type) || Long.TYPE.equals(type))) { throw new TypeConverterException("Only supports converting to and from long or Long"); } }  @Override void validate(Class<?> type, int size, int decimals); @Override Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding); @Override byte[] from(Object value, int length, int decimals, boolean addPadding);  }
@Test public void testValidateSuccess() throws Exception { typeConverter.validate(Long.TYPE, 10, -1); }
@Test(expected = TypeConverterException.class) public void testValidateFail() throws Exception { typeConverter.validate(Integer.TYPE, 2, -1); }