testable-mock icon indicating copy to clipboard operation
testable-mock copied to clipboard

when use MockWith annotation, mockClass not right

Open winstonczc opened this issue 2 years ago • 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

winstonczc avatar Feb 01 '23 10:02 winstonczc

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

linfan avatar Mar 31 '23 03:03 linfan

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

winstonczc avatar Apr 03 '23 06:04 winstonczc