From fa9e5b799abeb3d5503dadf7c7375e6bab0fd3db Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Thu, 4 Jul 2019 12:21:13 +0200 Subject: [PATCH] DATACMNS-1552 - Test case to verify Option values are returned as is. Make sure that the fix for DATACMNS-1524 fixes this ticket as well. A bit of whitespace in QueryExecutionResultHandler. --- .../core/support/QueryExecutionResultHandler.java | 2 +- .../support/QueryExecutionResultHandlerUnitTests.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/springframework/data/repository/core/support/QueryExecutionResultHandler.java b/src/main/java/org/springframework/data/repository/core/support/QueryExecutionResultHandler.java index fbbf31058..4988ea9ec 100644 --- a/src/main/java/org/springframework/data/repository/core/support/QueryExecutionResultHandler.java +++ b/src/main/java/org/springframework/data/repository/core/support/QueryExecutionResultHandler.java @@ -167,7 +167,7 @@ class QueryExecutionResultHandler { /** * Returns whether we have to process the given source object in the first place. - * + * * @param source can be {@literal null}. * @param targetType must not be {@literal null}. * @return diff --git a/src/test/java/org/springframework/data/repository/core/support/QueryExecutionResultHandlerUnitTests.java b/src/test/java/org/springframework/data/repository/core/support/QueryExecutionResultHandlerUnitTests.java index e84bfeeaf..1a0156368 100755 --- a/src/test/java/org/springframework/data/repository/core/support/QueryExecutionResultHandlerUnitTests.java +++ b/src/test/java/org/springframework/data/repository/core/support/QueryExecutionResultHandlerUnitTests.java @@ -405,6 +405,14 @@ public class QueryExecutionResultHandlerUnitTests { }); } + @Test // DATACMNS-1552 + public void keepsVavrOptionType() throws Exception { + + Option source = Option.of(new Entity()); + + assertThat(handler.postProcessInvocationResult(source, getMethod("option"))).isSameAs(source); + } + private static Method getMethod(String methodName) throws Exception { return Sample.class.getMethod(methodName); }