Accept target type in KeyValueAdapter.entries(…) and getAllOf(…).

We now accept the target type in both methods to retain type hints so that the underlying adapter implementation can use this type when materializing object instances.

Original Pull Request: #356
This commit is contained in:
Mark Paluch
2021-03-11 15:12:29 +01:00
committed by Christoph Strobl
parent bbaa63501d
commit ad5d2268ec
3 changed files with 32 additions and 4 deletions

View File

@@ -190,7 +190,7 @@ class KeyValueTemplateUnitTests {
template.findAll(Foo.class);
verify(adapterMock, times(1)).getAllOf(Foo.class.getName());
verify(adapterMock, times(1)).getAllOf(Foo.class.getName(), Foo.class);
}
@Test // DATACMNS-525
@@ -327,7 +327,7 @@ class KeyValueTemplateUnitTests {
void findAllOfShouldRespectTypeAliasAndFilterNonMatchingTypes() {
Collection foo = Arrays.asList(ALIASED_USING_ALIAS_FOR, SUBCLASS_OF_ALIASED_USING_ALIAS_FOR);
when(adapterMock.getAllOf("aliased")).thenReturn(foo);
when(adapterMock.getAllOf("aliased", SUBCLASS_OF_ALIASED_USING_ALIAS_FOR.getClass())).thenReturn(foo);
assertThat((Iterable) template.findAll(SUBCLASS_OF_ALIASED_USING_ALIAS_FOR.getClass()))
.contains(SUBCLASS_OF_ALIASED_USING_ALIAS_FOR);