use TypeDescriptor.forObject instead of constructor; enforce use of TypeDescriptor.valueOf through making the constructor private

This commit is contained in:
Juergen Hoeller
2009-12-15 20:18:31 +00:00
parent 7fb19d658b
commit dc99df2972
4 changed files with 107 additions and 114 deletions

View File

@@ -16,12 +16,11 @@
package org.springframework.core.convert;
import java.util.List;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import java.util.List;
import org.junit.Test;
/**
@@ -53,7 +52,7 @@ public class TypeDescriptorTests {
@Test
public void buildingArrayTypeDescriptors() throws Exception {
TypeDescriptor typeDescriptor = new TypeDescriptor(new int[0].getClass());
TypeDescriptor typeDescriptor = TypeDescriptor.valueOf(int[].class);
assertTrue(typeDescriptor.isArray());
assertEquals(Integer.TYPE,typeDescriptor.getElementType());
}