IntegerValueConverter extends AbstractValueConverter<Integer> { @Override public Integer convertValue(final Value value, final Thing thing, final Class<? extends Integer> desiredType) throws ValueConversionException { try { return Integer.parseInt(value.stringValue()); } catch (NumberFormatException e) { throw new ValueConversionException("Issue getting int value from statement", e); } } IntegerValueConverter(); @Override Integer convertValue(final Value value, final Thing thing, final Class<? extends Integer> desiredType); @Override Value convertType(Integer type, Thing thing);  }
@Test public void testEmpty() { try { valueConverter.convertValue(valueFactory.createLiteral(""), null, type); TestCase.fail("Empty string should cause ValueConversionException"); } catch (ValueConversionException e) { TestCase.assertTrue("Cause of error should have been NumberFormatException", e.getCause() instanceof NumberFormatException); } }