DATACMNS-1087 - Fixed Vavr Option creation from present value.

We now reflectively invoke the static method Option.of(…), while we previously tried to invoke an instance method on the parameter value.
This commit is contained in:
Oliver Gierke
2017-06-09 21:24:08 +02:00
parent 0398bdd22f
commit e1761f6c8c
2 changed files with 11 additions and 1 deletions

View File

@@ -525,7 +525,7 @@ public abstract class QueryExecutionConverters {
*/
@Override
protected Object wrap(Object source) {
return ReflectionUtils.invokeMethod(OF_METHOD, source);
return ReflectionUtils.invokeMethod(OF_METHOD, null, source);
}
public static WrapperType getWrapperType() {

View File

@@ -303,6 +303,16 @@ public class QueryExecutionConvertersUnitTests {
assertThat(allowedPageableTypes, hasItem(io.vavr.collection.Seq.class));
}
@Test
public void convertsValueToVavrOption() {
io.vavr.control.Option<String> result = conversionService.convert(new NullableWrapper("foo"),
io.vavr.control.Option.class);
assertThat(result, is(vavrOption("foo")));
}
// Vavr
@SuppressWarnings("unchecked")