IntToDoubleConverter implements Converter<Double, Integer> { @Override public Result<Integer> convertToModel(Double value, ValueContext context) { if (value == null) { return Result.ok(null); } return Result.ok(value.intValue()); }  @Override Result<Integer> convertToModel(Double value, ValueContext context); @Override Double convertToPresentation(Integer value, ValueContext context);  }
@Test public void testConvertToModel() { IntToDoubleConverter cv = new IntToDoubleConverter(); Result<Integer> result = cv.convertToModel(null, createContext()); assertNull(result.getOrThrow(r -> new OCSRuntimeException())); result = cv.convertToModel(1234.56, createContext()); assertEquals(1234, result.getOrThrow(r -> new OCSRuntimeException()).longValue()); }