### Question:
ListType extends AbstractType { public Object convertToTypedObject(final Object source) { if (source == null) { return null; } if (source instanceof TypedList) { if (this.equals(((TypedList) source).getType()) == false) { throw new UnassignableValueException(); } return source; } if (source instanceof Collection) { return new TypedList(this, (Collection<?>) source); } if (source.getClass().isArray()) { return new TypedList(this, source); } throw new UnassignableValueException(); } ListType();  ListType(final String id, final String name, final Type elementType); Type getElementType(); void setElementType(Type elementType); @Override boolean isAssignableFrom(Class<?> clazz); Object convertToTypedObject(final Object source); boolean isAssignableValue(Object source); @Override boolean isValid();  }### Answer:
@Test public void testConvertToTypedObject() throws Exception { ListType stringListType = new ListType("string[]", "string[]", PrimitiveType.STRING); String[] stringArray = new String[] { "a", "b", "c" }; Object object = stringListType.convertToTypedObject(stringArray); assertNotNull(object); assertTrue(object instanceof TypedList); TypedList typedStringList = (TypedList)object; assertEquals(stringArray.length, typedStringList.size()); for (int i = 0; i < stringArray.length; i++) { assertEquals(stringArray[i], typedStringList.get(i)); } int[] intArray = new int[] { 1, 2, 3 }; assertTrue(isUnassignableValue(stringListType, intArray)); ListType integerListType = new ListType("integer[]", "integer[]", PrimitiveType.INTEGER); object = integerListType.convertToTypedObject(intArray); assertNotNull(object); assertTrue(object instanceof TypedList); TypedList typedIntegerList = (TypedList)object; assertEquals(intArray.length, typedIntegerList.size()); for (int i = 0; i < intArray.length; i++) { assertEquals(intArray[i], typedIntegerList.get(i)); } }