Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when use MockWith annotation, mockClass not right #315

Open
winstonczc opened this issue Feb 1, 2023 · 2 comments
Open

when use MockWith annotation, mockClass not right #315

winstonczc opened this issue Feb 1, 2023 · 2 comments

Comments

@winstonczc
Copy link

winstonczc commented Feb 1, 2023

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
Copy link
Collaborator

linfan commented Mar 31, 2023

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

@winstonczc
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants