@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
}
}
我想测试工厂类,使用类似的东西:
@InjectMock
ISomeFactory someFactory;
@Mock
IPerformanceStopWatch performanceWatch
每当SomeFactory
类中的查找注释试图获取实例时,它就会使用模拟。
我该怎么做?