DATACMNS-31 - Added null check to SimpleTypeHolder.isSimpleType(…).

The MappingBeanHelper mentioned in the ticket was recently replaced by SimpleTypeHolder.
This commit is contained in:
Oliver Gierke
2011-06-10 15:03:08 -07:00
parent c9eeee545a
commit 5650b068ed
2 changed files with 10 additions and 0 deletions

View File

@@ -115,6 +115,7 @@ public class SimpleTypeHolder {
* @return
*/
public boolean isSimpleType(Class<?> type) {
Assert.notNull(type);
for (Class<?> clazz : simpleTypes) {
if (type == clazz || clazz.isAssignableFrom(type)) {
return true;

View File

@@ -39,6 +39,15 @@ public class SimpleTypeHolderUnitTests {
public void rejectsNullOriginal() {
new SimpleTypeHolder(new HashSet<Class<?>>(), null);
}
/**
* @see DATACMNS-31
*/
@Test(expected = IllegalArgumentException.class)
public void rejectsNullTypeForIsSimpleTypeCall() {
SimpleTypeHolder holder = new SimpleTypeHolder();
holder.isSimpleType(null);
}
@Test
public void addsDefaultTypes() {