更新时间:2023-11-22 13:59:22
我在某人的在我的情况下,我使用了PowerMockito的部分模拟,如下所示.
In my case, I have used same partial mock of PowerMockito as below.
PowerMockito.stub(PowerMockito.method(OpenPgpUtility.class, "readPublicKey", InputStream.class)).toReturn(mockPGPPublicKey);
这让我可以模拟readPublicKey()
,但实际上是对encrypt()
which letting me to mock readPublicKey()
but an actual call to encrypt()