alibaba / alibaba/testable-mock

能否更灵活的引入多个Mock容器

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

Description

目前@MockWith注解只能指定引入一个Mock容器类,并且还会让自身写的内部静态Mock类失效(虽然可以通过静态内部类继承解决,但是多个的情况下Java不支持多继承)。项目较为复杂的情况下,可能需要多个写好的Mock方法被复用(全部写在同一个Mock类中会导致依赖太多反而也很麻烦)。虽然目前提供的例子里引入多个Mock类却需要在同一个包下,实际项目中想做到这一点是比较困难的。因此是否有其他办法引入多个Mock容器类呢?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the @MockWith annotation and the documented examples that import multiple mock classes. Determine how mock containers are discovered and how internal static mock classes are handled. Done means multiple reusable mock containers can be selected across packages without disabling internal static mocks, with tests covering both cases.

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
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.