Skip to content

Commit cd933c7

Browse files
committed
full support for arbitrary nesting of collections in fields (SPR-8394); proper type detection in nested collections within arrays
1 parent d940811 commit cd933c7

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

org.springframework.core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2011 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,12 +16,6 @@
1616

1717
package org.springframework.core.convert;
1818

19-
import static junit.framework.Assert.assertEquals;
20-
import static junit.framework.Assert.assertTrue;
21-
import static org.junit.Assert.assertFalse;
22-
import static org.junit.Assert.assertNotNull;
23-
import static org.junit.Assert.assertNull;
24-
2519
import java.lang.annotation.ElementType;
2620
import java.lang.annotation.Retention;
2721
import java.lang.annotation.RetentionPolicy;
@@ -33,10 +27,16 @@
3327
import java.util.List;
3428
import java.util.Map;
3529

36-
import org.junit.Ignore;
3730
import org.junit.Test;
31+
3832
import org.springframework.core.MethodParameter;
3933

34+
import static junit.framework.Assert.assertEquals;
35+
import static junit.framework.Assert.assertTrue;
36+
import static org.junit.Assert.assertFalse;
37+
import static org.junit.Assert.assertNotNull;
38+
import static org.junit.Assert.assertNull;
39+
4040
/**
4141
* @author Keith Donald
4242
* @author Andy Clement
@@ -397,12 +397,11 @@ public void fieldArray() throws Exception {
397397
}
398398

399399
@Test
400-
@Ignore
401400
public void fieldComplexTypeDescriptor() throws Exception {
402401
TypeDescriptor typeDescriptor = new TypeDescriptor(TypeDescriptorTests.class.getDeclaredField("arrayOfListOfString"));
403402
assertTrue(typeDescriptor.isArray());
404-
assertEquals(List.class,typeDescriptor.getElementTypeDescriptor());
405-
assertEquals(String.class, typeDescriptor.getElementTypeDescriptor().getElementTypeDescriptor());
403+
assertEquals(List.class,typeDescriptor.getElementTypeDescriptor().getType());
404+
assertEquals(String.class, typeDescriptor.getElementTypeDescriptor().getElementTypeDescriptor().getType());
406405
assertEquals("java.util.List[]",typeDescriptor.toString());
407406
}
408407

@@ -417,13 +416,11 @@ public void fieldComplexTypeDescriptor2() throws Exception {
417416
}
418417

419418
@Test
420-
@Ignore
421419
public void fieldMap() throws Exception {
422-
// TODO: SPR-8394: typeIndex handling not currently supported by fields
423-
TypeDescriptor desc = new TypeDescriptor(getClass().getField("fieldMap"));
420+
TypeDescriptor desc = new TypeDescriptor(TypeDescriptorTests.class.getField("fieldMap"));
424421
assertTrue(desc.isMap());
425-
assertEquals(Integer.class, desc.getMapKeyTypeDescriptor().getElementTypeDescriptor());
426-
assertEquals(Long.class, desc.getMapValueTypeDescriptor().getElementTypeDescriptor());
422+
assertEquals(Integer.class, desc.getMapKeyTypeDescriptor().getElementTypeDescriptor().getType());
423+
assertEquals(Long.class, desc.getMapValueTypeDescriptor().getElementTypeDescriptor().getType());
427424
}
428425

429426
public Map<List<Integer>, List<Long>> fieldMap;

0 commit comments

Comments
 (0)