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