如何在 Spring 中为 @Lookup 注解注入模拟

USe*_*299 7 java spring unit-testing mockito

@Component
public class SomeFactory implements ISomeFactory {

    public someWatchFactory() {};
    @Override
    public boolean startWatch(MethodToWatch methodName, UUID uniqueID, Callable toRun) {
        IPerformanceStopWatch mywatch = getStartWatch(methodName,uniqueID,toRun);
        return mywatch.startWatchDeployTaskStatus();
    }

     @Lookup
    private IPerformanceStopWatch getStartWatch(MethodToWatch methodName, String uniqueID, Callable toRun) {
        IPerformanceStopWatch mywatch = getStartWatch(methodName,uniqueID,toRun);
        return null;  //stub implementation which will be replaced by the container
    }
}
Run Code Online (Sandbox Code Playgroud)

我想测试工厂类,使用类似:

@InjectMock
ISomeFactory someFactory;

@Mock
IPerformanceStopWatch performanceWatch
Run Code Online (Sandbox Code Playgroud)

每当SomeFactory类内的查找注释尝试获取实例时,它将使用模拟。

我该怎么做呢?