Added entity conveter null checking; updated from string converters to simply test str.length() as pre-processing check
This commit is contained in:
@@ -251,6 +251,12 @@ public class DefaultConversionTests {
|
||||
assertEquals(new Long(1), e.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertObjectToObjectFinderMethodWithNull() {
|
||||
TestEntity e = (TestEntity) conversionService.convert(null, TypeDescriptor.valueOf(String.class), TypeDescriptor.valueOf(TestEntity.class));
|
||||
assertNull(e);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertObjectToObjectFinderMethodWithIdConversion() {
|
||||
TestEntity e = conversionService.convert("1", TestEntity.class);
|
||||
@@ -263,6 +269,12 @@ public class DefaultConversionTests {
|
||||
assertEquals("1", id);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToObjectToStringIdPropertyWithNull() {
|
||||
String id = (String) conversionService.convert(null, TypeDescriptor.valueOf(TestEntity.class), TypeDescriptor.valueOf(String.class));
|
||||
assertNull(id);
|
||||
}
|
||||
|
||||
public static class TestEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
Reference in New Issue
Block a user