[ https://issues.apache.org/activemq/browse/CAMEL-2750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen reassigned CAMEL-2750: ---------------------------------- Assignee: Claus Ibsen > org.apache.camel.component.bean.BeanInfo not working properly with mocked > Interfaces > ------------------------------------------------------------------------------------ > > Key: CAMEL-2750 > URL: https://issues.apache.org/activemq/browse/CAMEL-2750 > Project: Apache Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.2.0 > Environment: Windows XP, JDK 1.6.0.17, Eclipse Ganymed, Maven 2.2.1, > ActiveMQ 5.3.1, Apache Camel 2.2 > Reporter: Didier Gutacker > Assignee: Claus Ibsen > > The BeanInfo-Class shows the same behaviour as ClassUtils-Class from Spring > 3.0.x (see Spring Issue 7066, https://jira.springsource.org/browse/SPR-7066). > When working with mock objects created by mockito using an interface the > getSuperclass()-Method returns java.lang.Object and the method to called on > the mock can't be found. > While looking around for a solution I found the path applied in Spring (see > https://fisheye.springsource.org/browse/spring-framework/trunk/org.springframework.core/src/main/java/org/springframework/util/ClassUtils.java?content-type=text/vnd.viewcvs-markup&r1=3227&r2=3228). > In method > public static Class<?> getUserClass(Class<?> clazz) > the code > return (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR) ? > clazz.getSuperclass() : clazz); > is replaced by > if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) { > Class<?> superClass = clazz.getSuperclass(); > if (superClass != null && !Object.class.equals(superClass)) { > return superClass; > } > } > return clazz; > While waiting for a fix in BeanInfo class a workaround is to mock the > concrete class not the interface, but this makes the test code more > complicated if several classes implement the same interface. > A Wor -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.