alibaba / alibaba/testable-mock
希望直接支持“多次相同参数调用时,按第几次调用返回不同的结果”mock
Open
- Dominant language
- Java
- Stars
- 1.8k
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
例如通过lastId进行分页查询,lastId从上次分页查询结果中获得。
现在有几种方法可以实现:
1.通过MOCK_CONTEXT在@MockMethod方法中记录被调用次数;
2.@MockMethod方法中根据传入的lastId,通过设置在MOCK_CONTEXT的map获取对应返回结果。
写法都不够优雅,希望能直接提供方法支持。
Contributor guide
No contributing guide indexed for this repository
Research direction
No files, tests, or entry points are named. First clarify the intended API and exact behavior for repeated calls with identical parameters, including call ordering and reset semantics; then inspect the existing mock API and add focused tests that define when the feature is complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100