Allow TypeDescriptor create with null generics

Restore the ability to create a TypeDescriptor for a collection or
map where the generics may be null.

Issue: SPR-11006
This commit is contained in:
Phillip Webb
2013-10-18 10:56:04 -07:00
parent cfb66252eb
commit 79048e18be
2 changed files with 20 additions and 4 deletions

View File

@@ -918,4 +918,18 @@ public class TypeDescriptorTests {
TypeDescriptor readObject = (TypeDescriptor) inputStream.readObject();
assertThat(readObject, equalTo(typeDescriptor));
}
@Test
public void createCollectionWithNullElement() throws Exception {
TypeDescriptor typeDescriptor = TypeDescriptor.collection(List.class, null);
assertThat(typeDescriptor.getElementTypeDescriptor(), nullValue());
}
@Test
public void createMapWithNullElements() throws Exception {
TypeDescriptor typeDescriptor = TypeDescriptor.map(LinkedHashMap.class, null, null);
assertThat(typeDescriptor.getMapKeyTypeDescriptor(), nullValue());
assertThat(typeDescriptor.getMapValueTypeDescriptor(), nullValue());
}
}