}
private void testToStringInternal(Object bean, PropertyDescriptor descriptor, Method writeMethod) throws Exception {
Class propertyType = descriptor.getPropertyType();
InstanceFactory instances = (InstanceFactory) factoryMap.get(propertyType);
if (instances == null) {
instances = new NestedBeanInstanceFactory(propertyType);
}
Object obj = null;
String invoke;
try {
for (Iterator it = instances.iterator(); it.hasNext();) {
obj = it.next();
writeMethod.invoke(bean, new Object[] { obj });
invoke = bean.toString();
String expected = (obj == null) ? "null" : obj.toString();
String message = "Property not in toString[:" + invoke + "] \nExpected{{" + expected + " }} "+ descriptor.getDisplayName();