alibaba/testable-mock

when use MockWith annotation, mockClass not right

winstonczc opened this issue · 2 comments

TestableClassTransformer#lookForMockWithAnnotationAsSourceClass
->
TestableClassTransformer#parseMockWithAnnotation
...
if (isExpectedType(cn.name, type, expectedType)) {
   Type clazz = AnnotationUtil.getAnnotationParameter(an, ConstPool.FIELD_VALUE,
   Type.getType(NullType.class), Type.class);
   DiagnoseUtil.setupByClass(ClassUtil.getClassNode(clazz.getClassName()));
   return clazz.getClassName();
}
...

clazz.getClassName() should be converted to vm className

linfan commented

Could you provide more details or a test case to show why this mock class is incorrect ?

className should be converted to slash format in method TestableClassTransformer#lookForMockWithAnnotationAsTestClass before return ,like:com/xxx/xxx