autobox tests

master
Keith Donald 16 years ago
parent ebb203a251
commit 8b52b7eeef
  1. 17
      org.springframework.core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java
  2. 11
      org.springframework.core/src/test/java/org/springframework/core/convert/service/GenericConversionServiceTests.java

@ -15,17 +15,14 @@
*/
package org.springframework.core.convert;
import java.util.List;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertSame;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
import static org.junit.Assert.assertFalse;
import java.util.List;
import org.junit.Test;
/**
* @author Andy Clement
*/
@ -35,6 +32,12 @@ public class TypeDescriptorTests {
int[] intArray;
List<String>[] arrayOfListOfString;
@Test
public void testWrapperType() {
TypeDescriptor desc = TypeDescriptor.valueOf(int.class);
assertEquals(Integer.class, desc.getType());
}
@Test
public void listDescriptors() throws Exception {
TypeDescriptor typeDescriptor = new TypeDescriptor(TypeDescriptorTests.class.getDeclaredField("listOfString"));

@ -53,7 +53,18 @@ public class GenericConversionServiceTests {
public void executeConversionNullSource() {
assertEquals(null, service.executeConversion(null, type(Integer.class)));
}
@Test
public void executeCompatibleSource() {
assertEquals(false, service.executeConversion(false, type(boolean.class)));
}
@Test
public void executeCompatibleSource2() {
assertEquals(3, service.getConversionExecutor(Integer.class, TypeDescriptor.valueOf(int.class)).execute(new Integer(3)));
assertEquals(3, service.getConversionExecutor(int.class, TypeDescriptor.valueOf(Integer.class)).execute(3));
}
@Test
public void converterConvertForwardIndex() {
service.addConverter(new StringToInteger());

Loading…
Cancel
Save