【发布时间】:2019-10-29 17:52:06
【问题描述】:
我有一段代码:
if (wfStepExDetails.isPresent()) {
this.postInterruptActionsExecutor.takeActionAfterWFInterrupted(wfStepExDetails.get(), this.pAccId, interrupts, this.workflowStepDefinition);
}
内部测试类:
@Test
public void testHandlePostInterruptActions() {
postInterruptActionsExecutor.takeActionAfterWFInterrupted(getWfStepExecutionDetails().get(0), pAccId, interrupt, wfStep);
expectLastCall();
replay(postInterruptActionsExecutor);
orchestrator.handlePostInterruptActions(interrupt);
EasyMock.verify(postInterruptActionsExecutor, orcDepProvider, pwaDAO, pdh);
}
由于参数不匹配,测试失败:
[junit] Unexpected method call PostInterruptActionsExecutor.takeActionAfterWFInterrupted(WorkflowStepExecutionDetails(wfStepName=null, wfId=4c46f286-c368-49e7-a7db-30c39d72d1b8, planId=null, resultBranch=null, wfStepStatus=null, creationTime=null, workflowStepRequirements=null, attemptCount=null, parentWfStepId=null, wfStepType=null, wfStepDependencyResponseId=null), "81bd1b7e-7433-4116-bf46-52318b493e93", [com.amazon.verificationorchestration.plan.Interrupt@9e781b8e], com.amazon.verificationorchestration.plan.InitiateTokenVerificationWorkflowStep@860a7ec9):
[junit] PostInterruptActionsExecutor.takeActionAfterWFInterrupted(WorkflowStepExecutionDetails(wfStepName=null, wfId=4c46f286-c368-49e7-a7db-30c39d72d1b8, planId=null, resultBranch=null, wfStepStatus=null, creationTime=null, workflowStepRequirements=null, attemptCount=null, parentWfStepId=null, wfStepType=null, wfStepDependencyResponseId=null), "81bd1b7e-7433-4116-bf46-52318b493e93", [com.amazon.verificationorchestration.plan.Interrupt@9e781b8e], com.amazon.verificationorchestration.plan.InitiateTokenVerificationWorkflowStep@860a7ec9): expected: 1, actual: 0
即使预期调用和实际调用包含相同的参数,测试仍然失败。我在这里有什么遗漏吗?
【问题讨论】:
-
您的错误消息实际上是在说什么,通过您的模拟,您表明您希望使用这些参数进行特定调用,但在测试期间实际上并未进行该调用。
-
其实恰恰相反。打了一个意外的电话。