0
我正在使用PowerMock,我看到使用@InjectMock
我可以在我的测试中获得注入类。阿卡演员模拟注入类
但我需要的是,使用已注入类的Akka actor,对该actor执行测试并在其中注入模拟类。
class A extends Actor{
@Inject private B b;//How can I mock this class?
}
@Test
public test(){
final Props props = Props.create(A.class, new A());
testActorRef = TestActorRef.create(actorSystem, props);
Future<Object> ask = Patterns.ask(testActorRef);
}
只是为了澄清源代码无法修改。
我改变的问题,只怕源代码不能被修改 – paul