FloatValueConverter extends AbstractValueConverter<Float> { @Override public Float convertValue(Value value, Thing thing, Class<? extends Float> desiredType) throws ValueConversionException { try { return Float.parseFloat(value.stringValue()); } catch (NumberFormatException e) { throw new ValueConversionException("Issue getting float value from statement", e); } } FloatValueConverter(); @Override Float convertValue(Value value, Thing thing, Class<? extends Float> desiredType); @Override Value convertType(Float 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); } }