alibaba / alibaba/testable-mock
Springboot+SpringMVC的工程,mock了serviceA的接口方法不生效
- Dominant language
- Java
- Stars
- 1.8k
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
Springboot+SpringMVC的工程:
1、工程有两个service类:ServiceA,ServiceB,
2、在ServiceATest类添加了静态类Mock并拷贝了ServiceA.A1()的方法签名以及实现到Mock内
3、在ServiceBTest类内的,不管是new 还是@Autowired 注入 ServiceA,ServiceBTest单元测试类的方法调用ServiceA.A1(),都不会走mock方法,而是走的原方法。
4、如果ServiceBTest单元测试类的方法调用ServiceA.**A2**(),而ServiceA类中的方法**A2**() 内调用了ServiceA类的A1(),这样是会走A1方法的mock方法。
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the behavior described in ServiceATest and ServiceBTest, comparing calls to ServiceA.A1() with calls to ServiceA.A2() that invoke A1(). Start by checking how the static Mock is applied across these test classes; done means the intended mock behavior is understood and the relevant unit test consistently demonstrates the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100