DATACMNS-1762 - Support Optional wrapping for projection getters.

We now support nullable wrappers for projection interfaces. Getters are inspected whether their return type is a supported nullable wrapper. If so, then the value can be wrapped into that type. Null values default in that case to their corresponding empty wrapper representation.

Original Pull Request: #459
This commit is contained in:
Mark Paluch
2020-07-16 15:17:10 +02:00
committed by Christoph Strobl
parent 04f59f1307
commit bd3992dfc5
4 changed files with 65 additions and 15 deletions

View File

@@ -74,12 +74,11 @@ class ProjectingMethodInterceptorUnitTests {
assertThat(methodInterceptor.invoke(invocation)).isEqualTo("Foo");
}
@Test // DATAREST-221
@Test // DATAREST-221, DATACMNS-1762
void returnsNullAsIs() throws Throwable {
MethodInterceptor methodInterceptor = new ProjectingMethodInterceptor(factory, interceptor, conversionService);
when(interceptor.invoke(invocation)).thenReturn(null);
mockInvocationOf("getString", null);
assertThat(methodInterceptor.invoke(invocation)).isNull();
}