alibaba / alibaba/testable-mock

when use MockWith annotation, mockClass not right

Open
#315 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.8k
Forks
306
PR merge metrics
No merged PRs in 30d

Description

```
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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in TestableClassTransformer#lookForMockWithAnnotationAsSourceClass and follow into #parseMockWithAnnotation, focusing on the shown clazz.getClassName() path and how VM class names are represented. Done means the mockClass value is converted to the VM className before DiagnoseUtil.setupByClass and the returned value use it consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.